gi-gtk-4.0.4: Gtk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Exported types

newtype Filter Source #

Memory-managed wrapper type.

Constructors

Filter (ManagedPtr Filter) 

Instances

Instances details
Eq Filter Source # 
Instance details

Defined in GI.Gtk.Objects.Filter

Methods

(==) :: Filter -> Filter -> Bool #

(/=) :: Filter -> Filter -> Bool #

GObject Filter Source # 
Instance details

Defined in GI.Gtk.Objects.Filter

ManagedPtrNewtype Filter Source # 
Instance details

Defined in GI.Gtk.Objects.Filter

Methods

toManagedPtr :: Filter -> ManagedPtr Filter

TypedObject Filter Source # 
Instance details

Defined in GI.Gtk.Objects.Filter

Methods

glibType :: IO GType

HasParentTypes Filter Source # 
Instance details

Defined in GI.Gtk.Objects.Filter

IsGValue (Maybe Filter) Source #

Convert Filter to and from GValue. See toGValue and fromGValue.

Instance details

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 # 
Instance details

Defined in GI.Gtk.Objects.Filter

type ParentTypes Filter = '[Object]

class (GObject o, IsDescendantOf Filter o) => IsFilter o Source #

Type class for types which can be safely cast to Filter, for instance with toFilter.

Instances

Instances details
(GObject o, IsDescendantOf Filter o) => IsFilter o Source # 
Instance details

Defined in GI.Gtk.Objects.Filter

toFilter :: (MonadIO m, IsFilter o) => o -> m Filter Source #

Cast to Filter, for types for which this is known to be safe. For general casts, use castTo.

Methods

changed

filterChanged Source #

Arguments

:: (HasCallStack, MonadIO m, IsFilter a) 
=> a

self: a Filter

-> FilterChange

change: How the filter changed

-> 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

filterGetStrictness Source #

Arguments

:: (HasCallStack, MonadIO m, IsFilter a) 
=> a

self: a Filter

-> m FilterMatch

Returns: the strictness of self

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

filterMatch Source #

Arguments

:: (HasCallStack, MonadIO m, IsFilter a, IsObject b) 
=> a

self: a Filter

-> b

item: The item to check

-> m Bool

Returns: True if the filter matches the item and a filter model should keep it, False if not.

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

change: how the filter changed

-> 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.

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