A tree-like data structure that can be used with the
The <gtk-tree-store>
object is a list model for use with a
<gtk-tree-view>
widget. It implements the <gtk-tree-model>
interface, and consequentialy, can use all of the methods available there. It
also implements the <gtk-tree-sortable>
interface so it can be sorted by
the view. Finally, it also implements the tree drag and drop interfaces.
Derives from
<gtk-tree-model>
,<gtk-tree-sortable>
,<gtk-buildable>
,<gtk-tree-drag-dest>
,<gtk-tree-drag-source>
,<gobject>
.This class defines no direct slots.
scm
) ⇒ (ret <gtk-tree-store>
)Creates a new tree store as with n-columns columns each of the types passed in. Note that only types derived from standard GObject fundamental types are supported.
As an example, ‘gtk_tree_store_new (3, G_TYPE_INT, G_TYPE_STRING, GDK_TYPE_PIXBUF);’ will create a new
<gtk-tree-store>
with three columns, of type<int>
,<string>
and<gdk-pixbuf>
respectively.
- n-columns
- number of columns in the tree store
- ...
- all
<g-type>
types for the columns, from first to last- ret
- a new
<gtk-tree-store>
<gtk-tree-store>
) (iter <gtk-tree-iter>
) (column int
) (value scm
)Sets the data in the cell specified by iter and column. The type of value must be convertible to the type of the column.
- tree-store
- a
<gtk-tree-store>
- iter
- A valid
<gtk-tree-iter>
for the row being modified- column
- column number to modify
- value
- new value for the cell
<gtk-tree-store>
) (iter <gtk-tree-iter>
) ⇒ (ret <gtk-tree-iter>
)Removes iter from tree-store. After being removed, iter is set to the next valid row at that level, or invalidated if it previously pointed to the last one.
- tree-store
- A
<gtk-tree-store>
- iter
- A valid
<gtk-tree-iter>
- ret
- ‘
#t
’ if iter is still valid, ‘#f
’ if not.
<gtk-tree-store>
) (parent <gtk-tree-iter>
) (position int
) ⇒ (ret <gtk-tree-iter>
)Creates a new row at position. If parent is non-‘
#f
’, then the row will be made a child of parent. Otherwise, the row will be created at the toplevel. If position 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 callgtk-tree-store-set
orgtk-tree-store-set-value
.
- tree-store
- A
<gtk-tree-store>
- iter
- An unset
<gtk-tree-iter>
to set to the new row- parent
- A valid
<gtk-tree-iter>
, or ‘#f
’- position
- position to insert the new row
<gtk-tree-store>
) (parent <gtk-tree-iter>
) (sibling <gtk-tree-iter>
) ⇒ (ret <gtk-tree-iter>
)Inserts a new row before sibling. If sibling is ‘
#f
’, then the row will be appended to parent 's children. If parent and sibling are ‘#f
’, 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
orgtk-tree-store-set-value
.
- tree-store
- A
<gtk-tree-store>
- iter
- An unset
<gtk-tree-iter>
to set to the new row- parent
- A valid
<gtk-tree-iter>
, or ‘#f
’- sibling
- A valid
<gtk-tree-iter>
, or ‘#f
’
<gtk-tree-store>
) (parent <gtk-tree-iter>
) (sibling <gtk-tree-iter>
) ⇒ (ret <gtk-tree-iter>
)Inserts a new row after sibling. If sibling is ‘
#f
’, then the row will be prepended to parent 's children. If parent and sibling are ‘#f
’, 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
orgtk-tree-store-set-value
.
- tree-store
- A
<gtk-tree-store>
- iter
- An unset
<gtk-tree-iter>
to set to the new row- parent
- A valid
<gtk-tree-iter>
, or ‘#f
’- sibling
- A valid
<gtk-tree-iter>
, or ‘#f
’
<gtk-tree-store>
) (parent <gtk-tree-iter>
) ⇒ (ret <gtk-tree-iter>
)Prepends a new row to tree-store. If parent is non-‘
#f
’, 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 callgtk-tree-store-set
orgtk-tree-store-set-value
.
- tree-store
- A
<gtk-tree-store>
- iter
- An unset
<gtk-tree-iter>
to set to the prepended row- parent
- A valid
<gtk-tree-iter>
, or ‘#f
’
<gtk-tree-store>
) (parent <gtk-tree-iter>
) ⇒ (ret <gtk-tree-iter>
)Appends a new row to tree-store. If parent is non-‘
#f
’, 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 callgtk-tree-store-set
orgtk-tree-store-set-value
.
- tree-store
- A
<gtk-tree-store>
- iter
- An unset
<gtk-tree-iter>
to set to the appended row- parent
- A valid
<gtk-tree-iter>
, or ‘#f
’
<gtk-tree-store>
) (iter <gtk-tree-iter>
) (descendant <gtk-tree-iter>
) ⇒ (ret bool
)Returns ‘
#t
’ if iter is an ancestor of descendant. That is, iter is the parent (or grandparent or great-grandparent) of descendant.
- tree-store
- A
<gtk-tree-store>
- iter
- A valid
<gtk-tree-iter>
- descendant
- A valid
<gtk-tree-iter>
- ret
- ‘
#t
’, if iter is an ancestor of descendant
<gtk-tree-store>
) (iter <gtk-tree-iter>
) ⇒ (ret int
)Returns the depth of iter. This will be 0 for anything on the root level, 1 for anything down a level, etc.
- tree-store
- A
<gtk-tree-store>
- iter
- A valid
<gtk-tree-iter>
- ret
- The depth of iter
<gtk-tree-store>
)Removes all rows from tree-store
- tree-store
- a
<gtk-tree-store>
<gtk-tree-store>
) (iter <gtk-tree-iter>
) ⇒ (ret bool
)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
<gtk-tree-store>
.
- tree-store
- A
<gtk-tree-store>
.- iter
- A
<gtk-tree-iter>
.- ret
- ‘
#t
’ if the iter is valid, ‘#f
’ if the iter is invalid.Since 2.2
<gtk-tree-store>
) (parent <gtk-tree-iter>
) ⇒ (new_order int
)Reorders the children of parent in tree-store to follow the order indicated by new-order. Note that this function only works with unsorted stores.
- tree-store
- A
<gtk-tree-store>
.- parent
- A
<gtk-tree-iter>
.- new-order
- an array of integers mapping the new position of each child to its old position before the re-ordering, i.e. new-order‘[newpos] = oldpos’.
Since 2.2
<gtk-tree-store>
) (a <gtk-tree-iter>
) (b <gtk-tree-iter>
)Swaps a and b in the same level of tree-store. Note that this function only works with unsorted stores.
- tree-store
- A
<gtk-tree-store>
.- a
- A
<gtk-tree-iter>
.- b
- Another
<gtk-tree-iter>
.Since 2.2
<gtk-tree-store>
) (iter <gtk-tree-iter>
) (position <gtk-tree-iter>
)Moves iter in tree-store 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 ‘
#f
’, iter will be moved to the end of the level.
- tree-store
- A
<gtk-tree-store>
.- iter
- A
<gtk-tree-iter>
.- position
- A
<gtk-tree-iter>
or ‘#f
’.Since 2.2
<gtk-tree-store>
) (iter <gtk-tree-iter>
) (position <gtk-tree-iter>
)Moves iter in tree-store 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 ‘
#f
’, iter will be moved to the start of the level.
- tree-store
- A
<gtk-tree-store>
.- iter
- A
<gtk-tree-iter>
.- position
- A
<gtk-tree-iter>
.Since 2.2