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

GI.Gtk.Objects.FilterListModel

Description

GtkFilterListModel is a list model that filters the elements of the underlying model according to a GtkFilter.

It hides some elements from the other model according to criteria given by a GtkFilter.

The model can be set up to do incremental searching, so that filtering long lists doesn't block the UI. See filterListModelSetIncremental for details.

Synopsis

Exported types

newtype FilterListModel Source #

Memory-managed wrapper type.

Constructors

FilterListModel (ManagedPtr FilterListModel) 

Instances

Instances details
Eq FilterListModel Source # 
Instance details

Defined in GI.Gtk.Objects.FilterListModel

GObject FilterListModel Source # 
Instance details

Defined in GI.Gtk.Objects.FilterListModel

ManagedPtrNewtype FilterListModel Source # 
Instance details

Defined in GI.Gtk.Objects.FilterListModel

TypedObject FilterListModel Source # 
Instance details

Defined in GI.Gtk.Objects.FilterListModel

Methods

glibType :: IO GType

HasParentTypes FilterListModel Source # 
Instance details

Defined in GI.Gtk.Objects.FilterListModel

IsGValue (Maybe FilterListModel) Source #

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

Instance details

Defined in GI.Gtk.Objects.FilterListModel

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe FilterListModel -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe FilterListModel)

type ParentTypes FilterListModel Source # 
Instance details

Defined in GI.Gtk.Objects.FilterListModel

type ParentTypes FilterListModel = '[Object, ListModel]

class (GObject o, IsDescendantOf FilterListModel o) => IsFilterListModel o Source #

Type class for types which can be safely cast to FilterListModel, for instance with toFilterListModel.

Instances

Instances details
(GObject o, IsDescendantOf FilterListModel o) => IsFilterListModel o Source # 
Instance details

Defined in GI.Gtk.Objects.FilterListModel

toFilterListModel :: (MonadIO m, IsFilterListModel o) => o -> m FilterListModel Source #

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

Methods

getFilter

filterListModelGetFilter Source #

Arguments

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

self: a GtkFilterListModel

-> m (Maybe Filter)

Returns: The filter currently in use

Gets the GtkFilter currently set on self.

getIncremental

filterListModelGetIncremental Source #

Arguments

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

self: a GtkFilterListModel

-> m Bool

Returns: True if incremental filtering is enabled

Returns whether incremental filtering is enabled.

See filterListModelSetIncremental.

getModel

filterListModelGetModel Source #

Arguments

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

self: a GtkFilterListModel

-> m (Maybe ListModel)

Returns: The model that gets filtered

Gets the model currently filtered or Nothing if none.

getPending

filterListModelGetPending Source #

Arguments

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

self: a GtkFilterListModel

-> m Word32

Returns: The number of items not yet filtered

Returns the number of items that have not been filtered yet.

You can use this value to check if self is busy filtering by comparing the return value to 0 or you can compute the percentage of the filter remaining by dividing the return value by the total number of items in the underlying model:

c code

pending = gtk_filter_list_model_get_pending (self);
model = gtk_filter_list_model_get_model (self);
percentage = pending / (double) g_list_model_get_n_items (model);

If no filter operation is ongoing - in particular when FilterListModel:incremental is False - this function returns 0.

new

filterListModelNew Source #

Arguments

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

model: the model to sort

-> Maybe b

filter: filter

-> m FilterListModel

Returns: a new GtkFilterListModel

Creates a new GtkFilterListModel that will filter model using the given filter.

setFilter

filterListModelSetFilter Source #

Arguments

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

self: a GtkFilterListModel

-> Maybe b

filter: filter to use

-> m () 

Sets the filter used to filter items.

setIncremental

filterListModelSetIncremental Source #

Arguments

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

self: a GtkFilterListModel

-> Bool

incremental: True to enable incremental filtering

-> m () 

Sets the filter model to do an incremental sort.

When incremental filtering is enabled, the GtkFilterListModel will not run filters immediately, but will instead queue an idle handler that incrementally filters the items and adds them to the list. This of course means that items are not instantly added to the list, but only appear incrementally.

When your filter blocks the UI while filtering, you might consider turning this on. Depending on your model and filters, this may become interesting around 10,000 to 100,000 items.

By default, incremental filtering is disabled.

See filterListModelGetPending for progress information about an ongoing incremental filtering operation.

setModel

filterListModelSetModel Source #

Arguments

:: (HasCallStack, MonadIO m, IsFilterListModel a, IsListModel b) 
=> a

self: a GtkFilterListModel

-> Maybe b

model: The model to be filtered

-> m () 

Sets the model to be filtered.

Note that GTK makes no effort to ensure that model conforms to the item type of self. It assumes that the caller knows what they are doing and have set up an appropriate filter to ensure that item types match.

Properties

filter

The filter for this model.

clearFilterListModelFilter :: (MonadIO m, IsFilterListModel o) => o -> m () Source #

Set the value of the “filter” property to Nothing. When overloading is enabled, this is equivalent to

clear #filter

constructFilterListModelFilter :: (IsFilterListModel o, MonadIO m, IsFilter a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “filter” property. This is rarely needed directly, but it is used by new.

getFilterListModelFilter :: (MonadIO m, IsFilterListModel o) => o -> m (Maybe Filter) Source #

Get the value of the “filter” property. When overloading is enabled, this is equivalent to

get filterListModel #filter

setFilterListModelFilter :: (MonadIO m, IsFilterListModel o, IsFilter a) => o -> a -> m () Source #

Set the value of the “filter” property. When overloading is enabled, this is equivalent to

set filterListModel [ #filter := value ]

incremental

If the model should filter items incrementally.

constructFilterListModelIncremental :: (IsFilterListModel o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “incremental” property. This is rarely needed directly, but it is used by new.

getFilterListModelIncremental :: (MonadIO m, IsFilterListModel o) => o -> m Bool Source #

Get the value of the “incremental” property. When overloading is enabled, this is equivalent to

get filterListModel #incremental

setFilterListModelIncremental :: (MonadIO m, IsFilterListModel o) => o -> Bool -> m () Source #

Set the value of the “incremental” property. When overloading is enabled, this is equivalent to

set filterListModel [ #incremental := value ]

itemType

The type of items. See listModelGetItemType.

Since: 4.8

getFilterListModelItemType :: (MonadIO m, IsFilterListModel o) => o -> m GType Source #

Get the value of the “item-type” property. When overloading is enabled, this is equivalent to

get filterListModel #itemType

model

The model being filtered.

clearFilterListModelModel :: (MonadIO m, IsFilterListModel o) => o -> m () Source #

Set the value of the “model” property to Nothing. When overloading is enabled, this is equivalent to

clear #model

constructFilterListModelModel :: (IsFilterListModel o, MonadIO m, IsListModel a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “model” property. This is rarely needed directly, but it is used by new.

getFilterListModelModel :: (MonadIO m, IsFilterListModel o) => o -> m (Maybe ListModel) Source #

Get the value of the “model” property. When overloading is enabled, this is equivalent to

get filterListModel #model

setFilterListModelModel :: (MonadIO m, IsFilterListModel o, IsListModel a) => o -> a -> m () Source #

Set the value of the “model” property. When overloading is enabled, this is equivalent to

set filterListModel [ #model := value ]

nItems

The number of items. See listModelGetNItems.

Since: 4.8

getFilterListModelNItems :: (MonadIO m, IsFilterListModel o) => o -> m Word32 Source #

Get the value of the “n-items” property. When overloading is enabled, this is equivalent to

get filterListModel #nItems

pending

Number of items not yet filtered.

getFilterListModelPending :: (MonadIO m, IsFilterListModel o) => o -> m Word32 Source #

Get the value of the “pending” property. When overloading is enabled, this is equivalent to

get filterListModel #pending