Class ColumnViewSorter

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class ColumnViewSorter extends Sorter

Sorts ColumnView columns.

The sorter returned by ColumnView.getSorter() is a GtkColumnViewSorter.

In column views, sorting can be configured by associating sorters with columns, and users can invert sort order by clicking on column headers. The API of GtkColumnViewSorter is designed to allow saving and restoring this configuration.

If you are only interested in the primary sort column (i.e. the column where a sort indicator is shown in the header), then you can just look at Gtk.ColumnViewSorter:primary-sort-column and Gtk.ColumnViewSorter:primary-sort-order.

If you want to store the full sort configuration, including secondary sort columns that are used for tie breaking, then you can use getNthSortColumn(int, Out). To get notified about changes, use Gtk.Sorter::changed.

To restore a saved sort configuration on a GtkColumnView, use code like:

sorter = gtk_column_view_get_sorter (view);
for (i = gtk_column_view_sorter_get_n_sort_columns (sorter) - 1; i >= 0; i--)
  {
    column = gtk_column_view_sorter_get_nth_sort_column (sorter, i, &order);
    gtk_column_view_sort_by_column (view, column, order);
  }
Since:
4.10
  • Constructor Details

    • ColumnViewSorter

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

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

    • getType

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

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

      protected ColumnViewSorter 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 Sorter
      Returns:
      the instance as if it were its parent type
    • getNSortColumns

      public int getNSortColumns()

      Returns the number of columns by which the sorter sorts.

      If the sorter of the primary sort column does not determine a total order, then the secondary sorters are consulted to break the ties.

      Use the Gtk.Sorter::changed signal to get notified when the number of sort columns changes.

      Returns:
      the number of sort columns
      Since:
      4.10
    • getNthSortColumn

      public @Nullable ColumnViewColumn getNthSortColumn(int position, Out<SortType> sortOrder)

      Gets the position'th sort column and its associated sort order.

      Use the Gtk.Sorter::changed signal to get notified when sort columns change.

      Parameters:
      position - the position of the sort column to retrieve (0 for the primary sort column)
      sortOrder - return location for the sort order
      Returns:
      the sort column at the position
      Since:
      4.10
    • getPrimarySortColumn

      public @Nullable ColumnViewColumn getPrimarySortColumn()

      Returns the primary sort column.

      The primary sort column is the one that displays the triangle in a column view header.

      Returns:
      the primary sort column
      Since:
      4.10
    • getPrimarySortOrder

      public SortType getPrimarySortOrder()

      Returns the primary sort order.

      The primary sort order determines whether the triangle displayed in the column view header of the primary sort column points upwards or downwards.

      If there is no primary sort column, then this function returns GTK_SORT_ASCENDING.

      Returns:
      the primary sort order
      Since:
      4.10
    • builder

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