Gnome::Gtk4::Filter
Description
A Gnome::Gtk4::Filter object describes the filtering to be performed by a Gnome::Gtk4::FilterListModel.
The model will use the filter to determine if it should include items or not by calling .match()
for each item and only keeping the ones that the function returns True
for.
Filters may change what items they match through their lifetime. In that case, they will emit the changed signal to notify that previous filter results are no longer valid and that items should be checked again via .match()
.
GTK provides various pre-made filter implementations for common filtering operations. These filters often include properties that can be linked to various widgets to easily allow searches.
However, in particular for large lists or complex search methods, it is also possible to subclass Gnome::Gtk4::Filter and provide one's own filter.
Class initialization
new
:native-object
Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.
multi method new ( N-Object :$native-object! )
Methods
changed
Notifies all users of the filter that it has changed.
This emits the changed signal. Users of the filter should then check items again via .match()
.
Depending on the $change
parameter, not all items need to be changed, but only some. Refer to the enumeration FilterChange from Gnome::Gtk4::T-filter
documentation for details.
This function is intended for implementers of Gnome::Gtk4::Filter subclasses and should not be called from other functions.
method changed ( GtkFilterChange $change )
$change; How the filter changed.
get-strictness
Gets the known strictness of $filters
.
If the strictness is not known, GTK_FILTER_MATCH_SOME
is returned.
This value may change after emission of the changed signal.
This function is meant purely for optimization purposes, filters can choose to omit implementing it, but Gnome::Gtk4::FilterListModel uses it.
method get-strictness (--> GtkFilterMatch )
Return value; the strictness of $self
.
match
Checks if the given $item
is matched by the filter or not.
method match ( gpointer $item --> Bool )
$item; The item to check.
Return value; True
if the filter matches the item and a filter model should keep it, False
if not..
Signals
changed
Emitted whenever the filter changed.
Users of the filter should then check items again via .match()
.
Gnome::Gtk4::FilterListModel handles this signal automatically.
Depending on the $change
parameter, not all items need to be checked, but only some. Refer to the enumeration FilterChange from Gnome::Gtk4::T-filter
documentation for details.
method handler ( $change, Int :$_handle_id, N-GObject :$_native-object, Gnome::Gtk4::Filter :$_widget, *C<user>-options )
$change; how the filter changed.
$_handle_id; The registered event handler id.
$_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::Filter object.
$_widget; The object which registered the signal. User code may have left the object going out of scope.
user
-options; A list of named arguments provided at the.register-signal()
method from Gnome::GObject::Object.