gi-gtk-hs-0.3.18: A wrapper for gi-gtk, adding a few more idiomatic API parts on top

Stability | provisional
Portability | portable (depends on GHC)
Safe Haskell | None
Language | Haskell2010

Data.GI.Gtk.ModelView.SeqStore

Contents

- Types
- Constructors
- Implementation of Interfaces
- Methods

Description

Standard model to store list data.

Synopsis

- newtype SeqStore a = SeqStore (ManagedPtr (CustomStore (IORef (Seq a)) a))
- seqStoreNew :: (Applicative m, MonadIO m) => [a] -> m (SeqStore a)
- seqStoreNewDND :: (Applicative m, MonadIO m) => [a] -> Maybe (DragSourceIface SeqStore a) -> Maybe (DragDestIface SeqStore a) -> m (SeqStore a)
- seqStoreDefaultDragSourceIface :: DragSourceIface SeqStore row
- seqStoreDefaultDragDestIface :: DragDestIface SeqStore row
- seqStoreIterToIndex :: (Applicative m, MonadIO m) => TreeIter -> m Int32
- seqStoreGetValue :: (Applicative m, MonadIO m) => SeqStore a -> Int32 -> m a
- seqStoreSafeGetValue :: MonadIO m => SeqStore a -> Int32 -> m (Maybe a)
- seqStoreSetValue :: MonadIO m => SeqStore a -> Int32 -> a -> m ()
- seqStoreToList :: (Applicative m, MonadIO m) => SeqStore a -> m [a]
- seqStoreGetSize :: (Applicative m, MonadIO m) => SeqStore a -> m Int32
- seqStoreInsert :: MonadIO m => SeqStore a -> Int32 -> a -> m ()
- seqStoreInsertBefore :: (Applicative m, MonadIO m) => SeqStore a -> TreeIter -> a -> m ()
- seqStoreInsertAfter :: (Applicative m, MonadIO m) => SeqStore a -> TreeIter -> a -> m ()
- seqStorePrepend :: (Applicative m, MonadIO m) => SeqStore a -> a -> m ()
- seqStoreAppend :: MonadIO m => SeqStore a -> a -> m Int32
- seqStoreRemove :: MonadIO m => SeqStore a -> Int32 -> m ()
- seqStoreClear :: MonadIO m => SeqStore a -> m ()

# Types

newtype SeqStore a Source #

Constructors

SeqStore (ManagedPtr (CustomStore (IORef (Seq a)) a)) |

#### Instances

Instances details

IsTypedTreeModel SeqStore Source # |
Instance details Defined in Data.GI.Gtk.ModelView.SeqStore Methods dummy :: SeqStore a -> a
GObject (SeqStore a) Source # |
Instance details Defined in Data.GI.Gtk.ModelView.SeqStore
TypedObject (SeqStore a) Source # |
Instance details Defined in Data.GI.Gtk.ModelView.SeqStore Methods glibType :: IO GType Source #
HasParentTypes (SeqStore a) Source # |
Instance details Defined in Data.GI.Gtk.ModelView.SeqStore
type ParentTypes (SeqStore a) Source # |
Instance details Defined in Data.GI.Gtk.ModelView.SeqStore type ParentTypes (SeqStore a) = '[TreeModel]

# Constructors

seqStoreNew :: (Applicative m, MonadIO m) => [a] -> m (SeqStore a) Source #

Create a new `TreeModel` that contains a list of elements.

seqStoreNewDND Source #

Arguments

:: (Applicative m, MonadIO m) |
=> [a] | the initial content of the model
-> Maybe (DragSourceIface SeqStore a) | an optional interface for drags
-> Maybe (DragDestIface SeqStore a) | an optional interface to handle drops
-> m (SeqStore a) | the new model

Create a new `TreeModel` that contains a list of elements. In addition, specify two interfaces for drag and drop.

# Implementation of Interfaces

seqStoreDefaultDragSourceIface :: DragSourceIface SeqStore row Source #

Default drag functions for `SeqStore`. These functions allow the rows of the model to serve as drag source. Any row is allowed to be dragged and the data set in the `SelectionDataM` object is set with `treeSetRowDragData`, i.e. it contains the model and the `TreePath` to the row.

seqStoreDefaultDragDestIface :: DragDestIface SeqStore row Source #

Default drop functions for `SeqStore`. These functions accept a row and insert the row into the new location if it is dragged into a tree view that uses the same model.

# Methods

seqStoreIterToIndex :: (Applicative m, MonadIO m) => TreeIter -> m Int32 Source #

Convert a `TreeIterRaw` to an an index into the `SeqStore`. Note that this function merely extracts the second element of the `TreeIterRaw`.

seqStoreGetValue :: (Applicative m, MonadIO m) => SeqStore a -> Int32 -> m a Source #

Extract the value at the given index.

seqStoreSafeGetValue :: MonadIO m => SeqStore a -> Int32 -> m (Maybe a) Source #

Extract the value at the given index.

seqStoreSetValue :: MonadIO m => SeqStore a -> Int32 -> a -> m () Source #

Update the value at the given index. The index must exist.

seqStoreToList :: (Applicative m, MonadIO m) => SeqStore a -> m [a] Source #

Extract all data from the store.

seqStoreGetSize :: (Applicative m, MonadIO m) => SeqStore a -> m Int32 Source #

Query the number of elements in the store.

seqStoreInsert :: MonadIO m => SeqStore a -> Int32 -> a -> m () Source #

Insert an element in front of the given element. The element is appended if the index is greater or equal to the size of the list.

seqStoreInsertBefore :: (Applicative m, MonadIO m) => SeqStore a -> TreeIter -> a -> m () Source #

Insert an element in front of the given element.

seqStoreInsertAfter :: (Applicative m, MonadIO m) => SeqStore a -> TreeIter -> a -> m () Source #

Insert an element after the given element.

seqStorePrepend :: (Applicative m, MonadIO m) => SeqStore a -> a -> m () Source #

Prepend the element to the store.

seqStoreAppend :: MonadIO m => SeqStore a -> a -> m Int32 Source #

Append an element to the store. Returns the index of the inserted element.

seqStoreRemove :: MonadIO m => SeqStore a -> Int32 -> m () Source #

Remove the element at the given index.

seqStoreClear :: MonadIO m => SeqStore a -> m () Source #

Empty the store.