| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte | 
|---|---|
| License | LGPL-2.1 | 
| Maintainer | Iñaki García Etxebarria | 
| Safe Haskell | Safe-Inferred | 
| Language | Haskell2010 | 
GI.Gtk.Objects.Filter
Description
A Filter 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 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 Filter 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 C_FilterChangedCallback = Ptr () -> CUInt -> Ptr () -> IO ()
- type FilterChangedCallback = FilterChange -> IO ()
- afterFilterChanged :: (IsFilter a, MonadIO m) => a -> FilterChangedCallback -> m SignalHandlerId
- genClosure_FilterChanged :: MonadIO m => FilterChangedCallback -> m (GClosure C_FilterChangedCallback)
- mk_FilterChangedCallback :: C_FilterChangedCallback -> IO (FunPtr C_FilterChangedCallback)
- noFilterChangedCallback :: Maybe FilterChangedCallback
- onFilterChanged :: (IsFilter a, MonadIO m) => a -> FilterChangedCallback -> m SignalHandlerId
- wrap_FilterChangedCallback :: FilterChangedCallback -> C_FilterChangedCallback
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 Methods 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 Methods 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 | |
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
Arguments
| :: (HasCallStack, MonadIO m, IsFilter a) | |
| => a | 
 | 
| -> FilterChange | 
 | 
| -> m () | 
Emits the changed signal to notify all users of the filter that
 the filter changed. 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 Filter subclasses and
 should not be called from other functions.
getStrictness
Arguments
| :: (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 changed signal.
This function is meant purely for optimization purposes, filters can
 choose to omit implementing it, but FilterListModel uses it.
match
Arguments
| :: (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 C_FilterChangedCallback = Ptr () -> CUInt -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type FilterChangedCallback Source #
Arguments
| = FilterChange | 
 | 
| -> IO () | 
This signal is emitted whenever the filter changed. Users of the filter
 should then check items again via filterMatch.
FilterListModel handles this signal automatically.
Depending on the change parameter, not all items need to be changed, but
 only some. Refer to the FilterChange documentation for details.
afterFilterChanged :: (IsFilter a, MonadIO m) => 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
genClosure_FilterChanged :: MonadIO m => FilterChangedCallback -> m (GClosure C_FilterChangedCallback) Source #
Wrap the callback into a GClosure.
mk_FilterChangedCallback :: C_FilterChangedCallback -> IO (FunPtr C_FilterChangedCallback) Source #
Generate a function pointer callable from C code, from a C_FilterChangedCallback.
noFilterChangedCallback :: Maybe FilterChangedCallback Source #
A convenience synonym for Nothing :: Maybe FilterChangedCallback
onFilterChanged :: (IsFilter a, MonadIO m) => 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