TreeStoreProtocol
public protocol TreeStoreProtocol : ObjectProtocol, BuildableProtocol, TreeDragDestProtocol, TreeDragSourceProtocol, TreeSortableProtocol
The GtkTreeStore
object is a list model for use with a GtkTreeView
widget. It implements the GtkTreeModel
interface, and consequentially,
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
GtkTreeStore
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
tree_store_ptr
Default implementationTyped 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)
-
append(iter:
Extension methodparent: ) Appends a new row to
tree_store
. Ifparent
is non-nil
, then it will append the new row after the last child ofparent
, 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 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_store
Declaration
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. Ifposition
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 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
. Ifsibling
isnil
, then the row will be prepended toparent
’s children. Ifparent
andsibling
arenil
, then the row will be prepended to the toplevel. If bothsibling
andparent
are set, thenparent
must be the parent ofsibling
. Whensibling
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 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
. Ifsibling
isnil
, then the row will be appended toparent
’s children. Ifparent
andsibling
arenil
, then the row will be appended to the toplevel. If bothsibling
andparent
are set, thenparent
must be the parent ofsibling
. Whensibling
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 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<gint>!, 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<gint>!, values: UnsafeMutablePointer<GValue>!, nValues: Int) where TreeIterT : TreeIterProtocol
-
isAncestor(iter:
Extension methoddescendant: ) Returns
true
ifiter
is an ancestor ofdescendant
. That is,iter
is 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) WARNING: This function is slow. Only use it for debugging and/or testing purposes.
Checks if the given iter is a valid iter for this
GtkTreeStore
.Declaration
Swift
@inlinable func iterIsValid<TreeIterT>(iter: TreeIterT) -> Bool where TreeIterT : TreeIterProtocol
-
moveAfter(iter:
Extension methodposition: ) Moves
iter
intree_store
to the position afterposition
.iter
andposition
should be in the same level. Note that this function only works with unsorted stores. Ifposition
isnil
,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:
Extension methodposition: ) Moves
iter
intree_store
to the position beforeposition
.iter
andposition
should be in the same level. Note that this function only works with unsorted stores. Ifposition
isnil
,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:
Extension methodparent: ) Prepends a new row to
tree_store
. Ifparent
is non-nil
, then it will prepend the new row before the first child ofparent
, 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 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
iter
fromtree_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:
Extension methodnewOrder: ) Reorders the children of
parent
intree_store
to 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<gint>!)
-
reorder(parent:
Extension methodnewOrder: ) Reorders the children of
parent
intree_store
to 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<gint>!) where TreeIterT : TreeIterProtocol
-
setColumnTypes(nColumns:
Extension methodtypes: ) This function is meant primarily for
GObjects
that 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 theGtkTreeModel
interface 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
iter
andcolumn
. The type ofvalue
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
-
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<gint>!, values: UnsafeMutablePointer<GValue>!, nValues: Int) where TreeIterT : TreeIterProtocol
-
swap(a:
Extension methodb: ) Swaps
a
andb
in 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
-
parent
Extension methodUndocumented
Declaration
Swift
@inlinable var parent: GObject { get }