Class Filter
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
BoolFilter
,CustomFilter
,FileFilter
,MultiFilter
,StringFilter
GtkFilter
object describes the filtering to be performed by a
FilterListModel
.
The model will use the filter to determine if it should include items
or not by calling match(org.gnome.gobject.GObject)
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 Gtk.Filter::changed
signal to notify
that previous filter results are no longer valid and that items should
be checked again via match(org.gnome.gobject.GObject)
.
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 GtkFilter
and provide one's own filter.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Filter.Builder<B extends Filter.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theChangedCallback
callback.static class
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionFilter
(MemorySegment address) Create a Filter proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected Filter
asParent()
Returns this instance as if it were its parent type.static Filter.Builder
<? extends Filter.Builder> builder()
AFilter.Builder
object constructs aFilter
with the specified properties.void
changed
(FilterChange change) Notifies all users of the filter that it has changed.void
emitChanged
(FilterChange change) Emits the "changed" signal.static MemoryLayout
The memory layout of the native struct.Gets the known strictness offilters
.static Type
getType()
Get the GType of the Filter classboolean
Checks if the givenitem
is matched by the filter or not.onChanged
(Filter.ChangedCallback handler) Emitted whenever the filter changed.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
changed
Notifies all users of the filter that it has changed.This emits the
Gtk.Filter::changed
signal. Users of the filter should then check items again viamatch(org.gnome.gobject.GObject)
.Depending on the
change
parameter, not all items need to be changed, but only some. Refer to theGtk.FilterChange
documentation for details.This function is intended for implementers of
GtkFilter
subclasses and should not be called from other functions.- Parameters:
change
- How the filter changed
-
getStrictness
Gets the known strictness offilters
.If the strictness is not known,
FilterMatch.SOME
is returned.This value may change after emission of the
Gtk.Filter::changed
signal.This function is meant purely for optimization purposes, filters can choose to omit implementing it, but
GtkFilterListModel
uses it.- Returns:
- the strictness of this Filter
-
match
Checks if the givenitem
is matched by the filter or not.- Parameters:
item
- The item to check- Returns:
true
if the filter matches the item and a filter model should keep it,false
if not.
-
onChanged
Emitted whenever the filter changed.Users of the filter should then check items again via
match(org.gnome.gobject.GObject)
.GtkFilterListModel
handles this signal automatically.Depending on the
change
parameter, not all items need to be checked, but only some. Refer to theGtk.FilterChange
documentation for details.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitChanged
Emits the "changed" signal. SeeonChanged(org.gnome.gtk.Filter.ChangedCallback)
. -
builder
AFilter.Builder
object constructs aFilter
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withFilter.Builder.build()
.
-