class Gtk::TreeListRow

Overview

Gtk::TreeListRow is 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#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.

Defined in:

lib/gi-crystal/src/auto/gtk-4.0/tree_list_row.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class GObject::Object

bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding bind_property, bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding bind_property_full, data(key : String) : Pointer(Void)? data, finalize finalize, freeze_notify : Nil freeze_notify, getv(names : Enumerable(String), values : Enumerable(_)) : Nil getv, notify(property_name : String) : Nil notify, notify_by_pspec(pspec : GObject::ParamSpec) : Nil notify_by_pspec, notify_signal notify_signal, property(property_name : String, value : _) : Nil property, qdata(quark : UInt32) : Pointer(Void)? qdata, ref_count : UInt32 ref_count, run_dispose : Nil run_dispose, set_data(key : String, data : Pointer(Void)?) : Nil set_data, set_property(property_name : String, value : _) : Nil set_property, steal_data(key : String) : Pointer(Void)? steal_data, steal_qdata(quark : UInt32) : Pointer(Void)? steal_qdata, thaw_notify : Nil thaw_notify, to_unsafe : Pointer(Void) to_unsafe, watch_closure(closure : GObject::Closure) : Nil watch_closure

Constructor methods inherited from class GObject::Object

cast(obj : GObject::Object) : self cast, cast?(obj : GObject::Object) : self? cast?, new(pointer : Pointer(Void), transfer : GICrystal::Transfer)
new
new
, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv

Class methods inherited from class GObject::Object

compat_control(what : UInt64, data : Pointer(Void)?) : UInt64 compat_control, g_type : UInt64 g_type, interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec interface_find_property, interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec) interface_list_properties

Constructor Detail

def self.new #

Initialize a new TreeListRow.


def self.new(*, children : Gio::ListModel? = nil, depth : UInt32? = nil, expandable : Bool? = nil, expanded : Bool? = nil, item : GObject::Object? = nil) #

Class Method Detail

def self.g_type : UInt64 #

Returns the type id (GType) registered in GLib type system.


Instance Method Detail

def child_row(position : UInt32) : Gtk::TreeListRow? #

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


def children : Gio::ListModel? #

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

This model is the model created by the Gtk::TreeListModelCreateModelFunc and contains the original items, no matter what value Gtk::TreeListModel#passthrough is set to.


def depth : UInt32 #

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 destroyed.


def expandable? : Bool #

def expanded : Bool #

Gets if a row is currently expanded.


def expanded=(expanded : Bool) : Nil #

Expands or collapses a row.

If a row is expanded, the model of calling the 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.


def expanded? : Bool #

def is_expandable : Bool #

Checks if a row can be expanded.

This does not mean that the row is actually expanded, this can be checked with Gtk::TreeListRow#expanded.

If a row is expandable never changes until the row is destroyed.


def item : GObject::Object? #

Gets the item corresponding to this row,

The value returned by this function never changes until the row is destroyed.


def parent : Gtk::TreeListRow? #

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, nil is returned.

The value returned by this function never changes until the row is destroyed.


def position : UInt32 #

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