About all my projects
Gnome::Gtk4::TreeListRow

Gnome::Gtk4::TreeListRow

Description

Gnome::Gtk4::TreeListRow is used by Gnome::Gtk4::TreeListModel to represent items.

It allows navigating the model as a tree and modify the state of rows.

Gnome::Gtk4::TreeListRow instances are created by a Gnome::Gtk4::TreeListModel only when the passthrough defined in Gnome::Gtk4::TreeListModel property is not set.

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

Class initialization

new

:native-object

Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object :$native-object! )

Methods

get-child-row

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

method get-child-row ( UInt() $position --> N-Object )
  • $position; position of the child to get.

Return value; the child in $position.

get-children

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

This model is the model created by the [callback $Gtk.TreeListModelCreateModelFunc] and contains the original items, no matter what value passthrough defined in Gnome::Gtk4::TreeListModel is set to.

method get-children (--> N-List )

Return value; The model containing the children.

get-depth

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.

method get-depth (--> UInt )

Return value; The depth of this row.

get-expanded

Gets if a row is currently expanded.

method get-expanded (--> Bool )

Return value; True if the row is expanded.

get-item

Gets the item corresponding to this row,

method get-item (--> gpointer )

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

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, undefined 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 undefined.

method get-parent (--> N-Object )

Return value; The parent of $self.

get-position

Returns the position in the Gnome::Gtk4::TreeListModel that $self occupies at the moment.

method get-position (--> UInt )

Return value; The position in the model.

is-expandable

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.

method is-expandable (--> Bool )

Return value; True if the row is expandable.

set-expanded

Expands or collapses a row.

If a row is expanded, the model of calling the [callback $Gtk.TreeListModelCreateModelFunc] 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.

method set-expanded ( Bool() $expanded )
  • $expanded; True if the row should be expanded.