Stability | provisional |
---|---|
Portability | portable (depends on GHC) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Allows a custom data structure to be used with the TreeView
and other
widgets that follow the model-view-controller paradigm. The two models
ListStore
and
TreeStore
are based on the
CustomStore
. Even if no application-specific tree model
should be implemented, this module is relevant in that it provides the
functions customStoreSetColumn
and
customStoreGetRow
functions.
Synopsis
- newtype CustomStore private row = CustomStore (ManagedPtr (CustomStore private row))
- data TreeModelFlags
- data TreeModelIface row = TreeModelIface {
- treeModelIfaceGetFlags :: IO [TreeModelFlags]
- treeModelIfaceGetIter :: TreePath -> IO (Maybe TreeIter)
- treeModelIfaceGetPath :: TreeIter -> IO TreePath
- treeModelIfaceGetRow :: TreeIter -> IO row
- treeModelIfaceIterNext :: TreeIter -> IO (Maybe TreeIter)
- treeModelIfaceIterChildren :: Maybe TreeIter -> IO (Maybe TreeIter)
- treeModelIfaceIterHasChild :: TreeIter -> IO Bool
- treeModelIfaceIterNChildren :: Maybe TreeIter -> IO Int
- treeModelIfaceIterNthChild :: Maybe TreeIter -> Int -> IO (Maybe TreeIter)
- treeModelIfaceIterParent :: TreeIter -> IO (Maybe TreeIter)
- treeModelIfaceRefNode :: TreeIter -> IO ()
- treeModelIfaceUnrefNode :: TreeIter -> IO ()
- data DragSourceIface model row = DragSourceIface {
- customDragSourceRowDraggable :: model row -> TreePath -> IO Bool
- customDragSourceDragDataGet :: model row -> TreePath -> SelectionData -> IO Bool
- customDragSourceDragDataDelete :: model row -> TreePath -> IO Bool
- data DragDestIface model row = DragDestIface {
- customDragDestRowDropPossible :: model row -> TreePath -> SelectionData -> IO Bool
- customDragDestDragDataReceived :: model row -> TreePath -> SelectionData -> IO Bool
- customStoreNew :: (MonadIO m, IsTreeModel (model row), IsTypedTreeModel model) => private -> (CustomStore private row -> model row) -> TreeModelIface row -> Maybe (DragSourceIface model row) -> Maybe (DragDestIface model row) -> m (model row)
- customStoreGetRow :: (MonadIO m, IsTypedTreeModel model) => model row -> TreeIter -> m row
- customStoreSetColumn :: (MonadIO m, IsTypedTreeModel model) => model row -> ColumnId row ty -> (row -> ty) -> m ()
- customStoreGetPrivate :: CustomStore private row -> private
- customStoreGetStamp :: MonadIO m => CustomStore private row -> m Int32
- customStoreInvalidateIters :: MonadIO m => CustomStore private row -> m ()
The definition of a row-based store.
newtype CustomStore private row Source #
A CustomStore
is an instance of a Gtk+ TreeModel
and can thus be used
for any widget that stores data in a TreeModel
. The user may either
create an instance of a CustomStore
or use one of the pre-defined
models ListStore
or
TreeStore
.
CustomStore (ManagedPtr (CustomStore private row)) |
Instances
GObject (CustomStore private row) Source # | |
Defined in Data.GI.Gtk.ModelView.CustomStore | |
TypedObject (CustomStore private row) Source # | |
Defined in Data.GI.Gtk.ModelView.CustomStore | |
HasParentTypes (CustomStore private row) Source # | |
Defined in Data.GI.Gtk.ModelView.CustomStore | |
type ParentTypes (CustomStore private row) Source # | |
Defined in Data.GI.Gtk.ModelView.CustomStore |
data TreeModelFlags #
Instances
data TreeModelIface row Source #
The TreeModelIface
structure contains all functions that are required
to implement an application-specific TreeModel
.
TreeModelIface | |
|
data DragSourceIface model row Source #
A structure containing functions that enable this widget to be used as a source in drag-and-drop.
DragSourceIface | |
|
data DragDestIface model row Source #
A structure containing functions that enable this widget to be used as a target in drag-and-drop.
DragDestIface | |
|
:: (MonadIO m, IsTreeModel (model row), IsTypedTreeModel model) | |
=> private | Any private data the store needs to store. Usually an |
-> (CustomStore private row -> model row) | |
-> TreeModelIface row | Functions necessary to implement the |
-> Maybe (DragSourceIface model row) | Functions to enable this store to generate drag events. |
-> Maybe (DragDestIface model row) | Functions to enable this store to receive drag events. |
-> m (model row) |
Create a new store that implements the TreeModelIface
interface and
optionally the DragSourceIface
and the DragDestIface
. If the latter two
are set to Nothing
a dummy interface is substituted that rejects every
drag and drop.
customStoreGetRow :: (MonadIO m, IsTypedTreeModel model) => model row -> TreeIter -> m row Source #
Extract a row of the given model at the given TreeIter
.
:: (MonadIO m, IsTypedTreeModel model) | |
=> model row | the store in which to allocate a new column |
-> ColumnId row ty | the column that should be set |
-> (row -> ty) | the function that sets the property |
-> m () |
Set or update a column mapping. This function should be used before the model is installed into a widget since the number of defined columns are only checked once by widgets.
customStoreGetPrivate :: CustomStore private row -> private Source #
Return the private data stored in this CustomStore
. The private data
is meant as a container for the data stored in this model.
customStoreGetStamp :: MonadIO m => CustomStore private row -> m Int32 Source #
Query the current value of the stamp that is used to create
TreeIter
iterators. The stamp is compared each time a view
accesses this store. If the stamp doesn't match, a warning
is emitted. The stamp should be updated each time a the data
in the model changes. The rationale is that a view should never
use a stale TreeIter
, i.e., one that refers to an old model.
customStoreInvalidateIters :: MonadIO m => CustomStore private row -> m () Source #
Create a new stamp. See customStoreGetStamp
.