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 |
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
- 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
- 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 ()
- 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
Exported types
newtype FilterListModel Source #
Memory-managed wrapper type.
FilterListModel (ManagedPtr FilterListModel) |
Instances
Eq FilterListModel Source # | |
Defined in GI.Gtk.Objects.FilterListModel (==) :: FilterListModel -> FilterListModel -> Bool # (/=) :: FilterListModel -> FilterListModel -> Bool # | |
GObject FilterListModel Source # | |
Defined in GI.Gtk.Objects.FilterListModel | |
ManagedPtrNewtype FilterListModel Source # | |
Defined in GI.Gtk.Objects.FilterListModel toManagedPtr :: FilterListModel -> ManagedPtr FilterListModel | |
TypedObject FilterListModel Source # | |
Defined in GI.Gtk.Objects.FilterListModel | |
HasParentTypes FilterListModel Source # | |
Defined in GI.Gtk.Objects.FilterListModel | |
IsGValue (Maybe FilterListModel) Source # | Convert |
Defined in GI.Gtk.Objects.FilterListModel gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe FilterListModel -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe FilterListModel) | |
type ParentTypes FilterListModel Source # | |
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
(GObject o, IsDescendantOf FilterListModel o) => IsFilterListModel o Source # | |
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
Methods
bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, itemsChanged, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getFilter, getIncremental, getItem, getItemType, getModel, getNItems, getPending, getProperty, getQdata.
Setters
setData, setDataFull, setFilter, setIncremental, setModel, setProperty.
getFilter
filterListModelGetFilter Source #
:: (HasCallStack, MonadIO m, IsFilterListModel a) | |
=> a |
|
-> m (Maybe Filter) | Returns: The filter currently in use |
Gets the GtkFilter
currently set on self
.
getIncremental
filterListModelGetIncremental Source #
:: (HasCallStack, MonadIO m, IsFilterListModel a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether incremental filtering is enabled.
getModel
filterListModelGetModel Source #
:: (HasCallStack, MonadIO m, IsFilterListModel a) | |
=> a |
|
-> m (Maybe ListModel) | Returns: The model that gets filtered |
Gets the model currently filtered or Nothing
if none.
getPending
filterListModelGetPending Source #
:: (HasCallStack, MonadIO m, IsFilterListModel a) | |
=> a |
|
-> 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
:: (HasCallStack, MonadIO m, IsListModel a, IsFilter b) | |
=> Maybe a |
|
-> Maybe b |
|
-> m FilterListModel | Returns: a new |
Creates a new GtkFilterListModel
that will filter model
using the given
filter
.
setFilter
filterListModelSetFilter Source #
:: (HasCallStack, MonadIO m, IsFilterListModel a, IsFilter b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the filter used to filter items.
setIncremental
filterListModelSetIncremental Source #
:: (HasCallStack, MonadIO m, IsFilterListModel a) | |
=> a |
|
-> Bool |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsFilterListModel a, IsListModel b) | |
=> a |
|
-> Maybe b |
|
-> 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