gi-gtk-3.0.24: Gtk bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.TreeStore

Contents

Description

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

Synopsis

Exported types

newtype TreeStore Source #

Memory-managed wrapper type.

class GObject o => IsTreeStore o Source #

Type class for types which can be safely cast to TreeStore, for instance with toTreeStore.

Instances
(GObject a, (UnknownAncestorError TreeStore a :: Constraint)) => IsTreeStore a Source # 
Instance details

Defined in GI.Gtk.Objects.TreeStore

IsTreeStore TreeStore Source # 
Instance details

Defined in GI.Gtk.Objects.TreeStore

toTreeStore :: (MonadIO m, IsTreeStore o) => o -> m TreeStore Source #

Cast to TreeStore, for types for which this is known to be safe. For general casts, use castTo.

noTreeStore :: Maybe TreeStore Source #

A convenience alias for Nothing :: Maybe TreeStore.

Methods

append

treeStoreAppend Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeStore a) 
=> a

treeStore: A TreeStore

-> Maybe TreeIter

parent: A valid TreeIter, or Nothing

-> 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

treeStoreClear Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeStore a) 
=> a

treeStore: a TreeStore

-> m () 

Removes all rows from treeStore

insert

treeStoreInsert Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeStore a) 
=> a

treeStore: A TreeStore

-> Maybe TreeIter

parent: A valid TreeIter, or Nothing

-> Int32

position: position to insert the new row, or -1 for last

-> 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

treeStoreInsertAfter Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeStore a) 
=> a

treeStore: A TreeStore

-> Maybe TreeIter

parent: A valid TreeIter, or Nothing

-> Maybe TreeIter

sibling: A valid TreeIter, or Nothing

-> 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

treeStoreInsertBefore Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeStore a) 
=> a

treeStore: A TreeStore

-> Maybe TreeIter

parent: A valid TreeIter, or Nothing

-> Maybe TreeIter

sibling: A valid TreeIter, or Nothing

-> 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

treeStoreInsertWithValues Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeStore a) 
=> a

treeStore: A TreeStore

-> Maybe TreeIter

parent: A valid TreeIter, or Nothing

-> Int32

position: position to insert the new row, or -1 for last

-> [Int32]

columns: an array of column numbers

-> [GValue]

values: an array of GValues

-> 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

treeStoreIsAncestor Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeStore a) 
=> a

treeStore: A TreeStore

-> TreeIter

iter: A valid TreeIter

-> TreeIter

descendant: A valid TreeIter

-> m Bool

Returns: True, if iter is an ancestor of descendant

Returns True if iter is an ancestor of descendant. That is, iter is the parent (or grandparent or great-grandparent) of descendant.

iterDepth

treeStoreIterDepth Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeStore a) 
=> a

treeStore: A TreeStore

-> TreeIter

iter: A valid TreeIter

-> m Int32

Returns: The depth of iter

Returns the depth of iter. This will be 0 for anything on the root level, 1 for anything down a level, etc.

iterIsValid

treeStoreIterIsValid Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeStore a) 
=> a

treeStore: A TreeStore.

-> TreeIter

iter: A TreeIter.

-> m Bool

Returns: True if the iter is valid, False if the iter is invalid.

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

treeStoreMoveAfter Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeStore a) 
=> a

treeStore: A TreeStore.

-> TreeIter

iter: A TreeIter.

-> Maybe TreeIter

position: A 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

treeStoreMoveBefore Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeStore a) 
=> a

treeStore: A TreeStore.

-> TreeIter

iter: A TreeIter.

-> Maybe TreeIter

position: A TreeIter or Nothing.

-> 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

treeStoreNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [GType]

types: an array of GType types for the columns, from first to last

-> m TreeStore

Returns: a new TreeStore

Non vararg creation function. Used primarily by language bindings.

prepend

treeStorePrepend Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeStore a) 
=> a

treeStore: A TreeStore

-> Maybe TreeIter

parent: A valid TreeIter, or Nothing

-> 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

treeStoreRemove Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeStore a) 
=> a

treeStore: A TreeStore

-> TreeIter

iter: A valid TreeIter

-> m Bool

Returns: True if iter is still valid, False if not.

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

treeStoreSet Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeStore a) 
=> a

treeStore: A TreeStore

-> TreeIter

iter: A valid TreeIter for the row being modified

-> [Int32]

columns: an array of column numbers

-> [GValue]

values: an array of GValues

-> 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

treeStoreSetColumnTypes Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeStore a) 
=> a

treeStore: A TreeStore

-> [GType]

types: An array of GType types, one for each column

-> m () 

This function is meant primarily for GObjects that inherit from TreeStore, and should only be used when constructing a new TreeStore. It will not function after a row has been added, or a method on the TreeModel interface is called.

setValue

treeStoreSetValue Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeStore a) 
=> a

treeStore: a TreeStore

-> TreeIter

iter: A valid TreeIter for the row being modified

-> Int32

column: column number to modify

-> GValue

value: new value for the cell

-> 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

treeStoreSwap Source #

Arguments

:: (HasCallStack, MonadIO m, IsTreeStore a) 
=> a

treeStore: A TreeStore.

-> TreeIter

a: A TreeIter.

-> TreeIter

b: Another TreeIter.

-> m () 

Swaps a and b in the same level of treeStore. Note that this function only works with unsorted stores.

Since: 2.2