gi-gtk4-4.0.12: Gtk 4.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.FilterListModel

Contents

- Exported types
- Methods
  - getFilter
  - getIncremental
  - getModel
  - getPending
  - getWatchItems
  - new
  - setFilter
  - setIncremental
  - setModel
  - setWatchItems
- Properties
  - filter
  - incremental
  - itemType
  - model
  - nItems
  - pending
  - watchItems

Description

A list model that filters the elements of another model.

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

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

`GtkFilterListModel` passes through sections from the underlying model.

Synopsis

- newtype FilterListModel = FilterListModel (ManagedPtr FilterListModel)
- class (GObject o, IsDescendantOf FilterListModel o) => IsFilterListModel o
- toFilterListModel :: (MonadIO m, IsFilterListModel o) => o -> m FilterListModel
- filterListModelGetFilter :: (HasCallStack, MonadIO m, IsFilterListModel a) => a -> m (Maybe Filter)
- filterListModelGetIncremental :: (HasCallStack, MonadIO m, IsFilterListModel a) => a -> m Bool
- filterListModelGetModel :: (HasCallStack, MonadIO m, IsFilterListModel a) => a -> m (Maybe ListModel)
- filterListModelGetPending :: (HasCallStack, MonadIO m, IsFilterListModel a) => a -> m Word32
- filterListModelGetWatchItems :: (HasCallStack, MonadIO m, IsFilterListModel a) => a -> m Bool
- filterListModelNew :: (HasCallStack, MonadIO m, IsListModel a, IsFilter b) => Maybe a -> Maybe b -> m FilterListModel
- filterListModelSetFilter :: (HasCallStack, MonadIO m, IsFilterListModel a, IsFilter b) => a -> Maybe b -> m ()
- filterListModelSetIncremental :: (HasCallStack, MonadIO m, IsFilterListModel a) => a -> Bool -> m ()
- filterListModelSetModel :: (HasCallStack, MonadIO m, IsFilterListModel a, IsListModel b) => a -> Maybe b -> m ()
- filterListModelSetWatchItems :: (HasCallStack, MonadIO m, IsFilterListModel a) => a -> Bool -> m ()
- clearFilterListModelFilter :: (MonadIO m, IsFilterListModel o) => o -> m ()
- constructFilterListModelFilter :: (IsFilterListModel o, MonadIO m, IsFilter a) => a -> m (GValueConstruct o)
- getFilterListModelFilter :: (MonadIO m, IsFilterListModel o) => o -> m (Maybe Filter)
- setFilterListModelFilter :: (MonadIO m, IsFilterListModel o, IsFilter a) => o -> a -> m ()
- constructFilterListModelIncremental :: (IsFilterListModel o, MonadIO m) => Bool -> m (GValueConstruct o)
- getFilterListModelIncremental :: (MonadIO m, IsFilterListModel o) => o -> m Bool
- setFilterListModelIncremental :: (MonadIO m, IsFilterListModel o) => o -> Bool -> m ()
- getFilterListModelItemType :: (MonadIO m, IsFilterListModel o) => o -> m GType
- clearFilterListModelModel :: (MonadIO m, IsFilterListModel o) => o -> m ()
- constructFilterListModelModel :: (IsFilterListModel o, MonadIO m, IsListModel a) => a -> m (GValueConstruct o)
- getFilterListModelModel :: (MonadIO m, IsFilterListModel o) => o -> m (Maybe ListModel)
- setFilterListModelModel :: (MonadIO m, IsFilterListModel o, IsListModel a) => o -> a -> m ()
- getFilterListModelNItems :: (MonadIO m, IsFilterListModel o) => o -> m Word32
- getFilterListModelPending :: (MonadIO m, IsFilterListModel o) => o -> m Word32
- constructFilterListModelWatchItems :: (IsFilterListModel o, MonadIO m) => Bool -> m (GValueConstruct o)
- getFilterListModelWatchItems :: (MonadIO m, IsFilterListModel o) => o -> m Bool
- setFilterListModelWatchItems :: (MonadIO m, IsFilterListModel o) => o -> Bool -> m ()

# 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 Methods (==) :: FilterListModel -> FilterListModel -> Bool Source # (/=) :: FilterListModel -> FilterListModel -> Bool Source #
GObject FilterListModel Source # |
Instance details Defined in GI.Gtk.Objects.FilterListModel
ManagedPtrNewtype FilterListModel Source # |
Instance details Defined in GI.Gtk.Objects.FilterListModel Methods toManagedPtr :: FilterListModel -> ManagedPtr FilterListModel Source #
TypedObject FilterListModel Source # |
Instance details Defined in GI.Gtk.Objects.FilterListModel Methods glibType :: IO GType Source #
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 Source # gvalueSet_ :: Ptr GValue -> Maybe FilterListModel -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe FilterListModel) Source #
type ParentTypes FilterListModel Source # |
Instance details Defined in GI.Gtk.Objects.FilterListModel type ParentTypes FilterListModel = '[Object, ListModel, SectionModel]

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

### Click to display all available methods, including inherited ones

Expand

#### Methods

bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, itemsChanged, notify, notifyByPspec, ref, refSink, runDispose, sectionsChanged, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getData, getFilter, getIncremental, getItem, getItemType, getModel, getNItems, getPending, getProperty, getQdata, getSection, getWatchItems.

#### Setters

setData, setDataFull, setFilter, setIncremental, setModel, setProperty, setWatchItems.

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

## getWatchItems

filterListModelGetWatchItems Source #

Arguments

:: (HasCallStack, MonadIO m, IsFilterListModel a) |
=> a | `self`: a `GtkFilterListModel`
-> m Bool | Returns: `True` if watching items is enabled

Returns whether watching items is enabled.

See `filterListModelSetWatchItems`.

Since: 4.20

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

## setWatchItems

filterListModelSetWatchItems Source #

Arguments

:: (HasCallStack, MonadIO m, IsFilterListModel a) |
=> a | `self`: a `GtkFilterListModel`
-> Bool | `watchItems`: `True` to watch items for property changes
-> m () |

Sets the filter model to monitor properties of its items.

This allows implementations of `Filter` that support expression watching to react to property changes. This property has no effect if the current filter doesn't support watching items.

By default, watching items is disabled.

Since: 4.20

# 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

## watchItems

Monitor the list items for changes. It may impact performance.

Since: 4.20

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

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

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

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

    get filterListModel #watchItems

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

Set the value of the “`watch-items`” property. When overloading is enabled, this is equivalent to

    set filterListModel [ #watchItems := value ]