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
GtkFilterListModel
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
filter_list_model_ptr
Default implementationTyped pointer to the underlying
GtkFilterListModel
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkFilterListModel
instance.Declaration
Swift
var filter_list_model_ptr: UnsafeMutablePointer<GtkFilterListModel>! { get }
-
Required Initialiser for types conforming to
FilterListModelProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
FilterListModelPropertyName
source 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 : ObjectProtocol
Parameters
source_property
the source property to bind
target
the target object to bind to
target_property
the target property to bind to
flags
the flags to pass to the
Binding
transform_from
ValueTransformer
to use for forward transformationtransform_to
ValueTransformer
to use for backwards transformationReturn Value
binding reference or
nil
in case of an error -
get(property:
Extension method) Get the value of a FilterListModel property
Declaration
Swift
@inlinable func get(property: FilterListModelPropertyName) -> GLibObject.Value
Parameters
property
the 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
property
the property to get the value for
Return Value
the value of the named property
-
getFilter()
Extension methodGets the
GtkFilter
currently 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
nil
if 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
self
is 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
GtkFilterListModel
will 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
model
conforms 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
model
conforms 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
-
filter
Extension methodThe filter for this model.
Declaration
Swift
@inlinable var filter: FilterRef! { get nonmutating set }
-
incremental
Extension methodIf the model should filter items incrementally.
Declaration
Swift
@inlinable var incremental: Bool { get nonmutating set }
-
model
Extension methodThe model being filtered.
Declaration
Swift
@inlinable var model: GIO.ListModelRef! { get nonmutating set }
-
pending
Extension methodNumber of items not yet filtered.
Declaration
Swift
@inlinable var pending: Int { get }