Gnome::Gtk4::TreeListModel
Description
Gnome::Gtk4::TreeListModel is a list model that can create child models on demand.
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! )
new-treelistmodel This function is not yet available
Creates a new empty Gnome::Gtk4::TreeListModel displaying $root
with all rows collapsed.
method new-treelistmodel ( N-List() $root, Bool() $passthrough, Bool() $autoexpand, &create-func, gpointer $user-data, … --> Gnome::Gtk4::TreeListModel \)
$root; (transfer ownership: full) The Gnome::Gio::R-ListModel to use as root.
$passthrough;
True
to pass through items from the models.$autoexpand;
True
to set the autoexpand property and expand the$root
model.&create-func; Function to call to create the Gnome::Gio::R-ListModel for the children of an item. Tthe function must be specified with following signature;
:( gpointer $item, gpointer $user-data --
N-Object )>.$user-data; Data to pass to
$create-func
.user-destroy; Function to call to free
$user-data
. Note that each argument must be specified as a type followed by its value!
Methods
get-autoexpand
Gets whether the model is set to automatically expand new rows that get added.
This can be either rows added by changes to the underlying models or via .set-expanded() in class Gnome::Gtk4::TreeListRow
.
method get-autoexpand (--> Bool )
Return value; True
if the model is set to autoexpand.
get-child-row
Gets the row item corresponding to the child at index $position
for $self
's root model.
If $position
is greater than the number of children in the root model, undefined is returned.
Do not confuse this function with .get-row()
.
method get-child-row ( UInt() $position --> N-Object )
$position; position of the child to get.
Return value; the child in $position
.
get-model
Gets the root model that $self
was created with.
method get-model (--> N-List )
Return value; the root model.
get-passthrough
Gets whether the model is passing through original row items.
If this function returns False
, the Gnome::Gio::R-ListModel functions for $self
return custom Gnome::Gtk4::TreeListRow objects. You need to call .get-item() in class Gnome::Gtk4::TreeListRow
on these objects to get the original item.
If True
, the values of the child models are passed through in their original state. You then need to call .get-row()
to get the custom Gnome::Gtk4::TreeListRows.
method get-passthrough (--> Bool )
Return value; True
if the model is passing through original row items.
get-row
Gets the row object for the given row.
If $position
is greater than the number of items in $self
, undefined is returned.
The row object can be used to expand and collapse rows as well as to inspect its position in the tree. See its documentation for details.
This row object is persistent and will refer to the current item as long as the row is present in $self
, independent of other rows being added or removed.
If $self
is set to not be passthrough, this function is equivalent to calling g_list_model_get_item().
Do not confuse this function with .get-child-row()
.
method get-row ( UInt() $position --> N-Object )
$position; the position of the row to fetch.
Return value; The row item.
set-autoexpand
Sets whether the model should autoexpand.
If set to True
, the model will recursively expand all rows that get added to the model. This can be either rows added by changes to the underlying models or via .set-expanded() in class Gnome::Gtk4::TreeListRow
.
method set-autoexpand ( Bool() $autoexpand )
$autoexpand;
True
to make the model autoexpand its rows.