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.
-
Untyped pointer to the underlying
GtkTreeStoreinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
tree_store_ptrDefault implementationTyped pointer to the underlying
GtkTreeStoreinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkTreeStoreinstance.Declaration
Swift
var tree_store_ptr: UnsafeMutablePointer<GtkTreeStore>! { get } -
Required Initialiser for types conforming to
TreeStoreProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
append(iter:Extension methodparent: ) Appends a new row to
tree_store. Ifparentis non-nil, then it will append the new row after the last child ofparent, otherwise it will append a row to the top level.iterwill 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().Declaration
Swift
@inlinable func append<TreeIterT>(iter: TreeIterT, parent: TreeIterT?) where TreeIterT : TreeIterProtocol -
clear()Extension methodRemoves all rows from
tree_storeDeclaration
Swift
@inlinable func clear() -
insert(iter:Extension methodparent: position: ) Creates a new row at
position. If parent is non-nil, then the row will be made a child ofparent. Otherwise, the row will be created at the toplevel. Ifpositionis -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.iterwill 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().Declaration
Swift
@inlinable func insert<TreeIterT>(iter: TreeIterT, parent: TreeIterT?, position: Int) where TreeIterT : TreeIterProtocol -
insertAfter(iter:Extension methodparent: sibling: ) Inserts a new row after
sibling. Ifsiblingisnil, then the row will be prepended toparent’s children. Ifparentandsiblingarenil, then the row will be prepended to the toplevel. If bothsiblingandparentare set, thenparentmust be the parent ofsibling. Whensiblingis set,parentis optional.iterwill 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().Declaration
Swift
@inlinable func insertAfter<TreeIterT>(iter: TreeIterT, parent: TreeIterT?, sibling: TreeIterT?) where TreeIterT : TreeIterProtocol -
insertBefore(iter:Extension methodparent: sibling: ) Inserts a new row before
sibling. Ifsiblingisnil, then the row will be appended toparent’s children. Ifparentandsiblingarenil, then the row will be appended to the toplevel. If bothsiblingandparentare set, thenparentmust be the parent ofsibling. Whensiblingis set,parentis optional.iterwill 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().Declaration
Swift
@inlinable func insertBefore<TreeIterT>(iter: TreeIterT, parent: TreeIterT?, sibling: TreeIterT?) where TreeIterT : TreeIterProtocol -
insertWithValuesv(iter:Extension methodparent: position: columns: values: nValues: ) 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) -
insertWithValuesv(iter:Extension methodparent: position: columns: values: nValues: ) 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:Extension methoddescendant: ) Returns
trueifiteris an ancestor ofdescendant. That is,iteris the parent (or grandparent or great-grandparent) ofdescendant.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:Extension methodposition: ) Moves
iterintree_storeto the position afterposition.iterandpositionshould be in the same level. Note that this function only works with unsorted stores. Ifpositionisnil,iterwill be moved to the start of the level.Declaration
Swift
@inlinable func moveAfter<TreeIterT>(iter: TreeIterT, position: TreeIterT?) where TreeIterT : TreeIterProtocol -
moveBefore(iter:Extension methodposition: ) Moves
iterintree_storeto the position beforeposition.iterandpositionshould be in the same level. Note that this function only works with unsorted stores. Ifpositionisnil,iterwill be moved to the end of the level.Declaration
Swift
@inlinable func moveBefore<TreeIterT>(iter: TreeIterT, position: TreeIterT?) where TreeIterT : TreeIterProtocol -
prepend(iter:Extension methodparent: ) Prepends a new row to
tree_store. Ifparentis non-nil, then it will prepend the new row before the first child ofparent, otherwise it will prepend a row to the top level.iterwill 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().Declaration
Swift
@inlinable func prepend<TreeIterT>(iter: TreeIterT, parent: TreeIterT?) where TreeIterT : TreeIterProtocol -
remove(iter:Extension method) Removes
iterfromtree_store. After being removed,iteris 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:Extension methodnewOrder: ) Reorders the children of
parentintree_storeto follow the order indicated bynew_order. Note that this function only works with unsorted stores.Declaration
Swift
@inlinable func reorder(parent: TreeIterRef? = nil, newOrder: UnsafeMutablePointer<CInt>!) -
reorder(parent:Extension methodnewOrder: ) Reorders the children of
parentintree_storeto follow the order indicated bynew_order. Note that this function only works with unsorted stores.Declaration
Swift
@inlinable func reorder<TreeIterT>(parent: TreeIterT?, newOrder: UnsafeMutablePointer<CInt>!) where TreeIterT : TreeIterProtocol -
setColumnTypes(nColumns:Extension methodtypes: ) This function is meant primarily for
GObjectsthat inherit fromGtkTreeStore, and should only be used when constructing a newGtkTreeStore. It will not function after a row has been added, or a method on theGtkTreeModelinterface is called.Declaration
Swift
@inlinable func setColumnTypes(nColumns: Int, types: UnsafeMutablePointer<GType>!) -
setValist(iter:Extension methodvarArgs: ) 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:Extension methodcolumn: value: ) Sets the data in the cell specified by
iterandcolumn. The type ofvaluemust 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 -
setValuesv(iter:Extension methodcolumns: values: nValues: ) 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:Extension methodb: ) Swaps
aandbin the same level oftree_store. Note that this function only works with unsorted stores.Declaration
Swift
@inlinable func swap<TreeIterT>(a: TreeIterT, b: TreeIterT) where TreeIterT : TreeIterProtocol -
parentExtension methodUndocumented
Declaration
Swift
@inlinable var parent: GObject { get }
View on GitHub
Install in Dash
TreeStoreProtocol Protocol Reference