Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
A 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 filterMatch
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 Filter::changed signal to notify
that previous filter results are no longer valid and that items should
be checked again via filterMatch
.
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.
Synopsis
- newtype Filter = Filter (ManagedPtr Filter)
- class (GObject o, IsDescendantOf Filter o) => IsFilter o
- toFilter :: (MonadIO m, IsFilter o) => o -> m Filter
- filterChanged :: (HasCallStack, MonadIO m, IsFilter a) => a -> FilterChange -> m ()
- filterGetStrictness :: (HasCallStack, MonadIO m, IsFilter a) => a -> m FilterMatch
- filterMatch :: (HasCallStack, MonadIO m, IsFilter a, IsObject b) => a -> b -> m Bool
- type FilterChangedCallback = FilterChange -> IO ()
- afterFilterChanged :: (IsFilter a, MonadIO m) => a -> ((?self :: a) => FilterChangedCallback) -> m SignalHandlerId
- onFilterChanged :: (IsFilter a, MonadIO m) => a -> ((?self :: a) => FilterChangedCallback) -> m SignalHandlerId
Exported types
Memory-managed wrapper type.
Instances
Eq Filter Source # | |
GObject Filter Source # | |
Defined in GI.Gtk.Objects.Filter | |
ManagedPtrNewtype Filter Source # | |
Defined in GI.Gtk.Objects.Filter toManagedPtr :: Filter -> ManagedPtr Filter | |
TypedObject Filter Source # | |
Defined in GI.Gtk.Objects.Filter | |
HasParentTypes Filter Source # | |
Defined in GI.Gtk.Objects.Filter | |
IsGValue (Maybe Filter) Source # | Convert |
Defined in GI.Gtk.Objects.Filter gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Filter -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Filter) | |
type ParentTypes Filter Source # | |
Defined in GI.Gtk.Objects.Filter type ParentTypes Filter = '[Object] |
class (GObject o, IsDescendantOf Filter o) => IsFilter o Source #
Instances
(GObject o, IsDescendantOf Filter o) => IsFilter o Source # | |
Defined in GI.Gtk.Objects.Filter |
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, changed, forceFloating, freezeNotify, getv, isFloating, match, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getProperty, getQdata, getStrictness.
Setters
changed
:: (HasCallStack, MonadIO m, IsFilter a) | |
=> a |
|
-> FilterChange |
|
-> m () |
Notifies all users of the filter that it has changed.
This emits the Filter::changed signal. Users
of the filter should then check items again via
filterMatch
.
Depending on the change
parameter, not all items need to
be changed, but only some. Refer to the FilterChange
documentation for details.
This function is intended for implementors of GtkFilter
subclasses and should not be called from other functions.
getStrictness
:: (HasCallStack, MonadIO m, IsFilter a) | |
=> a |
|
-> m FilterMatch | Returns: the strictness of |
Gets the known strictness of filters
.
If the strictness is not known, FilterMatchSome
is returned.
This value may change after emission of the Filter::changed signal.
This function is meant purely for optimization purposes, filters can
choose to omit implementing it, but GtkFilterListModel
uses it.
match
:: (HasCallStack, MonadIO m, IsFilter a, IsObject b) | |
=> a |
|
-> b |
|
-> m Bool | Returns: |
Checks if the given item
is matched by the filter or not.
Signals
changed
type FilterChangedCallback Source #
= FilterChange |
|
-> IO () |
Emitted whenever the filter changed.
Users of the filter should then check items again via
filterMatch
.
GtkFilterListModel
handles this signal automatically.
Depending on the change
parameter, not all items need
to be checked, but only some. Refer to the FilterChange
documentation for details.
afterFilterChanged :: (IsFilter a, MonadIO m) => a -> ((?self :: a) => FilterChangedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the changed signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
filter #changed callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onFilterChanged :: (IsFilter a, MonadIO m) => a -> ((?self :: a) => FilterChangedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the changed signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
filter #changed callback