Class TreeListModel

All Implemented Interfaces:
PointerInterface

public class TreeListModel extends Object
`GtkTreeListModel` is a list model that can create child models on demand.

https://docs.gtk.org/gtk4/class.TreeListModel.html

  • Constructor Details

    • TreeListModel

      public TreeListModel(PointerContainer pointer)
    • TreeListModel

      public TreeListModel(@Nonnull ListModel root, boolean passthrough, boolean autoexpand, TreeListModel.OnTreeListModelCreateModelFunc create_func, @Nullable Pointer user_data, TreeListModel.OnDestroyNotify user_destroy)
      Creates a new empty `GtkTreeListModel` displaying @root
      with all rows collapsed.
      Parameters:
      root - The `GListModel` 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 `GListModel` for the children of an item
      user_data - Data to pass to @create_func
      user_destroy - Function to call to free @user_data
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getAutoexpand

      public boolean getAutoexpand()
      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 [method@Gtk.TreeListRow.set_expanded].
      Returns:
      %TRUE if the model is set to autoexpand
    • getChildRow

      public TreeListRow getChildRow(int position)
      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,
      %NULL is returned.

      Do not confuse this function with [method@Gtk.TreeListModel.get_row].
      Parameters:
      position - position of the child to get
      Returns:
      the child in @position
    • getModel

      public ListModel getModel()
      Gets the root model that @self was created with.
      Returns:
      the root model
    • getPassthrough

      public boolean getPassthrough()
      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
      [method@Gtk.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 [method@Gtk.TreeListModel.get_row]
      to get the custom `GtkTreeListRow`s.
      Returns:
      %TRUE if the model is passing through original row items
    • getRow

      public TreeListRow getRow(int position)
      Gets the row object for the given row.

      If @position is greater than the number of items in @self,
      %NULL 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 [method@Gtk.TreeListModel.get_child_row].
      Parameters:
      position - the position of the row to fetch
      Returns:
      The row item
    • setAutoexpand

      public void setAutoexpand(boolean 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 [method@Gtk.TreeListRow.set_expanded].
      Parameters:
      autoexpand - %TRUE to make the model autoexpand its rows
    • asListModel

      public ListModel asListModel()
      Implements interface ListModel. Call this to get access to interface functions.
      Returns:
      ListModel
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()