TreeStoreProtocol

public protocol TreeStoreProtocol : ObjectProtocol, BuildableProtocol, TreeDragDestProtocol, TreeDragSourceProtocol, TreeSortableProtocol

A tree-like data structure that can be used with the GtkTreeView

The GtkTreeStore object is a list model for use with a GtkTreeView widget. It implements the GtkTreeModel interface, and consequently, can use all of the methods available there. It also implements the GtkTreeSortable interface so it can be sorted by the view. Finally, it also implements the tree drag and drop interfaces.

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:

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

The TreeStoreProtocol protocol exposes the methods and properties of an underlying GtkTreeStore instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see TreeStore. Alternatively, use TreeStoreRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying GtkTreeStore instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • tree_store_ptr Default implementation

    Typed pointer to the underlying GtkTreeStore instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GtkTreeStore instance.

    Declaration

    Swift

    var tree_store_ptr: UnsafeMutablePointer<GtkTreeStore>! { get }
  • Required Initialiser for types conforming to TreeStoreProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

TreeStore Class: TreeStoreProtocol extension (methods and fields)

  • append(iter:parent:) Extension method

    Appends a new row to tree_store. If parent is non-nil, 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 gtk_tree_store_set_value().

    Declaration

    Swift

    @inlinable
    func append<TreeIterT>(iter: TreeIterT, parent: TreeIterT?) where TreeIterT : TreeIterProtocol
  • clear() Extension method

    Removes all rows from tree_store

    Declaration

    Swift

    @inlinable
    func clear()
  • Creates a new row at position. If parent is non-nil, 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 gtk_tree_store_set_value().

    Declaration

    Swift

    @inlinable
    func insert<TreeIterT>(iter: TreeIterT, parent: TreeIterT?, position: Int) where TreeIterT : TreeIterProtocol
  • Inserts a new row after sibling. If sibling is nil, then the row will be prepended to parent ’s children. If parent and sibling are nil, 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 gtk_tree_store_set_value().

    Declaration

    Swift

    @inlinable
    func insertAfter<TreeIterT>(iter: TreeIterT, parent: TreeIterT?, sibling: TreeIterT?) where TreeIterT : TreeIterProtocol
  • Inserts a new row before sibling. If sibling is nil, then the row will be appended to parent ’s children. If parent and sibling are nil, 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 gtk_tree_store_set_value().

    Declaration

    Swift

    @inlinable
    func insertBefore<TreeIterT>(iter: TreeIterT, parent: TreeIterT?, sibling: TreeIterT?) where TreeIterT : TreeIterProtocol
  • 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.

    Declaration

    Swift

    @inlinable
    func insertWithValuesv(iter: TreeIterRef? = nil, parent: TreeIterRef? = nil, position: Int, columns: UnsafeMutablePointer<CInt>!, values: UnsafeMutablePointer<GValue>!, nValues: Int)
  • 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.

    Declaration

    Swift

    @inlinable
    func insertWithValuesv<TreeIterT>(iter: TreeIterT?, parent: TreeIterT?, position: Int, columns: UnsafeMutablePointer<CInt>!, values: UnsafeMutablePointer<GValue>!, nValues: Int) where TreeIterT : TreeIterProtocol
  • isAncestor(iter:descendant:) Extension method

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

    Declaration

    Swift

    @inlinable
    func isAncestor<TreeIterT>(iter: TreeIterT, descendant: TreeIterT) -> Bool where TreeIterT : TreeIterProtocol
  • iterDepth(iter:) Extension method

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

    Declaration

    Swift

    @inlinable
    func iterDepth<TreeIterT>(iter: TreeIterT) -> Int where TreeIterT : TreeIterProtocol
  • iterIsValid(iter:) Extension method

    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.

    Declaration

    Swift

    @inlinable
    func iterIsValid<TreeIterT>(iter: TreeIterT) -> Bool where TreeIterT : TreeIterProtocol
  • moveAfter(iter:position:) Extension method

    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 nil, iter will be moved to the start of the level.

    Declaration

    Swift

    @inlinable
    func moveAfter<TreeIterT>(iter: TreeIterT, position: TreeIterT?) where TreeIterT : TreeIterProtocol
  • moveBefore(iter:position:) Extension method

    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 nil, iter will be moved to the end of the level.

    Declaration

    Swift

    @inlinable
    func moveBefore<TreeIterT>(iter: TreeIterT, position: TreeIterT?) where TreeIterT : TreeIterProtocol
  • prepend(iter:parent:) Extension method

    Prepends a new row to tree_store. If parent is non-nil, 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 gtk_tree_store_set_value().

    Declaration

    Swift

    @inlinable
    func prepend<TreeIterT>(iter: TreeIterT, parent: TreeIterT?) where TreeIterT : TreeIterProtocol
  • remove(iter:) Extension method

    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.

    Declaration

    Swift

    @inlinable
    func remove<TreeIterT>(iter: TreeIterT) -> Bool where TreeIterT : TreeIterProtocol
  • reorder(parent:newOrder:) Extension method

    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.

    Declaration

    Swift

    @inlinable
    func reorder(parent: TreeIterRef? = nil, newOrder: UnsafeMutablePointer<CInt>!)
  • reorder(parent:newOrder:) Extension method

    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.

    Declaration

    Swift

    @inlinable
    func reorder<TreeIterT>(parent: TreeIterT?, newOrder: UnsafeMutablePointer<CInt>!) where TreeIterT : TreeIterProtocol
  • This function is meant primarily for GObjects that inherit from GtkTreeStore, and should only be used when constructing a new GtkTreeStore. It will not function after a row has been added, or a method on the GtkTreeModel interface is called.

    Declaration

    Swift

    @inlinable
    func setColumnTypes(nColumns: Int, types: UnsafeMutablePointer<GType>!)
  • setValist(iter:varArgs:) Extension method

    See gtk_tree_store_set(); this version takes a va_list for use by language bindings.

    Declaration

    Swift

    @inlinable
    func setValist<TreeIterT>(iter: TreeIterT, varArgs: CVaListPointer) where TreeIterT : TreeIterProtocol
  • setValue(iter:column:value:) Extension method

    Sets the data in the cell specified by iter and column. The type of value must be convertible to the type of the column.

    Declaration

    Swift

    @inlinable
    func setValue<TreeIterT, ValueT>(iter: TreeIterT, column: Int, value: ValueT) where TreeIterT : TreeIterProtocol, ValueT : ValueProtocol
  • 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.

    Declaration

    Swift

    @inlinable
    func setValuesv<TreeIterT>(iter: TreeIterT, columns: UnsafeMutablePointer<CInt>!, values: UnsafeMutablePointer<GValue>!, nValues: Int) where TreeIterT : TreeIterProtocol
  • swap(a:b:) Extension method

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

    Declaration

    Swift

    @inlinable
    func swap<TreeIterT>(a: TreeIterT, b: TreeIterT) where TreeIterT : TreeIterProtocol
  • parent Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var parent: GObject { get }