| Gtk2Hs | Contents | Index

Graphics.UI.Gtk.ModelView.TreeStore

Portability | portable (depends on GHC)
Stability | provisional
Maintainer | gtk2hs-users@lists.sourceforge.net

Contents

Types
Constructors
Implementation of Interfaces
Methods

Description
Standard model to store hierarchical data.
Synopsis

data TreeStore a
treeStoreNew :: Forest a -> IO (TreeStore a)
treeStoreNewDND :: Forest a -> Maybe (DragSourceIface TreeStore a) -> Maybe (DragDestIface TreeStore a) -> IO (TreeStore a)
treeStoreDefaultDragSourceIface :: DragSourceIface TreeStore row
treeStoreDefaultDragDestIface :: DragDestIface TreeStore row
treeStoreGetValue :: TreeStore a -> TreePath -> IO a
treeStoreGetTree :: TreeStore a -> TreePath -> IO (Tree a)
treeStoreLookup :: TreeStore a -> TreePath -> IO (Maybe (Tree a))
treeStoreSetValue :: TreeStore a -> TreePath -> a -> IO ()
treeStoreInsert :: TreeStore a -> TreePath -> Int -> a -> IO ()
treeStoreInsertTree :: TreeStore a -> TreePath -> Int -> Tree a -> IO ()
treeStoreRemove :: TreeStore a -> TreePath -> IO Bool
treeStoreClear :: TreeStore a -> IO ()

Types
data TreeStore a

A store for hierarchical data.
Instances

TypedTreeModelClass TreeStore
GObjectClass (TreeStore a)
TreeModelClass (TreeStore a)

Constructors
treeStoreNew :: Forest a -> IO (TreeStore a)

Create a new list store.

- The given rose tree determines the initial content and may be the empty list. Each `Tree` in the forest corresponds to one top-level node.

treeStoreNewDND

:: |
=> Forest a | the inital tree stored in this model
-> Maybe (DragSourceIface TreeStore a) | an optional interface for drags
-> Maybe (DragDestIface TreeStore a) | an optional interface to handle drops
-> IO (TreeStore a) |

Create a new list store.

- In addition to `treeStoreNew`, this function takes an two interfaces to implement user-defined drag-and-drop functionality.

Implementation of Interfaces
treeStoreDefaultDragSourceIface :: DragSourceIface TreeStore row
Default drag functions for Graphics.UI.Gtk.ModelView.TreeStore. 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.
treeStoreDefaultDragDestIface :: DragDestIface TreeStore row
Default drop functions for Graphics.UI.Gtk.ModelView.TreeStore. 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
treeStoreGetValue :: TreeStore a -> TreePath -> IO a
Extract one node from the current model. Fails if the given `TreePath` refers to a non-existent node.
treeStoreGetTree :: TreeStore a -> TreePath -> IO (Tree a)
Extract a subtree from the current model. Fails if the given `TreePath` refers to a non-existent node.
treeStoreLookup :: TreeStore a -> TreePath -> IO (Maybe (Tree a))
Extract a subtree from the current model. Like `treeStoreGetTree` but returns `Nothing` if the path refers to a non-existant node.
treeStoreSetValue :: TreeStore a -> TreePath -> a -> IO ()
Set a node in the store.
treeStoreInsert

:: |
=> TreeStore a | the store
-> TreePath | `path` - the position of the parent
-> Int | `pos` - the index of the new tree
-> a | the value to be inserted
-> IO () |

Insert a single node into the store.

- This function inserts a single node without children into the tree. Its arguments are similar to those of `treeStoreInsert`.

treeStoreInsertTree

:: |
=> TreeStore a | the store
-> TreePath | `path` - the position of the parent
-> Int | `pos` - the index of the new tree
-> Tree a | the value to be inserted
-> IO () |
Insert a node into the store.

treeStoreRemove :: TreeStore a -> TreePath -> IO Bool

Remove a node from the store.

- The node denoted by the path is removed, along with all its children. The function returns `True` if the given node was found.

treeStoreClear :: TreeStore a -> IO ()
Produced by Haddock version 2.4.2