Class: Gtk::TreeListModel

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Constructor Details

#initialize(root, passthrough, autoexpand, create_func, user_data, user_destroy) ⇒ Gtk::TreeListModel

Creates a new empty GtkTreeListModel displaying root with all rows collapsed.

Parameters:

  • root (Gio::ListModel)

    The GListModel to use as root

  • passthrough (Boolean)

    true to pass through items from the models

  • autoexpand (Boolean)

    true to set the autoexpand property and expand the root model

  • create_func (Gtk::TreeListModelCreateModelFunc)

    Function to call to create the GListModel for the children of an item

  • user_data (GObject)

    Data to pass to create_func

  • user_destroy (GLib::DestroyNotify)

    Function to call to free user_data

Instance Method Details

#autoexpandBoolean

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 [methodGtk.TreeListRow.set_expanded].

Returns:

  • (Boolean)

    true if the model is set to autoexpand

#autoexpand=(autoexpand) ⇒ Boolean

If all rows should be expanded by default.

Parameters:

  • autoexpand (Boolean)

Returns:

  • (Boolean)

    autoexpand

  • (Boolean)

    autoexpand

#autoexpand?Boolean

If all rows should be expanded by default.

Returns:

  • (Boolean)

    autoexpand

#get_child_row(position) ⇒ Gtk::TreeListRow

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

Do not confuse this function with [methodGtk.TreeListModel.get_row].

Parameters:

  • position (Integer)

    position of the child to get

Returns:

#get_row(position) ⇒ Gtk::TreeListRow

Gets the row object for the given row.

If position is greater than the number of items in self, nil 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 [methodGtk.TreeListModel.get_child_row].

Parameters:

  • position (Integer)

    the position of the row to fetch

Returns:

#item_typeGLib::Type

The type of items. See [methodGio.ListModel.get_item_type].

Returns:

  • (GLib::Type)

    item-type

#item_type=(item_type) ⇒ GLib::Type

The type of items. See [methodGio.ListModel.get_item_type].

Parameters:

  • item_type (GLib::Type)

Returns:

  • (GLib::Type)

    item-type

  • (GLib::Type)

    item-type

#modelGio::ListModel

The root model displayed.

Returns:

  • (Gio::ListModel)

    model

#model=(model) ⇒ Gio::ListModel

The root model displayed.

Parameters:

  • model (Gio::ListModel)

Returns:

  • (Gio::ListModel)

    model

  • (Gio::ListModel)

    model

#n_itemsInteger

The number of items. See [methodGio.ListModel.get_n_items].

Returns:

  • (Integer)

    n-items

#n_items=(n_items) ⇒ Integer

The number of items. See [methodGio.ListModel.get_n_items].

Parameters:

  • n_items (Integer)

Returns:

  • (Integer)

    n-items

  • (Integer)

    n-items

#passthroughBoolean

Gets whether the model is passing through original row items.

If this function returns false, the GListModel functions for self return custom GtkTreeListRow objects. You need to call [methodGtk.TreeListRow.get_item] 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 [methodGtk.TreeListModel.get_row] to get the custom GtkTreeListRows.

Returns:

  • (Boolean)

    true if the model is passing through original row items

#passthrough=(passthrough) ⇒ Boolean

Gets whether the model is in passthrough mode.

If false, the GListModel functions for this object return custom [classGtk.TreeListRow] objects. If true, the values of the child models are pass through unmodified.

Parameters:

  • passthrough (Boolean)

Returns:

  • (Boolean)

    passthrough

  • (Boolean)

    passthrough

#passthrough?Boolean

Gets whether the model is in passthrough mode.

If false, the GListModel functions for this object return custom [classGtk.TreeListRow] objects. If true, the values of the child models are pass through unmodified.

Returns:

  • (Boolean)

    passthrough