gtkmm 4.16.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Gtk::TreePath Class Reference

A path is essentially a potential node. More...

#include <gtkmm/treepath.h>

Public Types

typedef unsigned int size_type
 
typedef int difference_type
 
typedef int value_type
 
typedef int & reference
 
typedef const int & const_reference
 
typedef int * iterator
 
typedef const int * const_iterator
 
typedef std::reverse_iterator< iteratorreverse_iterator
 
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 

Public Member Functions

 TreePath ()
 
 TreePath (const TreePath &other)
 
TreePathoperator= (const TreePath &other)
 
 TreePath (TreePath &&other) noexcept
 
TreePathoperator= (TreePath &&other) noexcept
 
 ~TreePath () noexcept
 
void swap (TreePath &other) noexcept
 
GtkTreePathgobj ()
 Provides access to the underlying C instance.
 
const GtkTreePathgobj () const
 Provides access to the underlying C instance.
 
GtkTreePathgobj_copy () const
 Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
 
 TreePath (GtkTreePath *gobject, bool make_a_copy=true)
 
 TreePath (size_type n, value_type value=0)
 
 TreePath (const Glib::ustring & path)
 
 TreePath (const TreeModel::iterator &iter)
 
 TreePath (const TreeModel::const_iterator &iter)
 
template<class In >
 TreePath (In pbegin, In pend)
 
void clear ()
 
TreePathoperator= (const TreeModel::iterator &iter)
 
TreePathoperator= (const TreeModel::const_iterator &iter)
 
 operator bool () const
 Checks that the path is not empty, by calling empty().
 
template<class In >
void assign (In pbegin, In pend)
 
template<class In >
void append (In pbegin, In pend)
 
void push_back (int index)
 Appends a new index to a path.
 
void push_front (int index)
 Prepends a new index to a path.
 
size_type size () const
 
bool empty () const
 
reference operator[] (size_type i)
 
const_reference operator[] (size_type i) const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
reference front ()
 
const_reference front () const
 
reference back ()
 
const_reference back () const
 
void next ()
 Moves the path to point to the next node at the current depth.
 
bool prev ()
 Moves the path to point to the previous node at the current depth, if it exists.
 
bool up ()
 Moves the path to point to its parent node, if it has a parent.
 
void down ()
 Moves path to point to the first child of the current path.
 
bool is_ancestor (const TreePath &descendant) const
 Returns true if descendant is a descendant of path.
 
bool is_descendant (const TreePath &ancestor) const
 Returns true if path is a descendant of ancestor.
 
Glib::ustring to_string () const
 Generates a string representation of the path.
 
Glib::RefPtr< Gdk::ContentProvidercreate_row_drag_content (const Glib::RefPtr< const TreeModel > &model) const
 Creates a content provider for dragging the path from model.
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system.
 
static bool get_row_drag_data (const Glib::ValueBase & value, Glib::RefPtr< const TreeModel > &model, TreePath & path)
 Obtains a Gtk::TreeModel and Gtk::TreeModel::Path from value of target type GTK_TYPE_TREE_ROW_DATA.
 
static bool get_row_drag_data (const Glib::ValueBase & value, TreePath & path)
 See description in the other overload.
 

Protected Attributes

GtkTreePathgobject_
 

Detailed Description

A path is essentially a potential node.

It is a location on a model that may or may not actually correspond to a node on a specific model.

A Path can be converted into either an array of unsigned integers or a string. The string form is a list of numbers separated by a colon. Each number refers to the offset at that level. Thus, the path "0" refers to the root node and the path "2:4" refers to the fifth child of the third node.

Typedefed as Gtk::TreeModel::Path.

Deprecated:
4.10: Use Gio::ListModel instead.

Member Typedef Documentation

◆ const_iterator

◆ const_reference

◆ const_reverse_iterator

◆ difference_type

◆ iterator

◆ reference

◆ reverse_iterator

◆ size_type

◆ value_type

Constructor & Destructor Documentation

◆ TreePath() [1/9]

Gtk::TreePath::TreePath ( )

◆ TreePath() [2/9]

Gtk::TreePath::TreePath ( const TreePath other)

◆ TreePath() [3/9]

Gtk::TreePath::TreePath ( TreePath &&  other)
noexcept

◆ ~TreePath()

Gtk::TreePath::~TreePath ( )
noexcept

◆ TreePath() [4/9]

Gtk::TreePath::TreePath ( GtkTreePath gobject,
bool  make_a_copy = true 
)
explicit

◆ TreePath() [5/9]

Gtk::TreePath::TreePath ( size_type  n,
value_type  value = 0 
)
explicit

◆ TreePath() [6/9]

Gtk::TreePath::TreePath ( const Glib::ustring &  path)
explicit

◆ TreePath() [7/9]

Gtk::TreePath::TreePath ( const TreeModel::iterator iter)
explicit

◆ TreePath() [8/9]

Gtk::TreePath::TreePath ( const TreeModel::const_iterator iter)
explicit

◆ TreePath() [9/9]

template <class In >
Gtk::TreePath::TreePath ( In  pbegin,
In  pend 
)
inline

Member Function Documentation

◆ append()

template <class In >
void Gtk::TreePath::append ( In  pbegin,
In  pend 
)

◆ assign()

template <class In >
void Gtk::TreePath::assign ( In  pbegin,
In  pend 
)
inline

◆ back() [1/2]

reference Gtk::TreePath::back ( )
inline

◆ back() [2/2]

const_reference Gtk::TreePath::back ( ) const
inline

◆ begin() [1/2]

iterator Gtk::TreePath::begin ( )

◆ begin() [2/2]

const_iterator Gtk::TreePath::begin ( ) const

◆ clear()

void Gtk::TreePath::clear ( )

◆ create_row_drag_content()

Glib::RefPtr< Gdk::ContentProvider > Gtk::TreePath::create_row_drag_content ( const Glib::RefPtr< const TreeModel > &  model) const

Creates a content provider for dragging the path from model.

Parameters
modelA Gtk::TreeModel.
Returns
A Gdk::ContentProvider.

◆ down()

void Gtk::TreePath::down ( )

Moves path to point to the first child of the current path.

Deprecated: 4.10

◆ empty()

bool Gtk::TreePath::empty ( ) const

◆ end() [1/2]

iterator Gtk::TreePath::end ( )

◆ end() [2/2]

const_iterator Gtk::TreePath::end ( ) const

◆ front() [1/2]

reference Gtk::TreePath::front ( )
inline

◆ front() [2/2]

const_reference Gtk::TreePath::front ( ) const
inline

◆ get_row_drag_data() [1/2]

static bool Gtk::TreePath::get_row_drag_data ( const Glib::ValueBase &  value,
Glib::RefPtr< const TreeModel > &  model,
TreePath path 
)
static

Obtains a Gtk::TreeModel and Gtk::TreeModel::Path from value of target type GTK_TYPE_TREE_ROW_DATA.

Parameters
valueA Glib::ValueBase
[out]modelA Gtk::TreeModel
[out]pathA row in model
Returns
true if the value had target type GTK_TYPE_TREE_ROW_DATA and is otherwise valid.

◆ get_row_drag_data() [2/2]

static bool Gtk::TreePath::get_row_drag_data ( const Glib::ValueBase &  value,
TreePath path 
)
static

See description in the other overload.

◆ get_type()

static GType Gtk::TreePath::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ gobj() [1/2]

GtkTreePath * Gtk::TreePath::gobj ( )
inline

Provides access to the underlying C instance.

◆ gobj() [2/2]

const GtkTreePath * Gtk::TreePath::gobj ( ) const
inline

Provides access to the underlying C instance.

◆ gobj_copy()

GtkTreePath * Gtk::TreePath::gobj_copy ( ) const

Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.

◆ is_ancestor()

bool Gtk::TreePath::is_ancestor ( const TreePath descendant) const

Returns true if descendant is a descendant of path.

Deprecated: 4.10

Parameters
descendantAnother Gtk::TreePath.
Returns
true if descendant is contained inside path.

◆ is_descendant()

bool Gtk::TreePath::is_descendant ( const TreePath ancestor) const

Returns true if path is a descendant of ancestor.

Deprecated: 4.10

Parameters
ancestorAnother Gtk::TreePath.
Returns
true if ancestor contains path somewhere below it.

◆ next()

void Gtk::TreePath::next ( )

Moves the path to point to the next node at the current depth.

Deprecated: 4.10

◆ operator bool()

Gtk::TreePath::operator bool ( ) const
explicit

Checks that the path is not empty, by calling empty().

For instance,

if(treepath)
do_something()
Since gtkmm 3.22:

◆ operator=() [1/4]

TreePath & Gtk::TreePath::operator= ( const TreeModel::const_iterator iter)

◆ operator=() [2/4]

TreePath & Gtk::TreePath::operator= ( const TreeModel::iterator iter)

◆ operator=() [3/4]

TreePath & Gtk::TreePath::operator= ( const TreePath other)

◆ operator=() [4/4]

TreePath & Gtk::TreePath::operator= ( TreePath &&  other)
noexcept

◆ operator[]() [1/2]

reference Gtk::TreePath::operator[] ( size_type  i)

◆ operator[]() [2/2]

const_reference Gtk::TreePath::operator[] ( size_type  i) const

◆ prev()

bool Gtk::TreePath::prev ( )

Moves the path to point to the previous node at the current depth, if it exists.

Deprecated: 4.10

Returns
true if path has a previous node, and the move was made.

◆ push_back()

void Gtk::TreePath::push_back ( int  index)

Appends a new index to a path.

As a result, the depth of the path is increased.

Deprecated: 4.10

Parameters
indexThe index.

◆ push_front()

void Gtk::TreePath::push_front ( int  index)

Prepends a new index to a path.

As a result, the depth of the path is increased.

Deprecated: 4.10

Parameters
indexThe index.

◆ rbegin() [1/2]

reverse_iterator Gtk::TreePath::rbegin ( )
inline

◆ rbegin() [2/2]

const_reverse_iterator Gtk::TreePath::rbegin ( ) const
inline

◆ rend() [1/2]

reverse_iterator Gtk::TreePath::rend ( )
inline

◆ rend() [2/2]

const_reverse_iterator Gtk::TreePath::rend ( ) const
inline

◆ size()

size_type Gtk::TreePath::size ( ) const

◆ swap()

void Gtk::TreePath::swap ( TreePath other)
noexcept

◆ to_string()

Glib::ustring Gtk::TreePath::to_string ( ) const

Generates a string representation of the path.

This string is a “:” separated list of numbers. For example, “4:10:0:3” would be an acceptable return value for this string. If the path has depth 0, nullptr is returned.

Deprecated: 4.10

Returns
The string.

◆ up()

bool Gtk::TreePath::up ( )

Moves the path to point to its parent node, if it has a parent.

Deprecated: 4.10

Returns
true if path has a parent, and the move was made.

Member Data Documentation

◆ gobject_

GtkTreePath* Gtk::TreePath::gobject_
protected