gtk.tree_store

Module for [TreeStore] class

Types 3

A tree-like data structure that can be used with the [gtk.tree_view.TreeView].

The [gtk.tree_store.TreeStore] object is a list model for use with a [gtk.tree_view.TreeView] widget. It implements the [gtk.tree_model.TreeModel] interface, and consequently, can use all of the methods available there. It also implements the [gtk.tree_sortable.TreeSortable] interface so it can be sorted by the view. Finally, it also implements the tree [drag][gtk.tree_drag_source.TreeDragSource] and [drop][gtk.tree_drag_dest.TreeDragDest] interfaces.

[gtk.tree_store.TreeStore] is deprecated since GTK 4.10, and should not be used in newly written code. You should use [gtk.tree_list_model.TreeListModel] for a tree-like model object.

GtkTreeStore as GtkBuildable

The GtkTreeStore implementation of the [gtk.buildable.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:

<object class="GtkTreeStore">
 <columns>
   <column type="gchararray"/>
   <column type="gchararray"/>
   <column type="gint"/>
 </columns>
</object>

Deprecated

Use [gtk.tree_list_model.TreeListModel] instead
Methods
GType _gType() @property
TreeStore self()Returns `this`, for use in `with` statements.
TreeStoreGidBuilder builder()Get builder for [gtk.tree_store.TreeStore] Returns: New builder object
gtk.tree_store.TreeStore new_(gobject.types.GType[] types)Creates a new tree store.
void append(out gtk.tree_iter.TreeIter iter, gtk.tree_iter.TreeIter parent = null)Appends a new row to tree_store.
void clear()Removes all rows from tree_store
void insert(out gtk.tree_iter.TreeIter iter, gtk.tree_iter.TreeIter parent, int position)Creates a new row at position.
void insertAfter(out gtk.tree_iter.TreeIter iter, gtk.tree_iter.TreeIter parent = null, gtk.tree_iter.TreeIter sibling = null)Inserts a new row after sibling.
void insertBefore(out gtk.tree_iter.TreeIter iter, gtk.tree_iter.TreeIter parent = null, gtk.tree_iter.TreeIter sibling = null)Inserts a new row before sibling.
void insertWithValues(out gtk.tree_iter.TreeIter iter, gtk.tree_iter.TreeIter parent, int position, int[] columns, gobject.value.Value[] values)A variant of [gtk.tree_store.TreeStore.insertWithValues] which takes the columns and values as two arrays, instead of varargs.
bool isAncestor(gtk.tree_iter.TreeIter iter, gtk.tree_iter.TreeIter descendant)Checks if iter is an ancestor of descendant.
int iterDepth(gtk.tree_iter.TreeIter iter)Returns the depth of the position pointed by the iterator
bool iterIsValid(gtk.tree_iter.TreeIter iter)Checks if the given iter is a valid iter for this [gtk.tree_store.TreeStore].
void moveAfter(gtk.tree_iter.TreeIter iter, gtk.tree_iter.TreeIter position = null)Moves iter in tree_store to the position after position.
void moveBefore(gtk.tree_iter.TreeIter iter, gtk.tree_iter.TreeIter position = null)Moves iter in tree_store to the position before position.
void prepend(out gtk.tree_iter.TreeIter iter, gtk.tree_iter.TreeIter parent = null)Prepends a new row to tree_store.
bool remove(gtk.tree_iter.TreeIter iter)Removes iter from tree_store.
void setColumnTypes(gobject.types.GType[] types)Sets the type of the columns in a tree store.
void setValue(gtk.tree_iter.TreeIter iter, int column, gobject.value.Value value)Sets the data in the cell specified by iter and column.
void set(gtk.tree_iter.TreeIter iter, int[] columns, gobject.value.Value[] values)A variant of [gtk.tree_store.TreeStore.setValist] which takes the columns and values as two arrays, instead of using variadic arguments.
void swap(gtk.tree_iter.TreeIter a, gtk.tree_iter.TreeIter b)Swaps `a` and `b` in the same level of tree_store.
Constructors
this(void * ptr, Flag!"Take" take)

Fluent builder for [gtk.tree_store.TreeStore]

Methods