gtkmm 4.14.0
Public Member Functions | Static Public Member Functions | Related Functions | List of all members
Gtk::TreeListRow Class Reference

A row in a Gtk::TreeListModel. More...

#include <gtkmm/treelistrow.h>

Inheritance diagram for Gtk::TreeListRow:
Inheritance graph
[legend]

Public Member Functions

 TreeListRow (TreeListRow && src) noexcept
 
TreeListRowoperator= (TreeListRow && src) noexcept
 
 ~TreeListRow () noexcept override
 
GtkTreeListRow * gobj ()
 Provides access to the underlying C GObject. More...
 
const GtkTreeListRow * gobj () const
 Provides access to the underlying C GObject. More...
 
GtkTreeListRow * gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
Glib::RefPtr< Glib::ObjectBase > get_item ()
 Gets the item corresponding to this row,. More...
 
Glib::RefPtr< const Glib::ObjectBase > get_item () const
 Gets the item corresponding to this row,. More...
 
void set_expanded (bool expanded=true)
 Expands or collapses a row. More...
 
bool get_expanded () const
 Gets if a row is currently expanded. More...
 
bool is_expandable () const
 Checks if a row can be expanded. More...
 
guint get_position () const
 Returns the position in the Gtk::TreeListModel that self occupies at the moment. More...
 
guint get_depth () const
 Gets the depth of this row. More...
 
Glib::RefPtr< Gio::ListModel > get_children ()
 If the row is expanded, gets the model holding the children of self. More...
 
Glib::RefPtr< const Gio::ListModel > get_children () const
 If the row is expanded, gets the model holding the children of self. More...
 
Glib::RefPtr< TreeListRowget_parent ()
 Gets the row representing the parent for self. More...
 
Glib::RefPtr< const TreeListRowget_parent () const
 Gets the row representing the parent for self. More...
 
Glib::RefPtr< TreeListRowget_child_row (guint position)
 If self is not expanded or position is greater than the number of children, nullptr is returned. More...
 
Glib::RefPtr< const TreeListRowget_child_row (guint position) const
 If self is not expanded or position is greater than the number of children, nullptr is returned. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::ListModel > > property_children () const
 The model holding the row's children. More...
 
Glib::PropertyProxy_ReadOnly< guint > property_depth () const
 The depth in the tree of this row. More...
 
Glib::PropertyProxy_ReadOnly< bool > property_expandable () const
 If this row can ever be expanded. More...
 
Glib::PropertyProxy< bool > property_expanded ()
 If this row is currently expanded. More...
 
Glib::PropertyProxy_ReadOnly< bool > property_expanded () const
 If this row is currently expanded. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Glib::ObjectBase > > property_item () const
 The item held in this row. More...
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gtk::TreeListRowwrap (GtkTreeListRow * object, bool take_copy=false)
 A Glib::wrap() method for this object. More...
 

Detailed Description

A row in a Gtk::TreeListModel.

Gtk::TreeListRow is the object used by Gtk::TreeListModel to represent items. It allows navigating the model as a tree and modify the state of rows.

Gtk::TreeListRow instances are created by a Gtk::TreeListModel only when the Gtk::TreeListModel::property_passthrough() property is not set.

There are various support objects that can make use of Gtk::TreeListRow objects, such as the Gtk::TreeExpander widget that allows displaying an icon to expand or collapse a row or Gtk::TreeListRowSorter that makes it possible to sort trees properly.

See also
Gtk::TreeListModel
Since gtkmm 3.98:

Constructor & Destructor Documentation

◆ TreeListRow()

Gtk::TreeListRow::TreeListRow ( TreeListRow &&  src)
noexcept

◆ ~TreeListRow()

Gtk::TreeListRow::~TreeListRow ( )
overridenoexcept

Member Function Documentation

◆ get_child_row() [1/2]

Glib::RefPtr< TreeListRow > Gtk::TreeListRow::get_child_row ( guint  position)

If self is not expanded or position is greater than the number of children, nullptr is returned.

Parameters
positionPosition of the child to get.
Returns
The child in position.

◆ get_child_row() [2/2]

Glib::RefPtr< const TreeListRow > Gtk::TreeListRow::get_child_row ( guint  position) const

If self is not expanded or position is greater than the number of children, nullptr is returned.

Parameters
positionPosition of the child to get.
Returns
The child in position.

◆ get_children() [1/2]

Glib::RefPtr< Gio::ListModel > Gtk::TreeListRow::get_children ( )

If the row is expanded, gets the model holding the children of self.

This model is the model created by the [callb.nosp@m.ack@.nosp@m.Gtk.T.nosp@m.reeL.nosp@m.istMo.nosp@m.delC.nosp@m.reate.nosp@m.Mode.nosp@m.lFunc] and contains the original items, no matter what value Gtk::TreeListModel::property_passthrough() is set to.

Returns
The model containing the children.

◆ get_children() [2/2]

Glib::RefPtr< const Gio::ListModel > Gtk::TreeListRow::get_children ( ) const

If the row is expanded, gets the model holding the children of self.

This model is the model created by the [callb.nosp@m.ack@.nosp@m.Gtk.T.nosp@m.reeL.nosp@m.istMo.nosp@m.delC.nosp@m.reate.nosp@m.Mode.nosp@m.lFunc] and contains the original items, no matter what value Gtk::TreeListModel::property_passthrough() is set to.

Returns
The model containing the children.

◆ get_depth()

guint Gtk::TreeListRow::get_depth ( ) const

Gets the depth of this row.

Rows that correspond to items in the root model have a depth of zero, rows corresponding to items of models of direct children of the root model have a depth of 1 and so on.

The depth of a row never changes until the row is removed from its model at which point it will forever return 0.

Returns
The depth of this row.

◆ get_expanded()

bool Gtk::TreeListRow::get_expanded ( ) const

Gets if a row is currently expanded.

Returns
true if the row is expanded.

◆ get_item() [1/2]

Glib::RefPtr< Glib::ObjectBase > Gtk::TreeListRow::get_item ( )

Gets the item corresponding to this row,.

Returns
The item of this row. This function is only marked as nullable for backwards compatibility reasons.

◆ get_item() [2/2]

Glib::RefPtr< const Glib::ObjectBase > Gtk::TreeListRow::get_item ( ) const

Gets the item corresponding to this row,.

Returns
The item of this row. This function is only marked as nullable for backwards compatibility reasons.

◆ get_parent() [1/2]

Glib::RefPtr< TreeListRow > Gtk::TreeListRow::get_parent ( )

Gets the row representing the parent for self.

That is the row that would need to be collapsed to make this row disappear.

If self is a row corresponding to the root model, nullptr is returned.

The value returned by this function never changes until the row is removed from its model at which point it will forever return nullptr.

Returns
The parent of self.

◆ get_parent() [2/2]

Glib::RefPtr< const TreeListRow > Gtk::TreeListRow::get_parent ( ) const

Gets the row representing the parent for self.

That is the row that would need to be collapsed to make this row disappear.

If self is a row corresponding to the root model, nullptr is returned.

The value returned by this function never changes until the row is removed from its model at which point it will forever return nullptr.

Returns
The parent of self.

◆ get_position()

guint Gtk::TreeListRow::get_position ( ) const

Returns the position in the Gtk::TreeListModel that self occupies at the moment.

Returns
The position in the model.

◆ get_type()

static GType Gtk::TreeListRow::get_type ( )
static

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

◆ gobj() [1/2]

GtkTreeListRow * Gtk::TreeListRow::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GtkTreeListRow * Gtk::TreeListRow::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ gobj_copy()

GtkTreeListRow * Gtk::TreeListRow::gobj_copy ( )

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

◆ is_expandable()

bool Gtk::TreeListRow::is_expandable ( ) const

Checks if a row can be expanded.

This does not mean that the row is actually expanded, this can be checked with get_expanded().

If a row is expandable never changes until the row is removed from its model at which point it will forever return false.

Returns
true if the row is expandable.

◆ operator=()

TreeListRow & Gtk::TreeListRow::operator= ( TreeListRow &&  src)
noexcept

◆ property_children()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::ListModel > > Gtk::TreeListRow::property_children ( ) const

The model holding the row's children.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_depth()

Glib::PropertyProxy_ReadOnly< guint > Gtk::TreeListRow::property_depth ( ) const

The depth in the tree of this row.

Default value: 0

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_expandable()

Glib::PropertyProxy_ReadOnly< bool > Gtk::TreeListRow::property_expandable ( ) const

If this row can ever be expanded.

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_expanded() [1/2]

Glib::PropertyProxy< bool > Gtk::TreeListRow::property_expanded ( )

If this row is currently expanded.

Default value: false

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_expanded() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::TreeListRow::property_expanded ( ) const

If this row is currently expanded.

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_item()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Glib::ObjectBase > > Gtk::TreeListRow::property_item ( ) const

The item held in this row.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ set_expanded()

void Gtk::TreeListRow::set_expanded ( bool  expanded = true)

Expands or collapses a row.

If a row is expanded, the model of calling the [callb.nosp@m.ack@.nosp@m.Gtk.T.nosp@m.reeL.nosp@m.istMo.nosp@m.delC.nosp@m.reate.nosp@m.Mode.nosp@m.lFunc] for the row's item will be inserted after this row. If a row is collapsed, those items will be removed from the model.

If the row is not expandable, this function does nothing.

Parameters
expandedtrue if the row should be expanded.

Friends And Related Function Documentation

◆ wrap()

Glib::RefPtr< Gtk::TreeListRow > wrap ( GtkTreeListRow *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.