Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
The TreeStore
object is a list model for use with a TreeView
widget. It implements the TreeModel
interface, and consequentially,
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][gtk3-GtkTreeView-drag-and-drop]
interfaces.
GtkTreeStore as GtkBuildable
The GtkTreeStore implementation of the Buildable
interface allows
to specify the model columns with a <columns> element that may contain
multiple <column> elements, each specifying one model column. The “type”
attribute specifies the data type for the column.
An example of a UI Definition fragment for a tree store: > >class="GtkTreeStore" > columns > type="gchararray"/ > type="gchararray"/ > type="gint"/ > /columns >/object
- newtype TreeStore = TreeStore (ManagedPtr TreeStore)
- class GObject o => IsTreeStore o
- toTreeStore :: IsTreeStore o => o -> IO TreeStore
- noTreeStore :: Maybe TreeStore
- data TreeStoreAppendMethodInfo
- treeStoreAppend :: (HasCallStack, MonadIO m, IsTreeStore a) => a -> Maybe TreeIter -> m TreeIter
- data TreeStoreClearMethodInfo
- treeStoreClear :: (HasCallStack, MonadIO m, IsTreeStore a) => a -> m ()
- data TreeStoreInsertMethodInfo
- treeStoreInsert :: (HasCallStack, MonadIO m, IsTreeStore a) => a -> Maybe TreeIter -> Int32 -> m TreeIter
- data TreeStoreInsertAfterMethodInfo
- treeStoreInsertAfter :: (HasCallStack, MonadIO m, IsTreeStore a) => a -> Maybe TreeIter -> Maybe TreeIter -> m TreeIter
- data TreeStoreInsertBeforeMethodInfo
- treeStoreInsertBefore :: (HasCallStack, MonadIO m, IsTreeStore a) => a -> Maybe TreeIter -> Maybe TreeIter -> m TreeIter
- data TreeStoreInsertWithValuesMethodInfo
- treeStoreInsertWithValues :: (HasCallStack, MonadIO m, IsTreeStore a) => a -> Maybe TreeIter -> Int32 -> [Int32] -> [GValue] -> m TreeIter
- data TreeStoreIsAncestorMethodInfo
- treeStoreIsAncestor :: (HasCallStack, MonadIO m, IsTreeStore a) => a -> TreeIter -> TreeIter -> m Bool
- data TreeStoreIterDepthMethodInfo
- treeStoreIterDepth :: (HasCallStack, MonadIO m, IsTreeStore a) => a -> TreeIter -> m Int32
- data TreeStoreIterIsValidMethodInfo
- treeStoreIterIsValid :: (HasCallStack, MonadIO m, IsTreeStore a) => a -> TreeIter -> m Bool
- data TreeStoreMoveAfterMethodInfo
- treeStoreMoveAfter :: (HasCallStack, MonadIO m, IsTreeStore a) => a -> TreeIter -> Maybe TreeIter -> m ()
- data TreeStoreMoveBeforeMethodInfo
- treeStoreMoveBefore :: (HasCallStack, MonadIO m, IsTreeStore a) => a -> TreeIter -> Maybe TreeIter -> m ()
- treeStoreNew :: (HasCallStack, MonadIO m) => [GType] -> m TreeStore
- data TreeStorePrependMethodInfo
- treeStorePrepend :: (HasCallStack, MonadIO m, IsTreeStore a) => a -> Maybe TreeIter -> m TreeIter
- data TreeStoreRemoveMethodInfo
- treeStoreRemove :: (HasCallStack, MonadIO m, IsTreeStore a) => a -> TreeIter -> m Bool
- data TreeStoreSetMethodInfo
- treeStoreSet :: (HasCallStack, MonadIO m, IsTreeStore a) => a -> TreeIter -> [Int32] -> [GValue] -> m ()
- data TreeStoreSetColumnTypesMethodInfo
- treeStoreSetColumnTypes :: (HasCallStack, MonadIO m, IsTreeStore a) => a -> [GType] -> m ()
- data TreeStoreSetValueMethodInfo
- treeStoreSetValue :: (HasCallStack, MonadIO m, IsTreeStore a) => a -> TreeIter -> Int32 -> GValue -> m ()
- data TreeStoreSwapMethodInfo
- treeStoreSwap :: (HasCallStack, MonadIO m, IsTreeStore a) => a -> TreeIter -> TreeIter -> m ()
Exported types
GObject TreeStore Source # | |
IsObject TreeStore Source # | |
IsTreeSortable TreeStore Source # | |
IsTreeModel TreeStore Source # | |
IsTreeDragSource TreeStore Source # | |
IsTreeDragDest TreeStore Source # | |
IsBuildable TreeStore Source # | |
IsTreeStore TreeStore Source # | |
((~) * info (ResolveTreeStoreMethod t TreeStore), MethodInfo * info TreeStore p) => IsLabel t (TreeStore -> p) Source # | |
((~) * info (ResolveTreeStoreMethod t TreeStore), MethodInfo * info TreeStore p) => IsLabelProxy t (TreeStore -> p) Source # | |
HasAttributeList * TreeStore Source # | |
type AttributeList TreeStore Source # | |
type SignalList TreeStore Source # | |
class GObject o => IsTreeStore o Source #
toTreeStore :: IsTreeStore o => o -> IO TreeStore Source #
Methods
append
data TreeStoreAppendMethodInfo Source #
((~) * signature (Maybe TreeIter -> m TreeIter), MonadIO m, IsTreeStore a) => MethodInfo * TreeStoreAppendMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsTreeStore a) | |
=> a |
|
-> Maybe TreeIter | |
-> m TreeIter |
Appends a new row to treeStore
. If parent
is non-Nothing
, then it will append the
new row after the last child of parent
, otherwise it will append a row to
the top level. iter
will be changed to point to this new row. The row will
be empty after this function is called. To fill in values, you need to call
gtk_tree_store_set()
or treeStoreSetValue
.
clear
data TreeStoreClearMethodInfo Source #
((~) * signature (m ()), MonadIO m, IsTreeStore a) => MethodInfo * TreeStoreClearMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsTreeStore a) | |
=> a |
|
-> m () |
Removes all rows from treeStore
insert
data TreeStoreInsertMethodInfo Source #
((~) * signature (Maybe TreeIter -> Int32 -> m TreeIter), MonadIO m, IsTreeStore a) => MethodInfo * TreeStoreInsertMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsTreeStore a) | |
=> a |
|
-> Maybe TreeIter | |
-> Int32 |
|
-> m TreeIter |
Creates a new row at position
. If parent is non-Nothing
, then the row will be
made a child of parent
. Otherwise, the row will be created at the toplevel.
If position
is -1 or is larger than the number of rows at that level, then
the new row will be inserted to the end of the list. iter
will be changed
to point to this new row. The row will be empty after this function is
called. To fill in values, you need to call gtk_tree_store_set()
or
treeStoreSetValue
.
insertAfter
data TreeStoreInsertAfterMethodInfo Source #
((~) * signature (Maybe TreeIter -> Maybe TreeIter -> m TreeIter), MonadIO m, IsTreeStore a) => MethodInfo * TreeStoreInsertAfterMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsTreeStore a) | |
=> a |
|
-> Maybe TreeIter | |
-> Maybe TreeIter | |
-> m TreeIter |
Inserts a new row after sibling
. If sibling
is Nothing
, then the row will be
prepended to parent
’s children. If parent
and sibling
are Nothing
, then
the row will be prepended to the toplevel. If both sibling
and parent
are
set, then parent
must be the parent of sibling
. When sibling
is set,
parent
is optional.
iter
will be changed to point to this new row. The row will be empty after
this function is called. To fill in values, you need to call
gtk_tree_store_set()
or treeStoreSetValue
.
insertBefore
data TreeStoreInsertBeforeMethodInfo Source #
((~) * signature (Maybe TreeIter -> Maybe TreeIter -> m TreeIter), MonadIO m, IsTreeStore a) => MethodInfo * TreeStoreInsertBeforeMethodInfo a signature Source # | |
treeStoreInsertBefore Source #
:: (HasCallStack, MonadIO m, IsTreeStore a) | |
=> a |
|
-> Maybe TreeIter | |
-> Maybe TreeIter | |
-> m TreeIter |
Inserts a new row before sibling
. If sibling
is Nothing
, then the row will
be appended to parent
’s children. If parent
and sibling
are Nothing
, then
the row will be appended to the toplevel. If both sibling
and parent
are
set, then parent
must be the parent of sibling
. When sibling
is set,
parent
is optional.
iter
will be changed to point to this new row. The row will be empty after
this function is called. To fill in values, you need to call
gtk_tree_store_set()
or treeStoreSetValue
.
insertWithValues
data TreeStoreInsertWithValuesMethodInfo Source #
((~) * signature (Maybe TreeIter -> Int32 -> [Int32] -> [GValue] -> m TreeIter), MonadIO m, IsTreeStore a) => MethodInfo * TreeStoreInsertWithValuesMethodInfo a signature Source # | |
treeStoreInsertWithValues Source #
:: (HasCallStack, MonadIO m, IsTreeStore a) | |
=> a |
|
-> Maybe TreeIter | |
-> Int32 |
|
-> [Int32] |
|
-> [GValue] |
|
-> m TreeIter |
A variant of gtk_tree_store_insert_with_values()
which takes
the columns and values as two arrays, instead of varargs. This
function is mainly intended for language bindings.
Since: 2.10
isAncestor
data TreeStoreIsAncestorMethodInfo Source #
((~) * signature (TreeIter -> TreeIter -> m Bool), MonadIO m, IsTreeStore a) => MethodInfo * TreeStoreIsAncestorMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsTreeStore a) | |
=> a |
|
-> TreeIter |
|
-> TreeIter |
|
-> m Bool | Returns: |
Returns True
if iter
is an ancestor of descendant
. That is, iter
is the
parent (or grandparent or great-grandparent) of descendant
.
iterDepth
data TreeStoreIterDepthMethodInfo Source #
((~) * signature (TreeIter -> m Int32), MonadIO m, IsTreeStore a) => MethodInfo * TreeStoreIterDepthMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsTreeStore a) | |
=> a |
|
-> TreeIter |
|
-> m Int32 | Returns: The depth of |
Returns the depth of iter
. This will be 0 for anything on the root level, 1
for anything down a level, etc.
iterIsValid
data TreeStoreIterIsValidMethodInfo Source #
((~) * signature (TreeIter -> m Bool), MonadIO m, IsTreeStore a) => MethodInfo * TreeStoreIterIsValidMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsTreeStore a) | |
=> a |
|
-> TreeIter |
|
-> m Bool | Returns: |
WARNING: This function is slow. Only use it for debugging and/or testing purposes.
Checks if the given iter is a valid iter for this TreeStore
.
Since: 2.2
moveAfter
data TreeStoreMoveAfterMethodInfo Source #
((~) * signature (TreeIter -> Maybe TreeIter -> m ()), MonadIO m, IsTreeStore a) => MethodInfo * TreeStoreMoveAfterMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsTreeStore a) | |
=> a |
|
-> TreeIter |
|
-> Maybe TreeIter |
|
-> m () |
Moves iter
in treeStore
to the position after position
. iter
and
position
should be in the same level. Note that this function only
works with unsorted stores. If position
is Nothing
, iter
will be moved
to the start of the level.
Since: 2.2
moveBefore
data TreeStoreMoveBeforeMethodInfo Source #
((~) * signature (TreeIter -> Maybe TreeIter -> m ()), MonadIO m, IsTreeStore a) => MethodInfo * TreeStoreMoveBeforeMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsTreeStore a) | |
=> a |
|
-> TreeIter |
|
-> Maybe TreeIter | |
-> m () |
Moves iter
in treeStore
to the position before position
. iter
and
position
should be in the same level. Note that this function only
works with unsorted stores. If position
is Nothing
, iter
will be
moved to the end of the level.
Since: 2.2
new
:: (HasCallStack, MonadIO m) | |
=> [GType] |
|
-> m TreeStore | Returns: a new |
Non vararg creation function. Used primarily by language bindings.
prepend
data TreeStorePrependMethodInfo Source #
((~) * signature (Maybe TreeIter -> m TreeIter), MonadIO m, IsTreeStore a) => MethodInfo * TreeStorePrependMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsTreeStore a) | |
=> a |
|
-> Maybe TreeIter | |
-> m TreeIter |
Prepends a new row to treeStore
. If parent
is non-Nothing
, then it will prepend
the new row before the first child of parent
, otherwise it will prepend a row
to the top level. iter
will be changed to point to this new row. The row
will be empty after this function is called. To fill in values, you need to
call gtk_tree_store_set()
or treeStoreSetValue
.
remove
data TreeStoreRemoveMethodInfo Source #
((~) * signature (TreeIter -> m Bool), MonadIO m, IsTreeStore a) => MethodInfo * TreeStoreRemoveMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsTreeStore a) | |
=> a |
|
-> TreeIter |
|
-> m Bool |
Removes iter
from treeStore
. After being removed, iter
is set to the
next valid row at that level, or invalidated if it previously pointed to the
last one.
set
data TreeStoreSetMethodInfo Source #
((~) * signature (TreeIter -> [Int32] -> [GValue] -> m ()), MonadIO m, IsTreeStore a) => MethodInfo * TreeStoreSetMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsTreeStore a) | |
=> a |
|
-> TreeIter |
|
-> [Int32] |
|
-> [GValue] |
|
-> m () |
A variant of gtk_tree_store_set_valist()
which takes
the columns and values as two arrays, instead of varargs. This
function is mainly intended for language bindings or in case
the number of columns to change is not known until run-time.
Since: 2.12
setColumnTypes
data TreeStoreSetColumnTypesMethodInfo Source #
((~) * signature ([GType] -> m ()), MonadIO m, IsTreeStore a) => MethodInfo * TreeStoreSetColumnTypesMethodInfo a signature Source # | |
treeStoreSetColumnTypes Source #
:: (HasCallStack, MonadIO m, IsTreeStore a) | |
=> a |
|
-> [GType] |
|
-> m () |
setValue
data TreeStoreSetValueMethodInfo Source #
((~) * signature (TreeIter -> Int32 -> GValue -> m ()), MonadIO m, IsTreeStore a) => MethodInfo * TreeStoreSetValueMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsTreeStore a) | |
=> a |
|
-> TreeIter |
|
-> Int32 |
|
-> GValue |
|
-> m () |
Sets the data in the cell specified by iter
and column
.
The type of value
must be convertible to the type of the
column.
swap
data TreeStoreSwapMethodInfo Source #
((~) * signature (TreeIter -> TreeIter -> m ()), MonadIO m, IsTreeStore a) => MethodInfo * TreeStoreSwapMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsTreeStore a) | |
=> a |
|
-> TreeIter |
|
-> TreeIter |
|
-> m () |
Swaps a
and b
in the same level of treeStore
. Note that this function
only works with unsorted stores.
Since: 2.2