Class TreeListRow

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class TreeListRow extends GObject

The type of item used by GtkTreeListModel.

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

GtkTreeListRow instances are created by a GtkTreeListModel only when the Gtk.TreeListModel:passthrough property is not set.

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

  • Constructor Details

    • TreeListRow

      public TreeListRow(MemorySegment address)
      Create a TreeListRow instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • TreeListRow

      public TreeListRow()
      Create a new TreeListRow.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the TreeListRow class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected TreeListRow asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • getChildRow

      public @Nullable TreeListRow getChildRow(int position)
      If this TreeListRow is not expanded or position is greater than the number of children, null is returned.
      Parameters:
      position - position of the child to get
      Returns:
      the child in position
    • getChildren

      public @Nullable ListModel getChildren()

      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.

      Returns:
      The model containing the children
    • getDepth

      public int getDepth()

      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.

      Returns:
      The depth of this row
    • getExpanded

      public boolean getExpanded()
      Gets if a row is currently expanded.
      Returns:
      true if the row is expanded
    • getItem

      public @Nullable GObject getItem()
      Gets the item corresponding to this row,
      Returns:
      The item of this row. This function is only marked as nullable for backwards compatibility reasons.
    • getParent

      public @Nullable TreeListRow getParent()

      Gets the row representing the parent for self.

      That is the row that would need to be collapsed to make this row disappear.

      If this TreeListRow is a row corresponding to the root model, null 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 null.

      Returns:
      The parent of this TreeListRow
    • getPosition

      public int getPosition()
      Returns the position in the GtkTreeListModel that this TreeListRow occupies at the moment.
      Returns:
      The position in the model
    • isExpandable

      public boolean isExpandable()

      Checks if a row can be expanded.

      This does not mean that the row is actually expanded, this can be checked with getExpanded().

      If a row is expandable never changes until the row is removed from its model at which point it will forever return false.

      Returns:
      true if the row is expandable
    • setExpanded

      public void setExpanded(boolean expanded)

      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.

      Parameters:
      expanded - true if the row should be expanded
    • builder

      public static TreeListRow.Builder<? extends TreeListRow.Builder> builder()
      A TreeListRow.Builder object constructs a TreeListRow with the specified properties. Use the various set...() methods to set properties, and finish construction with TreeListRow.Builder.build().
      Returns:
      the builder object