gi-gio
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

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

Exported types

newtype ListStore Source #

Memory-managed wrapper type.

Instances

Instances details
Eq ListStore Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

GObject ListStore Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

ManagedPtrNewtype ListStore Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

TypedObject ListStore Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

Methods

glibType :: IO GType #

HasParentTypes ListStore Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

HasAttributeList ListStore Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

(info ~ ResolveListStoreMethod t ListStore, OverloadedMethod info ListStore p, HasField t ListStore p) => HasField (t :: Symbol) ListStore (p :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

Methods

getField :: ListStore -> p #

(info ~ ResolveListStoreMethod t ListStore, OverloadedMethodInfo info ListStore) => IsLabel t (MethodProxy info ListStore) Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

(info ~ ResolveListStoreMethod t ListStore, OverloadedMethod info ListStore p) => IsLabel t (ListStore -> p) Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

Methods

fromLabel :: ListStore -> p #

IsGValue (Maybe ListStore) Source #

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

Instance details

Defined in GI.Gio.Objects.ListStore

type AttributeList ListStore Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type ParentTypes ListStore Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type SignalList ListStore Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

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

Instances details
(GObject o, IsDescendantOf ListStore o) => IsListStore o Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

toListStore :: (MonadIO m, IsListStore o) => o -> m ListStore Source #

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

Methods

type family ResolveListStoreMethod (t :: Symbol) o where ... Source #

Equations

ResolveListStoreMethod "append" o = ListStoreAppendMethodInfo 
ResolveListStoreMethod "bindProperty" o = ObjectBindPropertyMethodInfo 
ResolveListStoreMethod "bindPropertyFull" o = ObjectBindPropertyFullMethodInfo 
ResolveListStoreMethod "find" o = ListStoreFindMethodInfo 
ResolveListStoreMethod "findWithEqualFunc" o = ListStoreFindWithEqualFuncMethodInfo 
ResolveListStoreMethod "findWithEqualFuncFull" o = ListStoreFindWithEqualFuncFullMethodInfo 
ResolveListStoreMethod "forceFloating" o = ObjectForceFloatingMethodInfo 
ResolveListStoreMethod "freezeNotify" o = ObjectFreezeNotifyMethodInfo 
ResolveListStoreMethod "getv" o = ObjectGetvMethodInfo 
ResolveListStoreMethod "insert" o = ListStoreInsertMethodInfo 
ResolveListStoreMethod "insertSorted" o = ListStoreInsertSortedMethodInfo 
ResolveListStoreMethod "isFloating" o = ObjectIsFloatingMethodInfo 
ResolveListStoreMethod "itemsChanged" o = ListModelItemsChangedMethodInfo 
ResolveListStoreMethod "notify" o = ObjectNotifyMethodInfo 
ResolveListStoreMethod "notifyByPspec" o = ObjectNotifyByPspecMethodInfo 
ResolveListStoreMethod "ref" o = ObjectRefMethodInfo 
ResolveListStoreMethod "refSink" o = ObjectRefSinkMethodInfo 
ResolveListStoreMethod "remove" o = ListStoreRemoveMethodInfo 
ResolveListStoreMethod "removeAll" o = ListStoreRemoveAllMethodInfo 
ResolveListStoreMethod "runDispose" o = ObjectRunDisposeMethodInfo 
ResolveListStoreMethod "sort" o = ListStoreSortMethodInfo 
ResolveListStoreMethod "splice" o = ListStoreSpliceMethodInfo 
ResolveListStoreMethod "stealData" o = ObjectStealDataMethodInfo 
ResolveListStoreMethod "stealQdata" o = ObjectStealQdataMethodInfo 
ResolveListStoreMethod "thawNotify" o = ObjectThawNotifyMethodInfo 
ResolveListStoreMethod "unref" o = ObjectUnrefMethodInfo 
ResolveListStoreMethod "watchClosure" o = ObjectWatchClosureMethodInfo 
ResolveListStoreMethod "getData" o = ObjectGetDataMethodInfo 
ResolveListStoreMethod "getItem" o = ListModelGetItemMethodInfo 
ResolveListStoreMethod "getItemType" o = ListModelGetItemTypeMethodInfo 
ResolveListStoreMethod "getNItems" o = ListModelGetNItemsMethodInfo 
ResolveListStoreMethod "getProperty" o = ObjectGetPropertyMethodInfo 
ResolveListStoreMethod "getQdata" o = ObjectGetQdataMethodInfo 
ResolveListStoreMethod "setData" o = ObjectSetDataMethodInfo 
ResolveListStoreMethod "setDataFull" o = ObjectSetDataFullMethodInfo 
ResolveListStoreMethod "setProperty" o = ObjectSetPropertyMethodInfo 
ResolveListStoreMethod l o = MethodResolutionFailed l o :: Type 

append

data ListStoreAppendMethodInfo Source #

Instances

Instances details
(signature ~ (b -> m ()), MonadIO m, IsListStore a, IsObject b) => OverloadedMethod ListStoreAppendMethodInfo a signature Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

Methods

overloadedMethod :: a -> signature #

OverloadedMethodInfo ListStoreAppendMethodInfo (a :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

listStoreAppend Source #

Arguments

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

store: a ListStore

-> b

item: the new item

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

Instances details
(signature ~ (b -> m (Bool, Word32)), MonadIO m, IsListStore a, IsObject b) => OverloadedMethod ListStoreFindMethodInfo a signature Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

Methods

overloadedMethod :: a -> signature #

OverloadedMethodInfo ListStoreFindMethodInfo (a :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

listStoreFind Source #

Arguments

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

store: a ListStore

-> b

item: an item

-> m (Bool, Word32)

Returns: Whether store contains item. If it was found, position will be set to the position where item occurred for the first time.

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

listStoreFindWithEqualFunc Source #

Arguments

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

store: a ListStore

-> Maybe b

item: an item

-> EqualFunc

equalFunc: A custom equality check function

-> m (Bool, Word32)

Returns: Whether store contains item. If it was found, position will be set to the position where item occurred for the first time.

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

listStoreFindWithEqualFuncFull Source #

Arguments

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

store: a ListStore

-> Maybe b

item: an item

-> EqualFuncFull

equalFunc: A custom equality check function

-> m (Bool, Word32)

Returns: Whether store contains item. If it was found, position will be set to the position where item occurred for the first time.

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

Instances details
(signature ~ (Word32 -> b -> m ()), MonadIO m, IsListStore a, IsObject b) => OverloadedMethod ListStoreInsertMethodInfo a signature Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

Methods

overloadedMethod :: a -> signature #

OverloadedMethodInfo ListStoreInsertMethodInfo (a :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

listStoreInsert Source #

Arguments

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

store: a ListStore

-> Word32

position: the position at which to insert the new item

-> b

item: the new item

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

listStoreInsertSorted Source #

Arguments

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

store: a ListStore

-> b

item: the new item

-> CompareDataFunc

compareFunc: pairwise comparison function for sorting

-> m Word32

Returns: the position at which item was inserted

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

listStoreNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> GType

itemType: the GType of items in the list

-> m ListStore

Returns: a new ListStore

Creates a new ListStore with items of type itemType. itemType must be a subclass of Object.

Since: 2.44

remove

data ListStoreRemoveMethodInfo Source #

Instances

Instances details
(signature ~ (Word32 -> m ()), MonadIO m, IsListStore a) => OverloadedMethod ListStoreRemoveMethodInfo a signature Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

Methods

overloadedMethod :: a -> signature #

OverloadedMethodInfo ListStoreRemoveMethodInfo (a :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

listStoreRemove Source #

Arguments

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

store: a ListStore

-> Word32

position: the position of the item that is to be removed

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

Instances details
(signature ~ m (), MonadIO m, IsListStore a) => OverloadedMethod ListStoreRemoveAllMethodInfo a signature Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

Methods

overloadedMethod :: a -> signature #

OverloadedMethodInfo ListStoreRemoveAllMethodInfo (a :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

listStoreRemoveAll Source #

Arguments

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

store: a ListStore

-> m () 

Removes all items from store.

Since: 2.44

sort

data ListStoreSortMethodInfo Source #

Instances

Instances details
(signature ~ (CompareDataFunc -> m ()), MonadIO m, IsListStore a) => OverloadedMethod ListStoreSortMethodInfo a signature Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

Methods

overloadedMethod :: a -> signature #

OverloadedMethodInfo ListStoreSortMethodInfo (a :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

listStoreSort Source #

Arguments

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

store: a ListStore

-> CompareDataFunc

compareFunc: pairwise comparison function for sorting

-> m () 

Sort the items in store according to compareFunc.

Since: 2.46

splice

data ListStoreSpliceMethodInfo Source #

Instances

Instances details
(signature ~ (Word32 -> Word32 -> [Object] -> m ()), MonadIO m, IsListStore a) => OverloadedMethod ListStoreSpliceMethodInfo a signature Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

Methods

overloadedMethod :: a -> signature #

OverloadedMethodInfo ListStoreSpliceMethodInfo (a :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

listStoreSplice Source #

Arguments

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

store: a ListStore

-> Word32

position: the position at which to make the change

-> Word32

nRemovals: the number of items to remove

-> [Object]

additions: the items to add

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

Instances details
AttrInfo ListStoreItemTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type AttrAllowedOps ListStoreItemTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type AttrBaseTypeConstraint ListStoreItemTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type AttrGetType ListStoreItemTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type AttrLabel ListStoreItemTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type AttrOrigin ListStoreItemTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type AttrSetTypeConstraint ListStoreItemTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type AttrTransferType ListStoreItemTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type AttrTransferTypeConstraint ListStoreItemTypePropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

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

nItems

The number of items contained in this list store.

Since: 2.74

data ListStoreNItemsPropertyInfo Source #

Instances

Instances details
AttrInfo ListStoreNItemsPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type AttrAllowedOps ListStoreNItemsPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type AttrBaseTypeConstraint ListStoreNItemsPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type AttrGetType ListStoreNItemsPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type AttrLabel ListStoreNItemsPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type AttrOrigin ListStoreNItemsPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type AttrSetTypeConstraint ListStoreNItemsPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type AttrTransferType ListStoreNItemsPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.ListStore

type AttrTransferTypeConstraint ListStoreNItemsPropertyInfo Source # 
Instance details

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