Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: TreeStore

[27:7] extends: object

A tree-like data structure that can be used with the [class@Gtk.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>

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • TreeStore (Handle = null)

    Creates a new TreeStore by wrapping a native handle or another wrapper.

    • @p Handle is the native handle or another wrapper whose handle to adopt.
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asObject ()

    Wraps this handle as Object.

    • @r A Object object.
  • asBuildable ()

    Wraps this handle as Buildable.

    • @r A Buildable object.
  • asTreeDragDest ()

    Wraps this handle as TreeDragDest.

    • @r A TreeDragDest object.
  • asTreeDragSource ()

    Wraps this handle as TreeDragSource.

    • @r A TreeDragSource object.
  • asTreeModel ()

    Wraps this handle as TreeModel.

    • @r A TreeModel object.
  • asTreeSortable ()

    Wraps this handle as TreeSortable.

    • @r A TreeSortable object.
  • clear ()

    Removes all rows from @tree_store

    • @r None.
  • is_ancestor (iter, descendant)

    Checks if @iter is an ancestor of @descendant.

    • @p iter is A valid GtkTreeIter.
    • @p descendant is A valid GtkTreeIter.
  • iter_depth (iter)

    Returns the depth of the position pointed by the iterator The depth will be 0 for anything on the root level, 1 for anything down a level, etc.

    • @p iter is A valid GtkTreeIter.
  • iter_is_valid (iter)

    Checks if the given iter is a valid iter for this GtkTreeStore. This function is slow. Only use it for debugging and/or testing purposes.

    • @p iter is the iterator to check.
  • move_after (iter, position)

    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 %NULL, @iter will be moved to the start of the level.
    • @p iter is A GtkTreeIter..
    • @p position is A GtkTreeIter..
    • @r None.
  • move_before (iter, position)

    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 %NULL, @iter will be moved to the end of the level.
    • @p iter is A GtkTreeIter.
    • @p position is A GtkTreeIter.
    • @r None.
  • remove (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.

    • @p iter is A valid GtkTreeIter.
  • reorder (parent, list new_order)

    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.

    • @p parent is the parent of the children to re-order.
    • @p new_order is 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.
    • @r None.
  • set_value (iter, int column, object value)

    Sets the data in the cell specified by @iter and @column. The type of

    • @value must be convertible to the type of the column.
    • @p iter is A valid GtkTreeIter for the row being modified.
    • @p column is column number to modify.
    • @p value is new value for the cell.
    • @r None.
  • swap (a, b)

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

    • @p a is A GtkTreeIter..
    • @p b is Another GtkTreeIter..
    • @r None.