Class: Gtk::Sorter

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

Overview

The virtual table for GtkSorter.

Instance Method Summary collapse

Instance Method Details

#changed(change) ⇒ nil

Notifies all users of the sorter that it has changed.

This emits the [signalGtk.Sorter::changed] signal. Users of the sorter should then update the sort order via [methodGtk.Sorter.compare].

Depending on the change parameter, it may be possible to update the sort order without a full resorting. Refer to the [enumGtk.SorterChange] documentation for details.

This function is intended for implementers of GtkSorter subclasses and should not be called from other functions.

Parameters:

Returns:

  • (nil)

#compare(item1, item2) ⇒ Gtk::Ordering

Compares two given items according to the sort order implemented by the sorter.

Sorters implement a partial order:

  • It is reflexive, ie a = a
  • It is antisymmetric, ie if a < b and b < a, then a = b
  • It is transitive, ie given any 3 items with a ≤ b and b ≤ c, then a ≤ c

The sorter may signal it conforms to additional constraints via the return value of [methodGtk.Sorter.get_order].

Parameters:

  • item1 (GObject::Object)

    first item to compare

  • item2 (GObject::Object)

    second item to compare

Returns:

  • (Gtk::Ordering)

    %GTK_ORDERING_EQUAL if item1 == item2, %GTK_ORDERING_SMALLER if item1 < item2, %GTK_ORDERING_LARGER if item1 > item2

#orderGtk::SorterOrder

Gets the order that self conforms to.

See [enumGtk.SorterOrder] for details of the possible return values.

This function is intended to allow optimizations.

Returns: