| Gtk2Hs | Contents | Index

Graphics.UI.Gtk.TreeList.ListStore

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

Contents

Detail
  Performance Considerations
Class Hierarchy
Types
Constructors
Methods

Description

The database for simple (non-hierarchical) tables.

- This module and all other modules in Graphics.UI.Gtk.TreeList are deprecated. Please use the modules in Graphics.UI.Gtk.ModelView.

Synopsis

data ListStore
class TreeModelClass o => ListStoreClass o
castToListStore :: GObjectClass obj => obj -> ListStore
toListStore :: ListStoreClass o => o -> ListStore

data TMType

= TMinvalid
| TMuint
| TMint
| TMboolean
| TMenum
| TMflags
| TMfloat
| TMdouble
| TMstring
| TMobject

data GenericValue

= GVuint Word
| GVint Int
| GVboolean Bool
| GVenum Int
| GVflags Int
| GVfloat Float
| GVdouble Double
| GVstring (Maybe String)
| GVobject GObject

listStoreNew :: [TMType] -> IO ListStore
listStoreSetValue :: ListStoreClass self => self -> TreeIter -> Int -> GenericValue -> IO ()
listStoreRemove :: ListStoreClass self => self -> TreeIter -> IO Bool
listStoreInsert :: ListStoreClass self => self -> Int -> IO TreeIter
listStoreInsertBefore :: ListStoreClass self => self -> TreeIter -> IO TreeIter
listStoreInsertAfter :: ListStoreClass self => self -> TreeIter -> IO TreeIter
listStorePrepend :: ListStoreClass self => self -> IO TreeIter
listStoreAppend :: ListStoreClass self => self -> IO TreeIter
listStoreClear :: ListStoreClass self => self -> IO ()
listStoreReorder :: ListStoreClass self => self -> [Int] -> IO ()
listStoreSwap :: ListStoreClass self => self -> TreeIter -> TreeIter -> IO ()
listStoreMoveBefore :: ListStoreClass self => self -> TreeIter -> Maybe TreeIter -> IO ()
listStoreMoveAfter :: ListStoreClass self => self -> TreeIter -> Maybe TreeIter -> IO ()

Detail
The `ListStore` object is a list model for use with a `TreeView` widget. It implements the `TreeModel` interface, and consequentialy, can use all of the methods available there. It also implements the `TreeSortable` interface so it can be sorted by the view. Finally, it also implements the tree drag and drop interfaces.
Performance Considerations
Internally, the `ListStore` is implemented with a linked list with a tail pointer. As a result, it is fast at data insertion and deletion, and not as fast at random data access. The `ListStore` sets the `TreeModelItersPersist` flag, which means that `TreeIter`s can be cached while the row exists. Thus, if access to a particular row is needed often, it is worth keeping the iter around.
Class Hierarchy

     |  GObject
     |   +----ListStore

Types
data ListStore

Instances

GObjectClass ListStore
ListStoreClass ListStore
TreeModelClass ListStore

class TreeModelClass o => ListStoreClass o

Instances

ListStoreClass ListStore

castToListStore :: GObjectClass obj => obj -> ListStore
toListStore :: ListStoreClass o => o -> ListStore
data TMType

Constructors

TMinvalid |
TMuint |
TMint |
TMboolean |
TMenum |
TMflags |
TMfloat |
TMdouble |
TMstring |
TMobject |

Instances

Enum TMType

data GenericValue

A union with information about the currently stored type.

- Internally used by Graphics.UI.Gtk.TreeList.TreeModel.

Constructors

GVuint Word |
GVint Int |
GVboolean Bool |
GVenum Int |
GVflags Int |
GVfloat Float |
GVdouble Double |
GVstring (Maybe String) |
GVobject GObject |

Constructors
listStoreNew :: [TMType] -> IO ListStore
Generate a new entity to store tree information.
Methods
listStoreSetValue :: ListStoreClass self => self -> TreeIter -> Int -> GenericValue -> IO ()

Set the data of a specific node.

- The supplied value must match the type that was set for the column.

listStoreRemove :: ListStoreClass self => self -> TreeIter -> IO Bool

Remove a specific node.

- The `TreeIter` will point to the entry following the one which was just removed. The function returns `False` if the `ti`TreeIter does not point to a valid element (i.e. the function just removed the bottom entry from the list).
- This function returned `()` in Gtk version 2.0.X

listStoreInsert

:: ListStoreClass self |
=> self |
-> Int | `position` - position to insert the new row
-> IO TreeIter |

Insert a new row into the list.

- The `pos` parameter determines the row number where the row should be inserted. If the position is greater or equal to the number of rows, the new row will be inserted at the end.

listStoreInsertBefore :: ListStoreClass self => self -> TreeIter -> IO TreeIter
Insert a row in front of the `sibling` node.
listStoreInsertAfter :: ListStoreClass self => self -> TreeIter -> IO TreeIter
Insert a row behind the `sibling` row.
listStorePrepend :: ListStoreClass self => self -> IO TreeIter

Insert a row in front of every other row.

- This is equivalent to `listStoreInsert` `0`.

listStoreAppend :: ListStoreClass self => self -> IO TreeIter

Insert a row at the end of the table .

- This is equivalent to `listStoreInsert` (-1).

listStoreClear :: ListStoreClass self => self -> IO ()
Removes all rows from the list store.
listStoreReorder :: ListStoreClass self => self -> [Int] -> IO ()

Reorders store to follow the order indicated by the mapping. The list argument should be a mapping from the new positions to the old positions. That is `newOrder !! newPos = oldPos`

- Note that this function only works with unsorted stores.
- You must make sure the mapping is the right size for the store, use ``treeModelIterNChildren` store Nothing` to check.

listStoreSwap :: ListStoreClass self => self -> TreeIter -> TreeIter -> IO ()

Swaps the two items in the store.

- Note that this function only works with unsorted stores.
- Available since Gtk+ version 2.2

listStoreMoveBefore

:: ListStoreClass self |
=> self |
-> TreeIter | Iter for the item to be moved
-> Maybe TreeIter | Iter for the position or `Nothing`.
-> IO () |

Moves the item in the store to before the given position. If the position is `Nothing` the item will be moved to then end of the list.

- Note that this function only works with unsorted stores.
- Available since Gtk+ version 2.2

listStoreMoveAfter

:: ListStoreClass self |
=> self |
-> TreeIter | Iter for the item to be moved
-> Maybe TreeIter | Iter for the position or `Nothing`.
-> IO () |

Moves the item in the store to after the given position. If the position is `Nothing` the item will be moved to then start of the list.

- Note that this function only works with unsorted stores.

Produced by Haddock version 2.4.2