| 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.Gio.Objects.ListStore
Description
GListStore is a simple implementation of ListModel that stores
all items in memory.
It provides insertions, deletions, and lookups in logarithmic time with a fast path for the common case of iterating the list linearly.
Synopsis
- newtype ListStore = ListStore (ManagedPtr ListStore)
- class (GObject o, IsDescendantOf ListStore o) => IsListStore o
- toListStore :: (MonadIO m, IsListStore o) => o -> m ListStore
- type family ResolveListStoreMethod (t :: Symbol) o where ...
- data ListStoreAppendMethodInfo
- listStoreAppend :: (HasCallStack, MonadIO m, IsListStore a, IsObject b) => a -> b -> m ()
- data ListStoreFindMethodInfo
- listStoreFind :: (HasCallStack, MonadIO m, IsListStore a, IsObject b) => a -> b -> m (Bool, Word32)
- data ListStoreFindWithEqualFuncMethodInfo
- listStoreFindWithEqualFunc :: (HasCallStack, MonadIO m, IsListStore a, IsObject b) => a -> Maybe b -> EqualFunc -> m (Bool, Word32)
- data ListStoreFindWithEqualFuncFullMethodInfo
- listStoreFindWithEqualFuncFull :: (HasCallStack, MonadIO m, IsListStore a, IsObject b) => a -> Maybe b -> EqualFuncFull -> m (Bool, Word32)
- data ListStoreInsertMethodInfo
- listStoreInsert :: (HasCallStack, MonadIO m, IsListStore a, IsObject b) => a -> Word32 -> b -> m ()
- data ListStoreInsertSortedMethodInfo
- listStoreInsertSorted :: (HasCallStack, MonadIO m, IsListStore a, IsObject b) => a -> b -> CompareDataFunc -> m Word32
- listStoreNew :: (HasCallStack, MonadIO m) => GType -> m ListStore
- data ListStoreRemoveMethodInfo
- listStoreRemove :: (HasCallStack, MonadIO m, IsListStore a) => a -> Word32 -> m ()
- data ListStoreRemoveAllMethodInfo
- listStoreRemoveAll :: (HasCallStack, MonadIO m, IsListStore a) => a -> m ()
- data ListStoreSortMethodInfo
- listStoreSort :: (HasCallStack, MonadIO m, IsListStore a) => a -> CompareDataFunc -> m ()
- data ListStoreSpliceMethodInfo
- listStoreSplice :: (HasCallStack, MonadIO m, IsListStore a) => a -> Word32 -> Word32 -> [Object] -> m ()
- data ListStoreItemTypePropertyInfo
- constructListStoreItemType :: (IsListStore o, MonadIO m) => GType -> m (GValueConstruct o)
- getListStoreItemType :: (MonadIO m, IsListStore o) => o -> m GType
- listStoreItemType :: AttrLabelProxy "itemType"
- data ListStoreNItemsPropertyInfo
- getListStoreNItems :: (MonadIO m, IsListStore o) => o -> m Word32
- listStoreNItems :: AttrLabelProxy "nItems"
Exported types
Memory-managed wrapper type.
Constructors
| ListStore (ManagedPtr ListStore) |
Instances
class (GObject o, IsDescendantOf ListStore o) => IsListStore o Source #
Type class for types which can be safely cast to ListStore, for instance with toListStore.
Instances
| (GObject o, IsDescendantOf ListStore o) => IsListStore o Source # | |
Defined in GI.Gio.Objects.ListStore | |
toListStore :: (MonadIO m, IsListStore o) => o -> m ListStore Source #
Methods
Click to display all available methods, including inherited ones
Methods
append, bindProperty, bindPropertyFull, find, findWithEqualFunc, findWithEqualFuncFull, forceFloating, freezeNotify, getv, insert, insertSorted, isFloating, itemsChanged, notify, notifyByPspec, ref, refSink, remove, removeAll, runDispose, sort, splice, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getItem, getItemType, getNItems, getProperty, getQdata.
Setters
type family ResolveListStoreMethod (t :: Symbol) o where ... Source #
Equations
append
data ListStoreAppendMethodInfo Source #
Instances
| (signature ~ (b -> m ()), MonadIO m, IsListStore a, IsObject b) => OverloadedMethod ListStoreAppendMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.ListStore Methods overloadedMethod :: a -> signature # | |
| OverloadedMethodInfo ListStoreAppendMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.ListStore Methods | |
Arguments
| :: (HasCallStack, MonadIO m, IsListStore a, IsObject b) | |
| => a |
|
| -> b |
|
| -> m () |
Appends item to store. item must be of type ListStore:itemType.
This function takes a ref on item.
Use listStoreSplice to append multiple items at the same time
efficiently.
Since: 2.44
find
data ListStoreFindMethodInfo Source #
Instances
| (signature ~ (b -> m (Bool, Word32)), MonadIO m, IsListStore a, IsObject b) => OverloadedMethod ListStoreFindMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.ListStore Methods overloadedMethod :: a -> signature # | |
| OverloadedMethodInfo ListStoreFindMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.ListStore Methods | |
Arguments
| :: (HasCallStack, MonadIO m, IsListStore a, IsObject b) | |
| => a |
|
| -> b |
|
| -> m (Bool, Word32) | Returns: Whether |
Looks up the given item in the list store by looping over the items until
the first occurrence of item. If item was not found, then position will
not be set, and this method will return False.
If you need to compare the two items with a custom comparison function, use
listStoreFindWithEqualFunc with a custom EqualFunc instead.
Since: 2.64
findWithEqualFunc
data ListStoreFindWithEqualFuncMethodInfo Source #
Instances
| (signature ~ (Maybe b -> EqualFunc -> m (Bool, Word32)), MonadIO m, IsListStore a, IsObject b) => OverloadedMethod ListStoreFindWithEqualFuncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.ListStore Methods overloadedMethod :: a -> signature # | |
| OverloadedMethodInfo ListStoreFindWithEqualFuncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.ListStore Methods | |
listStoreFindWithEqualFunc Source #
Arguments
| :: (HasCallStack, MonadIO m, IsListStore a, IsObject b) | |
| => a |
|
| -> Maybe b |
|
| -> EqualFunc |
|
| -> m (Bool, Word32) | Returns: Whether |
Looks up the given item in the list store by looping over the items and
comparing them with equalFunc until the first occurrence of item which
matches. If item was not found, then position will not be set, and this
method will return False.
item is always passed as second parameter to equalFunc.
Since GLib 2.76 it is possible to pass NULL for item.
Since: 2.64
findWithEqualFuncFull
data ListStoreFindWithEqualFuncFullMethodInfo Source #
Instances
| (signature ~ (Maybe b -> EqualFuncFull -> m (Bool, Word32)), MonadIO m, IsListStore a, IsObject b) => OverloadedMethod ListStoreFindWithEqualFuncFullMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.ListStore Methods overloadedMethod :: a -> signature # | |
| OverloadedMethodInfo ListStoreFindWithEqualFuncFullMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.ListStore Methods | |
listStoreFindWithEqualFuncFull Source #
Arguments
| :: (HasCallStack, MonadIO m, IsListStore a, IsObject b) | |
| => a |
|
| -> Maybe b |
|
| -> EqualFuncFull |
|
| -> m (Bool, Word32) | Returns: Whether |
Like listStoreFindWithEqualFunc but with an additional userData
that is passed to equalFunc.
item is always passed as second parameter to equalFunc.
Since GLib 2.76 it is possible to pass NULL for item.
Since: 2.74
insert
data ListStoreInsertMethodInfo Source #
Instances
| (signature ~ (Word32 -> b -> m ()), MonadIO m, IsListStore a, IsObject b) => OverloadedMethod ListStoreInsertMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.ListStore Methods overloadedMethod :: a -> signature # | |
| OverloadedMethodInfo ListStoreInsertMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.ListStore Methods | |
Arguments
| :: (HasCallStack, MonadIO m, IsListStore a, IsObject b) | |
| => a |
|
| -> Word32 |
|
| -> b |
|
| -> m () |
Inserts item into store at position. item must be of type
ListStore:itemType or derived from it. position must be smaller
than the length of the list, or equal to it to append.
This function takes a ref on item.
Use listStoreSplice to insert multiple items at the same time
efficiently.
Since: 2.44
insertSorted
data ListStoreInsertSortedMethodInfo Source #
Instances
| (signature ~ (b -> CompareDataFunc -> m Word32), MonadIO m, IsListStore a, IsObject b) => OverloadedMethod ListStoreInsertSortedMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.ListStore Methods overloadedMethod :: a -> signature # | |
| OverloadedMethodInfo ListStoreInsertSortedMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.ListStore Methods | |
listStoreInsertSorted Source #
Arguments
| :: (HasCallStack, MonadIO m, IsListStore a, IsObject b) | |
| => a |
|
| -> b |
|
| -> CompareDataFunc |
|
| -> m Word32 | Returns: the position at which |
Inserts item into store at a position to be determined by the
compareFunc.
The list must already be sorted before calling this function or the result is undefined. Usually you would approach this by only ever inserting items by way of this function.
This function takes a ref on item.
Since: 2.44
new
remove
data ListStoreRemoveMethodInfo Source #
Instances
| (signature ~ (Word32 -> m ()), MonadIO m, IsListStore a) => OverloadedMethod ListStoreRemoveMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.ListStore Methods overloadedMethod :: a -> signature # | |
| OverloadedMethodInfo ListStoreRemoveMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.ListStore Methods | |
Arguments
| :: (HasCallStack, MonadIO m, IsListStore a) | |
| => a |
|
| -> Word32 |
|
| -> m () |
Removes the item from store that is at position. position must be
smaller than the current length of the list.
Use listStoreSplice to remove multiple items at the same time
efficiently.
Since: 2.44
removeAll
data ListStoreRemoveAllMethodInfo Source #
Instances
| (signature ~ m (), MonadIO m, IsListStore a) => OverloadedMethod ListStoreRemoveAllMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.ListStore Methods overloadedMethod :: a -> signature # | |
| OverloadedMethodInfo ListStoreRemoveAllMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.ListStore Methods | |
Arguments
| :: (HasCallStack, MonadIO m, IsListStore a) | |
| => a |
|
| -> m () |
Removes all items from store.
Since: 2.44
sort
data ListStoreSortMethodInfo Source #
Instances
| (signature ~ (CompareDataFunc -> m ()), MonadIO m, IsListStore a) => OverloadedMethod ListStoreSortMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.ListStore Methods overloadedMethod :: a -> signature # | |
| OverloadedMethodInfo ListStoreSortMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.ListStore Methods | |
Arguments
| :: (HasCallStack, MonadIO m, IsListStore a) | |
| => a |
|
| -> CompareDataFunc |
|
| -> m () |
Sort the items in store according to compareFunc.
Since: 2.46
splice
data ListStoreSpliceMethodInfo Source #
Instances
| (signature ~ (Word32 -> Word32 -> [Object] -> m ()), MonadIO m, IsListStore a) => OverloadedMethod ListStoreSpliceMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.ListStore Methods overloadedMethod :: a -> signature # | |
| OverloadedMethodInfo ListStoreSpliceMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.ListStore Methods | |
Arguments
| :: (HasCallStack, MonadIO m, IsListStore a) | |
| => a |
|
| -> Word32 |
|
| -> Word32 |
|
| -> [Object] |
|
| -> m () |
Changes store by removing nRemovals items and adding nAdditions
items to it. additions must contain nAdditions items of type
ListStore:itemType. Nothing is not permitted.
This function is more efficient than listStoreInsert and
listStoreRemove, because it only emits
ListModel::itemsChanged once for the change.
This function takes a ref on each item in additions.
The parameters position and nRemovals must be correct (ie:
position + nRemovals must be less than or equal to the length of
the list at the time this function is called).
Since: 2.44
Properties
itemType
The type of items contained in this list store. Items must be
subclasses of Object.
Since: 2.44
data ListStoreItemTypePropertyInfo Source #
Instances
constructListStoreItemType :: (IsListStore o, MonadIO m) => GType -> m (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “item-type” property. This is rarely needed directly, but it is used by new.
getListStoreItemType :: (MonadIO m, IsListStore o) => o -> m GType Source #
Get the value of the “item-type” property.
When overloading is enabled, this is equivalent to
get listStore #itemType
listStoreItemType :: AttrLabelProxy "itemType" Source #
nItems
The number of items contained in this list store.
Since: 2.74
data ListStoreNItemsPropertyInfo Source #
Instances
| AttrInfo ListStoreNItemsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.ListStore Associated Types
Methods attrGet :: AttrBaseTypeConstraint ListStoreNItemsPropertyInfo o => o -> IO (AttrGetType ListStoreNItemsPropertyInfo) # attrSet :: (AttrBaseTypeConstraint ListStoreNItemsPropertyInfo o, AttrSetTypeConstraint ListStoreNItemsPropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint ListStoreNItemsPropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint ListStoreNItemsPropertyInfo o, AttrSetTypeConstraint ListStoreNItemsPropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint ListStoreNItemsPropertyInfo o, AttrTransferTypeConstraint ListStoreNItemsPropertyInfo b) => Proxy o -> b -> IO (AttrTransferType ListStoreNItemsPropertyInfo) # | |||||||||||||||||||||||||||||||||
| type AttrAllowedOps ListStoreNItemsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.ListStore | |||||||||||||||||||||||||||||||||
| type AttrBaseTypeConstraint ListStoreNItemsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.ListStore | |||||||||||||||||||||||||||||||||
| type AttrGetType ListStoreNItemsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.ListStore | |||||||||||||||||||||||||||||||||
| type AttrLabel ListStoreNItemsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.ListStore | |||||||||||||||||||||||||||||||||
| type AttrOrigin ListStoreNItemsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.ListStore | |||||||||||||||||||||||||||||||||
| type AttrSetTypeConstraint ListStoreNItemsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.ListStore | |||||||||||||||||||||||||||||||||
| type AttrTransferType ListStoreNItemsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.ListStore | |||||||||||||||||||||||||||||||||
| type AttrTransferTypeConstraint ListStoreNItemsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.ListStore | |||||||||||||||||||||||||||||||||
getListStoreNItems :: (MonadIO m, IsListStore o) => o -> m Word32 Source #
Get the value of the “n-items” property.
When overloading is enabled, this is equivalent to
get listStore #nItems
listStoreNItems :: AttrLabelProxy "nItems" Source #