gtkmm: Gtk::TreeRow Class Reference

gtkmm 4.11.3

Public Member Functions | List of all members
Gtk::TreeRow Class Reference
TreeView Classes

Typedefed as TreeModel::Row. More...

`#include <gtkmm/treeiter.h>`

Inheritance diagram for Gtk::TreeRow:
[legend]

## Public Member Functions
template<typename ColumnType >
TreeValueProxy< TreeRow, ColumnType > | operator[] (const TreeModelColumn< ColumnType > & column)
| Use this to set and get the value of this column of this row. More...
template<typename ColumnType >
void | set_value (const TreeModelColumn< ColumnType > & column, const ColumnType &data)
| Sets the value of this column of this row. More...
template<typename ColumnType >
void | set_value (int column, const ColumnType &data)
| Use set_value(const TreeModelColumn<>& column, const ColumnType& data) unless you do not know the column type at compile-time. More...
TreeNodeChildren & | children ()
| This returns an STL-like container API, for iterating over the rows. More...
TreeIter< TreeRow > | parent ()
| Gets an iterator to the parent row of this row. More...
TreeIter< TreeRow > | get_iter ()
| Gets an iterator to this row. More...
const TreeNodeConstChildren & | children () const
| This returns an STL-like container API, for iterating over the rows. More...
TreeIter< TreeConstRow > | parent () const
| Gets a const_iterator to the parent row of this row. More...
TreeIter< TreeConstRow > | get_iter () const
| Gets a const_iterator to this row. More...
Public Member Functions inherited from Gtk::TreeConstRow
template<typename ColumnType >
const TreeValueProxy< TreeConstRow, ColumnType > | operator[] (const TreeModelColumn< ColumnType > & column) const
| Use this to get the value of this column of this row. More...
template<typename ColumnType >
ColumnType | get_value (const TreeModelColumn< ColumnType > & column) const
| Gets the value of this column of this row. More...
template<typename ColumnType >
void | get_value (int column, ColumnType &data) const
| Use get_value(const TreeModelColumn<>& column) unless you do not know the column type at compile-time. More...
const TreeNodeConstChildren & | children () const
| This returns an STL-like container API, for iterating over the rows. More...
TreeIter< TreeConstRow > | parent () const
| Gets a const_iterator to the parent row of this row. More...
TreeIter< TreeConstRow > | get_iter () const
| Gets a const_iterator to this row. More...
| operator bool () const
| Discover whether this is a valid row. More...
Public Member Functions inherited from Gtk::TreeIterBase
| TreeIterBase (const TreeIterBase & other) noexcept
TreeIterBase & | operator= (const TreeIterBase & other) noexcept
| TreeIterBase (TreeIterBase && other) noexcept
TreeIterBase & | operator= (TreeIterBase && other) noexcept
| TreeIterBase ()
| TreeIterBase (const GtkTreeIter * gobject)
GtkTreeIter * | gobj ()
| Provides access to the underlying C instance. More...
const GtkTreeIter * | gobj () const
| Provides access to the underlying C instance. More...

## Additional Inherited Members
Static Public Member Functions inherited from Gtk::TreeIterBase
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
Protected Attributes inherited from Gtk::TreeIterBase
GtkTreeIter | gobject_

## Detailed Description

Typedefed as TreeModel::Row.

Dereference a TreeModel::iterator to get the Row. Use operator[] or set_value() and get_value() to access the values in the columns of this row.

If the model contains a hierarchy of rows (such as Gtk::TreeStore), then you can access the child rows with children().

You can use get_iter() to get an iterator that points to the Row, e.g. for use in a parameter that takes a const TreeModel::iterator& or a const TreeModel::const_iterator&.

Deprecated:
  4.10: Use Gio::ListModel instead.

## Member Function Documentation

## ◆ children() [1/2]

TreeNodeChildren & Gtk::TreeRow::children | ( |  | ) |

This returns an STL-like container API, for iterating over the rows.

See also Gtk::TreeModel::children() for the top-level children.

## ◆ children() [2/2]

const TreeNodeConstChildren & Gtk::TreeConstRow::children | ( |  | ) | const

This returns an STL-like container API, for iterating over the rows.

See also Gtk::TreeModel::children() for the top-level children.

## ◆ get_iter() [1/2]

TreeIter< TreeRow > Gtk::TreeRow::get_iter | ( |  | ) |

Gets an iterator to this row.

Returns
  An iterator to this row.

## ◆ get_iter() [2/2]

TreeIter< TreeConstRow > Gtk::TreeConstRow::get_iter | ( |  | ) | const

Gets a const_iterator to this row.

Returns
  A const_iterator to this row.

## ◆ operator[]()

template <typename ColumnType >

TreeValueProxy< TreeRow, ColumnType > Gtk::TreeRow::operator[] | ( | const TreeModelColumn< ColumnType > & | column | ) |
| inline

Use this to set and get the value of this column of this row.

This is a templated method, so the compiler will not allow you to provide an inappropriate type of data for the model column.

This is just a more convenient syntax that does the same thing as set_value() and get_value().

Parameters

  column | The model column.

## ◆ parent() [1/2]

TreeIter< TreeRow > Gtk::TreeRow::parent | ( |  | ) |

Gets an iterator to the parent row of this row.

Returns
  An iterator to the parent row.

## ◆ parent() [2/2]

TreeIter< TreeConstRow > Gtk::TreeConstRow::parent | ( |  | ) | const

Gets a const_iterator to the parent row of this row.

Returns
  A const_iterator to the parent row.

## ◆ set_value() [1/2]

template <typename ColumnType >

void Gtk::TreeRow::set_value | ( | const TreeModelColumn< ColumnType > & | column,
|  | const ColumnType & | data
| ) |  |

Sets the value of this column of this row.

This is a templated method, so the compiler will not allow you to provide an inappropriate type of data for the model column.

See also operator[]().

Parameters

  column | The model column.
  data | The new value to use for this column of this row.

## ◆ set_value() [2/2]

template <typename ColumnType >

void Gtk::TreeRow::set_value | ( | int | column,
|  | const ColumnType & | data
| ) |  |

Use set_value(const TreeModelColumn<>& column, const ColumnType& data) unless you do not know the column type at compile-time.

If the data is of an inappropriate C++ type then this might fail at runtime.

Parameters

  column | The number of the column whose value you want to change.
  data | The new value to use for this column of this row.