Class TreeSortable

All Implemented Interfaces:
PointerInterface

public class TreeSortable extends Interface
The interface for sortable models used by GtkTreeView

`GtkTreeSortable` is an interface to be implemented by tree models which
support sorting. The `GtkTreeView` uses the methods provided by this interface
to sort the model.

https://docs.gtk.org/gtk4/iface.TreeSortable.html

  • Field Details

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getSortColumnId

      public boolean getSortColumnId(@Nonnull Int sort_column_id, @Nonnull Int order)
      Fills in @sort_column_id and @order with the current sort column and the
      order. It returns %TRUE unless the @sort_column_id is
      %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID or
      %GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID.
      Parameters:
      sort_column_id - The sort column id to be filled in
      order - The `GtkSortType` to be filled in
      Returns:
      %TRUE if the sort column is not one of the special sort column ids.
    • hasDefaultSortFunc

      public boolean hasDefaultSortFunc()
      Returns %TRUE if the model has a default sort function. This is used
      primarily by GtkTreeViewColumns in order to determine if a model can
      go back to the default state, or not.
      Returns:
      %TRUE, if the model has a default sort function
    • setDefaultSortFunc

      public void setDefaultSortFunc(TreeSortable.OnTreeIterCompareFunc sort_func, @Nullable Pointer user_data, TreeSortable.OnDestroyNotify destroy)
      Sets the default comparison function used when sorting to be @sort_func.
      If the current sort column id of @sortable is
      %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the model will sort using
      this function.

      If @sort_func is %NULL, then there will be no default comparison function.
      This means that once the model has been sorted, it can’t go back to the
      default state. In this case, when the current sort column id of @sortable
      is %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted.
      Parameters:
      sort_func - The comparison function
      user_data - User data to pass to @sort_func
      destroy - Destroy notifier of @user_data
    • setSortColumnId

      public void setSortColumnId(int sort_column_id, int order)
      Sets the current sort column to be @sort_column_id. The @sortable will
      resort itself to reflect this change, after emitting a
      `GtkTreeSortable::sort-column-changed` signal. @sort_column_id may either be
      a regular column id, or one of the following special values:

      - %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID: the default sort function
      will be used, if it is set

      - %GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID: no sorting will occur
      Parameters:
      sort_column_id - the sort column id to set
      order - The sort order of the column
    • setSortFunc

      public void setSortFunc(int sort_column_id, TreeSortable.OnTreeIterCompareFunc sort_func, @Nullable Pointer user_data, TreeSortable.OnDestroyNotify destroy)
      Sets the comparison function used when sorting to be @sort_func. If the
      current sort column id of @sortable is the same as @sort_column_id, then
      the model will sort using this function.
      Parameters:
      sort_column_id - the sort column id to set the function for
      sort_func - The comparison function
      user_data - User data to pass to @sort_func
      destroy - Destroy notifier of @user_data
    • sortColumnChanged

      public void sortColumnChanged()
      Emits a `GtkTreeSortable::sort-column-changed` signal on @sortable.
    • onSortColumnChanged

      public SignalHandler onSortColumnChanged(TreeSortable.OnSortColumnChanged signal)
      Connect to signal "sort-column-changed".
      See TreeSortable.OnSortColumnChanged.onSortColumnChanged() for signal description.
      Field SIGNAL_ON_SORT_COLUMN_CHANGED contains original signal name and can be used as resource reference.
      Parameters:
      signal - callback function (lambda).
      Returns:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • 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()