TreeStore
Object Hierarchy:
Description:
A tree-like data structure that can be used with the [class@Gtk.
Note:
Use [class@Gtk.TreeListModel] instead
TreeView].
The `GtkTreeStore` object is a list model for use with a `GtkTreeView` widget. It implements the [iface@Gtk.TreeModel] interface, and
consequently, can use all of the methods available there. It also implements the [iface@Gtk.TreeSortable] interface so it can be sorted by
the view. Finally, it also implements the tree [drag][iface@Gtk.TreeDragSource] and [drop][iface@Gtk.TreeDragDest] interfaces.
`GtkTreeStore` is deprecated since GTK 4.10, and should not be used in newly written code. You should use [class@Gtk.TreeListModel] for a
tree-like model object.
GtkTreeStore as GtkBuildable
The GtkTreeStore implementation of the `GtkBuildable` 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:
```xml <object class="GtkTreeStore"> <columns> <column type="gchararray"/> <column type="gchararray"/> <
column type="gint"/> </columns> </object> ```
Content:
Creation methods:
Methods:
- public void @set (TreeIter iter, ...)
Sets the value of one or more cells in the row referenced by
iter.
- public void append (out TreeIter iter, TreeIter? parent)
Appends a new row to this.
- public void clear ()
Removes all rows from this
- public void insert (out TreeIter iter, TreeIter? parent, int position)
Creates a new row at position.
- public void insert_after (out TreeIter iter, TreeIter? parent, TreeIter? sibling)
Inserts a new row after sibling.
- public void insert_before (out TreeIter iter, TreeIter? parent, TreeIter? sibling)
Inserts a new row before sibling.
- public void insert_with_values (out TreeIter iter, TreeIter? parent, int position, ...)
Creates a new row at the given position.
- public void insert_with_valuesv (out TreeIter iter, TreeIter? parent, int position, int[] columns, Value[] values)
A variant of
insert_with_values which takes the columns and values as two
arrays, instead of varargs.
- public bool is_ancestor (TreeIter iter, TreeIter descendant)
Checks if iter is an ancestor of descendant.
- public int iter_depth (TreeIter iter)
Returns the depth of the position pointed by the iterator
- public bool iter_is_valid (TreeIter iter)
Checks if the given iter is a valid iter for this `GtkTreeStore`.
- public void move_after (ref TreeIter iter, TreeIter? position)
Moves iter in this to
the position after position.
- public void move_before (ref TreeIter iter, TreeIter? position)
Moves iter in this to
the position before position.
- public void prepend (out TreeIter iter, TreeIter? parent)
Prepends a new row to this.
- public bool remove (ref TreeIter iter)
Removes iter from this.
- public void reorder (TreeIter? parent, int new_order)
Reorders the children of parent in
this to follow the order indicated by new_order.
- public void set_column_types (Type[] types)
Sets the type of the columns in a tree store.
- public void set_valist (TreeIter iter, void* var_args)
A version of @set
using `va_list`.
- public void set_value (TreeIter iter, int column, Value value)
Sets the data in the cell specified by iter and
column.
- public void set_valuesv (TreeIter iter, int columns, Value[] values)
A variant of
set_valist which takes the columns and values as two arrays, instead of using variadic arguments.
- public void swap (TreeIter a, TreeIter b)
Swaps a and b in the same level of
this.
Fields:
Inherited Members:
All known members inherited from class GLib.Object
All known members inherited from interface Gtk.TreeModel
All known members inherited from interface Gtk.TreeDragSource
All known members inherited from interface Gtk.TreeDragDest
All known members inherited from interface Gtk.TreeSortable
All known members inherited from interface Gtk.Buildable