Package ch.bailu.gtk.gtk
Class Sorter
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gtk.Sorter
- All Implemented Interfaces:
PointerInterface
- Direct Known Subclasses:
CustomSorter
,MultiSorter
,NumericSorter
,StringSorter
,TreeListRowSorter
`GtkSorter` is an object to describe sorting criteria.
Its primary user is [class@Gtk.SortListModel]
The model will use a sorter to determine the order in which
its items should appear by calling [method@Gtk.Sorter.compare]
for pairs of items.
Sorters may change their sorting behavior through their lifetime.
In that case, they will emit the [signal@Gtk.Sorter::changed] signal
to notify that the sort order is no longer valid and should be updated
by calling gtk_sorter_compare() again.
GTK provides various pre-made sorter implementations for common sorting
operations. [class@Gtk.ColumnView] has built-in support for sorting lists
via the [property@Gtk.ColumnViewColumn:sorter] property, where the user can
change the sorting by clicking on list headers.
Of course, in particular for large lists, it is also possible to subclass
`GtkSorter` and provide one's own sorter.
Its primary user is [class@Gtk.SortListModel]
The model will use a sorter to determine the order in which
its items should appear by calling [method@Gtk.Sorter.compare]
for pairs of items.
Sorters may change their sorting behavior through their lifetime.
In that case, they will emit the [signal@Gtk.Sorter::changed] signal
to notify that the sort order is no longer valid and should be updated
by calling gtk_sorter_compare() again.
GTK provides various pre-made sorter implementations for common sorting
operations. [class@Gtk.ColumnView] has built-in support for sorting lists
via the [property@Gtk.ColumnViewColumn:sorter] property, where the user can
change the sorting by clicking on list headers.
Of course, in particular for large lists, it is also possible to subclass
`GtkSorter` and provide one's own sorter.
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
changed
(int change) Notifies all users of the sorter that it has changed.int
Compares two given items according to the sort order implemented
by the sorter.static ClassHandler
static int
int
getOrder()
Gets the order that @self conforms to.static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
onChanged
(Sorter.OnChanged signal) Connect to signal "changed".Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
SIGNAL_ON_CHANGED
- See Also:
-
-
Constructor Details
-
Sorter
-
-
Method Details
-
getClassHandler
-
changed
public void changed(int change) Notifies all users of the sorter that it has changed.
This emits the [signal@Gtk.Sorter::changed] signal. Users
of the sorter should then update the sort order via
[method@Gtk.Sorter.compare].
Depending on the @change parameter, it may be possible to
update the sort order without a full resorting. Refer to
the [enum@Gtk.SorterChange] documentation for details.
This function is intended for implementors of `GtkSorter`
subclasses and should not be called from other functions.- Parameters:
change
- How the sorter changed
-
compare
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 [method@Gtk.Sorter.get_order].- Parameters:
item1
- first item to compareitem2
- second item to compare- Returns:
- %GTK_ORDERING_EQUAL if @item1 == @item2, %GTK_ORDERING_SMALLER if @item1 < @item2, %GTK_ORDERING_LARGER if @item1 > @item2
-
getOrder
public int getOrder()Gets the order that @self conforms to.
See [enum@Gtk.SorterOrder] for details
of the possible return values.
This function is intended to allow optimizations.- Returns:
- The order
-
onChanged
Connect to signal "changed".
SeeSorter.OnChanged.onChanged(int)
for signal description.
FieldSIGNAL_ON_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
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-