SortListModelProtocol
public protocol SortListModelProtocol : ListModelProtocol, ObjectProtocol
A GListModel that sorts the elements of an underlying model
according to a GtkSorter.
The model can be set up to do incremental sorting, so that
sorting long lists doesn’t block the UI. See
[methodGtk.SortListModel.set_incremental] for details.
GtkSortListModel is a generic model and because of that it
cannot take advantage of any external knowledge when sorting.
If you run into performance issues with GtkSortListModel,
it is strongly recommended that you write your own sorting list
model.
The SortListModelProtocol protocol exposes the methods and properties of an underlying GtkSortListModel instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see SortListModel.
Alternatively, use SortListModelRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkSortListModelinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
sort_list_model_ptrDefault implementationTyped pointer to the underlying
GtkSortListModelinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkSortListModelinstance.Declaration
Swift
var sort_list_model_ptr: UnsafeMutablePointer<GtkSortListModel>! { get } -
Required Initialiser for types conforming to
SortListModelProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
SortListModelPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: SortListModelPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocolParameters
source_propertythe source property to bind
targetthe target object to bind to
target_propertythe target property to bind to
flagsthe flags to pass to the
Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Value
binding reference or
nilin case of an error -
get(property:Extension method) Get the value of a SortListModel property
Declaration
Swift
@inlinable func get(property: SortListModelPropertyName) -> GLibObject.ValueParameters
propertythe property to get the value for
Return Value
the value of the named property
-
set(property:Extension methodvalue: ) Set the value of a SortListModel property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: SortListModelPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
getIncremental()Extension methodReturns whether incremental sorting is enabled.
See [method
Gtk.SortListModel.set_incremental].Declaration
Swift
@inlinable func getIncremental() -> Bool -
getModel()Extension methodGets the model currently sorted or
nilif none.Declaration
Swift
@inlinable func getModel() -> GIO.ListModelRef! -
getPending()Extension methodEstimates progress of an ongoing sorting operation.
The estimate is the number of items that would still need to be sorted to finish the sorting operation if this was a linear algorithm. So this number is not related to how many items are already correctly sorted.
If you want to estimate the progress, you can use code like this:
pending = gtk_sort_list_model_get_pending (self); model = gtk_sort_list_model_get_model (self); progress = 1.0 - pending / (double) MAX (1, g_list_model_get_n_items (model));If no sort operation is ongoing - in particular when [property
Gtk.SortListModel:incremental] isfalse- this function returns 0.Declaration
Swift
@inlinable func getPending() -> Int -
getSorter()Extension methodGets the sorter that is used to sort
self.Declaration
Swift
@inlinable func getSorter() -> SorterRef! -
set(incremental:Extension method) Sets the sort model to do an incremental sort.
When incremental sorting is enabled, the
GtkSortListModelwill not do a complete sort immediately, but will instead queue an idle handler that incrementally sorts the items towards their correct position. This of course means that items do not instantly appear in the right place. It also means that the total sorting time is a lot slower.When your filter blocks the UI while sorting, you might consider turning this on. Depending on your model and sorters, this may become interesting around 10,000 to 100,000 items.
By default, incremental sorting is disabled.
See [method
Gtk.SortListModel.get_pending] for progress information about an ongoing incremental sorting operation.Declaration
Swift
@inlinable func set(incremental: Bool) -
set(model:Extension method) Sets the model to be sorted.
The
model‘s item type must conform to the item type ofself.Declaration
Swift
@inlinable func set(model: GIO.ListModelRef? = nil) -
set(model:Extension method) Sets the model to be sorted.
The
model‘s item type must conform to the item type ofself.Declaration
Swift
@inlinable func set<ListModelT>(model: ListModelT?) where ListModelT : ListModelProtocol -
set(sorter:Extension method) Sets a new sorter on
self.Declaration
Swift
@inlinable func set(sorter: SorterRef? = nil) -
set(sorter:Extension method) Sets a new sorter on
self.Declaration
Swift
@inlinable func set<SorterT>(sorter: SorterT?) where SorterT : SorterProtocol -
incrementalExtension methodIf the model should sort items incrementally.
Declaration
Swift
@inlinable var incremental: Bool { get nonmutating set } -
modelExtension methodThe model being sorted.
Declaration
Swift
@inlinable var model: GIO.ListModelRef! { get nonmutating set } -
pendingExtension methodEstimate of unsorted items remaining.
Declaration
Swift
@inlinable var pending: Int { get } -
sorterExtension methodThe sorter for this model.
Declaration
Swift
@inlinable var sorter: SorterRef! { get nonmutating set }
View on GitHub
Install in Dash
SortListModelProtocol Protocol Reference