FilterListModelProtocol
public protocol FilterListModelProtocol : ListModelProtocol, ObjectProtocol
GtkFilterListModel is a list model that filters the elements of
the underlying model according to a GtkFilter.
It hides some elements from the other model according to
criteria given by a GtkFilter.
The model can be set up to do incremental searching, so that
filtering long lists doesn’t block the UI. See
[methodGtk.FilterListModel.set_incremental] for details.
The FilterListModelProtocol protocol exposes the methods and properties of an underlying GtkFilterListModel 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 FilterListModel.
Alternatively, use FilterListModelRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkFilterListModelinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
filter_list_model_ptrDefault implementationTyped pointer to the underlying
GtkFilterListModelinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkFilterListModelinstance.Declaration
Swift
var filter_list_model_ptr: UnsafeMutablePointer<GtkFilterListModel>! { get } -
Required Initialiser for types conforming to
FilterListModelProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
FilterListModelPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: FilterListModelPropertyName, 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 FilterListModel property
Declaration
Swift
@inlinable func get(property: FilterListModelPropertyName) -> 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 FilterListModel property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: FilterListModelPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
getFilter()Extension methodGets the
GtkFiltercurrently set onself.Declaration
Swift
@inlinable func getFilter() -> FilterRef! -
getIncremental()Extension methodReturns whether incremental filtering is enabled.
See [method
Gtk.FilterListModel.set_incremental].Declaration
Swift
@inlinable func getIncremental() -> Bool -
getModel()Extension methodGets the model currently filtered or
nilif none.Declaration
Swift
@inlinable func getModel() -> GIO.ListModelRef! -
getPending()Extension methodReturns the number of items that have not been filtered yet.
You can use this value to check if
selfis busy filtering by comparing the return value to 0 or you can compute the percentage of the filter remaining by dividing the return value by the total number of items in the underlying model:pending = gtk_filter_list_model_get_pending (self); model = gtk_filter_list_model_get_model (self); percentage = pending / (double) g_list_model_get_n_items (model);If no filter operation is ongoing - in particular when [property
Gtk.FilterListModel:incremental] isfalse- this function returns 0.Declaration
Swift
@inlinable func getPending() -> Int -
set(filter:Extension method) Sets the filter used to filter items.
Declaration
Swift
@inlinable func set(filter: FilterRef? = nil) -
set(filter:Extension method) Sets the filter used to filter items.
Declaration
Swift
@inlinable func set<FilterT>(filter: FilterT?) where FilterT : FilterProtocol -
set(incremental:Extension method) Sets the filter model to do an incremental sort.
When incremental filtering is enabled, the
GtkFilterListModelwill not run filters immediately, but will instead queue an idle handler that incrementally filters the items and adds them to the list. This of course means that items are not instantly added to the list, but only appear incrementally.When your filter blocks the UI while filtering, you might consider turning this on. Depending on your model and filters, this may become interesting around 10,000 to 100,000 items.
By default, incremental filtering is disabled.
See [method
Gtk.FilterListModel.get_pending] for progress information about an ongoing incremental filtering operation.Declaration
Swift
@inlinable func set(incremental: Bool) -
set(model:Extension method) Sets the model to be filtered.
Note that GTK makes no effort to ensure that
modelconforms to the item type ofself. It assumes that the caller knows what they are doing and have set up an appropriate filter to ensure that item types match.Declaration
Swift
@inlinable func set(model: GIO.ListModelRef? = nil) -
set(model:Extension method) Sets the model to be filtered.
Note that GTK makes no effort to ensure that
modelconforms to the item type ofself. It assumes that the caller knows what they are doing and have set up an appropriate filter to ensure that item types match.Declaration
Swift
@inlinable func set<ListModelT>(model: ListModelT?) where ListModelT : ListModelProtocol -
filterExtension methodThe filter for this model.
Declaration
Swift
@inlinable var filter: FilterRef! { get nonmutating set } -
incrementalExtension methodIf the model should filter items incrementally.
Declaration
Swift
@inlinable var incremental: Bool { get nonmutating set } -
modelExtension methodThe model being filtered.
Declaration
Swift
@inlinable var model: GIO.ListModelRef! { get nonmutating set } -
pendingExtension methodNumber of items not yet filtered.
Declaration
Swift
@inlinable var pending: Int { get }
View on GitHub
Install in Dash
FilterListModelProtocol Protocol Reference