Main Page Widgets Namespaces Book

# Gtk::TreePath Class Reference
[TreeView Classes]

Typedefed as Gtk::TreeModel::Path. More...

List of all members.

## 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< iterator > | reverse_iterator
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator

## Public Member Functions

| TreePath ()
| TreePath (GtkTreePath* gobject, bool make_a_copy=true)
| TreePath (const TreePath& other)
TreePath& | operator= (const TreePath& other)
| ~TreePath ()
void | swap (TreePath& other)
GtkTreePath* | gobj ()
| Provides access to the underlying C instance.
const GtkTreePath* | gobj () const
| Provides access to the underlying C instance.
GtkTreePath* | gobj_copy () const
| TreePath (size_type n, value_type value=0)
| TreePath (const Glib::ustring& path)
| TreePath (const TreeModel::iterator& iter)
template <class In> | TreePath (In pbegin, In pend)
void | clear ()
TreePath& | operator= (const TreeModel::iterator& iter)
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 it's 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.
bool | set_in_selection_data (SelectionData& selection_data, const Glib::RefPtr<const TreeModel>& model) const
| Sets selection data of target type "GTK_TREE_MODEL_ROW".
Compatibility methods -- deprecated in gtkmm 2.2. TODO: Why? What replaces them? murrayc
void | append_index (int index)
| Appends a new index to a path.
void | prepend_index (int index)
| Prepends a new index to a path.
int | get_depth () const
| Returns the current depth of path .
Glib::ArrayHandle<int> | get_indices () const
bool | is_ancestor (TreePath& descendant) const
| Returns `true` if descendant is a descendant of path .
bool | is_descendant (TreePath& ancestor) const
| Returns `true` if path is a descendant of ancestor .

## Static Public Member Functions

bool | get_from_selection_data (const SelectionData& selection_data, Glib::RefPtr<TreeModel>& model, TreePath& path)
| Obtains a Gtk::TreeModel and Gtk::TreeModel::Path from selection data of target type "GTK_TREE_MODEL_ROW".
bool | get_from_selection_data (const SelectionData& selection_data, TreePath& path)
| See description in the other overload.

## Protected Attributes

GtkTreePath* | gobject_

## Related Functions

(Note that these are not member functions.)
bool | operator== (const TreePath& lhs, const TreePath& rhs)
bool | operator!= (const TreePath& lhs, const TreePath& rhs)
bool | operator< (const TreePath& lhs, const TreePath& rhs)
bool | operator> (const TreePath& lhs, const TreePath& rhs)
bool | operator<= (const TreePath& lhs, const TreePath& rhs)
bool | operator>= (const TreePath& lhs, const TreePath& rhs)
void | swap (TreePath& lhs, TreePath& rhs)
Gtk::TreePath | wrap (GtkTreePath* object, bool take_copy=false)

## Detailed Description

Typedefed as Gtk::TreeModel::Path.

## Member Typedef Documentation

typedef const int* Gtk::TreePath::const_iterator

typedef const int& Gtk::TreePath::const_reference

typedef std::reverse_iterator<const_iterator> Gtk::TreePath::const_reverse_iterator

typedef int Gtk::TreePath::difference_type

typedef int* Gtk::TreePath::iterator

typedef int& Gtk::TreePath::reference

typedef std::reverse_iterator<iterator> Gtk::TreePath::reverse_iterator

typedef unsigned int Gtk::TreePath::size_type

typedef int Gtk::TreePath::value_type

## Constructor & Destructor Documentation

Gtk::TreePath::TreePath | ( |  | ) |

Gtk::TreePath::TreePath | ( | GtkTreePath* | gobject,
|  | bool | make_a_copy = true
| ) | `[explicit]`

Gtk::TreePath::TreePath | ( | const TreePath& | other | ) |

Gtk::TreePath::~TreePath | ( |  | ) |

Gtk::TreePath::TreePath | ( | size_type | n,
|  | value_type | value = 0
| ) | `[explicit]`

Gtk::TreePath::TreePath | ( | const Glib::ustring& | path | ) | `[explicit]`

Gtk::TreePath::TreePath | ( | const TreeModel::iterator& | iter | ) | `[explicit]`

template <class In>
Gtk::TreePath::TreePath | ( | In | pbegin,
|  | In | pend
| ) | `[inline]`

## Member Function Documentation

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

void Gtk::TreePath::append_index | ( | int | index | ) |

Appends a new index to a path.

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

Parameters:

  index_ | The index.

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

const_reference Gtk::TreePath::back | ( |  | ) | const`[inline]`

reference Gtk::TreePath::back | ( |  | ) | `[inline]`

const_iterator Gtk::TreePath::begin | ( |  | ) | const

iterator Gtk::TreePath::begin | ( |  | ) |

void Gtk::TreePath::clear | ( |  | ) |

void Gtk::TreePath::down | ( |  | ) |

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

bool Gtk::TreePath::empty | ( |  | ) | const

const_iterator Gtk::TreePath::end | ( |  | ) | const

iterator Gtk::TreePath::end | ( |  | ) |

const_reference Gtk::TreePath::front | ( |  | ) | const`[inline]`

reference Gtk::TreePath::front | ( |  | ) | `[inline]`

int Gtk::TreePath::get_depth | ( |  | ) | const

Returns the current depth of path .

Returns:
  The depth of path .

bool Gtk::TreePath::get_from_selection_data | ( | const SelectionData& | selection_data,
|  | TreePath& | path
| ) | `[static]`

| See description in the other overload.

bool Gtk::TreePath::get_from_selection_data | ( | const SelectionData& | selection_data,
|  | Glib::RefPtr<TreeModel>& | model,
|  | TreePath& | path
| ) | `[static]`

Obtains a Gtk::TreeModel and Gtk::TreeModel::Path from selection data of target type "GTK_TREE_MODEL_ROW".

Normally called from a drag_data_received handler. This function can only be used if originates from the same process that's calling this function, because a pointer to the tree model is being passed around. If you aren't in the same process, then you'll get memory corruption. In the Gtk::TreeDragDest drag_data_received signal handler, you can assume that selection data of type "GTK_TREE_MODEL_ROW" is from the current process.

: a #GtkSelectionData : a Gtk::TreeModel : a row in tree_model

Returns:
  true if the selection_data had target type "GTK_TREE_MODEL_ROW" and is otherwise valid

Glib::ArrayHandle<int> Gtk::TreePath::get_indices | ( |  | ) | const

const GtkTreePath* Gtk::TreePath::gobj | ( |  | ) | const`[inline]`

| Provides access to the underlying C instance.

GtkTreePath* Gtk::TreePath::gobj | ( |  | ) | `[inline]`

| Provides access to the underlying C instance.

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

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

Returns `true` if descendant is a descendant of path .

Parameters:

  descendant | Another Gtk::TreePath.

Returns:
  `true` if descendant is contained inside path .

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

Returns `true` if descendant is a descendant of path .

Parameters:

  descendant | Another Gtk::TreePath.

Returns:
  `true` if descendant is contained inside path .

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

Returns `true` if path is a descendant of ancestor .

Parameters:

  ancestor | Another Gtk::TreePath.

Returns:
  `true` if ancestor contains path somewhere below it.

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

Returns `true` if path is a descendant of ancestor .

Parameters:

  ancestor | Another Gtk::TreePath.

Returns:
  `true` if ancestor contains path somewhere below it.

void Gtk::TreePath::next | ( |  | ) |

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

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

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

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

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

void Gtk::TreePath::prepend_index | ( | int | index | ) |

Prepends a new index to a path.

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

Parameters:

  index_ | The index.

bool Gtk::TreePath::prev | ( |  | ) |

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

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

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

Appends a new index to a path.

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

Parameters:

  index_ | The index.

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

Prepends a new index to a path.

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

Parameters:

  index_ | The index.

const_reverse_iterator Gtk::TreePath::rbegin | ( |  | ) | const`[inline]`

reverse_iterator Gtk::TreePath::rbegin | ( |  | ) | `[inline]`

const_reverse_iterator Gtk::TreePath::rend | ( |  | ) | const`[inline]`

reverse_iterator Gtk::TreePath::rend | ( |  | ) | `[inline]`

bool Gtk::TreePath::set_in_selection_data | ( | SelectionData& | selection_data,
|  | const Glib::RefPtr<const TreeModel>& | model
| ) | const

Sets selection data of target type "GTK_TREE_MODEL_ROW".

Normally used in a drag_data_get signal handler.

Parameters:

  selection_data | some #GtkSelectionData
  tree_model: | a Gtk::TreeModel

Returns:
  true if the selection_data had the proper target type to allow us to set a tree row

size_type Gtk::TreePath::size | ( |  | ) | const

void Gtk::TreePath::swap | ( | TreePath& | other | ) |

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.

Returns:
  A newly-allocated string. Must be freed with Glib::free().

bool Gtk::TreePath::up | ( |  | ) |

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

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

## Friends And Related Function Documentation

bool operator!= | ( | const TreePath& | lhs,
|  | const TreePath& | rhs
| ) | `[related]`

bool operator< | ( | const TreePath& | lhs,
|  | const TreePath& | rhs
| ) | `[related]`

bool operator<= | ( | const TreePath& | lhs,
|  | const TreePath& | rhs
| ) | `[related]`

bool operator== | ( | const TreePath& | lhs,
|  | const TreePath& | rhs
| ) | `[related]`

bool operator> | ( | const TreePath& | lhs,
|  | const TreePath& | rhs
| ) | `[related]`

bool operator>= | ( | const TreePath& | lhs,
|  | const TreePath& | rhs
| ) | `[related]`

void swap | ( | TreePath& | lhs,
|  | TreePath& | rhs
| ) | `[related]`

Gtk::TreePath wrap | ( | GtkTreePath* | object,
|  | bool | take_copy = false
| ) | `[related]`

## Member Data Documentation

GtkTreePath* Gtk::TreePath::gobject_`[protected]`

The documentation for this class was generated from the following file:

- treepath.h