TreeStore

open class TreeStore : GLibObject.Object, TreeStoreProtocol

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 TreeStore type acts as a reference-counted owner of an underlying GtkTreeStore instance. It provides the methods that can operate on this data type through TreeStoreProtocol conformance. Use TreeStore as a strong reference or owner of a GtkTreeStore instance.

  • Designated initialiser from the underlying `C` data type.
    

    This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the TreeStore instance.

    Declaration

    Swift

    @inlinable
    public init(_ op: UnsafeMutablePointer<GtkTreeStore>)

    Parameters

    op

    pointer to the underlying object

  • Designated initialiser from a constant pointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the TreeStore instance.

    Declaration

    Swift

    @inlinable
    public init(_ op: UnsafePointer<GtkTreeStore>)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from a non-mutating gpointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the TreeStore instance.

    Declaration

    Swift

    @inlinable
    override public init!(gpointer op: gpointer?)

    Parameters

    op

    gpointer to the underlying object

  • Optional initialiser from a non-mutating gconstpointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the TreeStore instance.

    Declaration

    Swift

    @inlinable
    override public init!(gconstpointer op: gconstpointer?)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from a constant pointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the TreeStore instance.

    Declaration

    Swift

    @inlinable
    public init!(_ op: UnsafePointer<GtkTreeStore>?)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the TreeStore instance.

    Declaration

    Swift

    @inlinable
    public init!(_ op: UnsafeMutablePointer<GtkTreeStore>?)

    Parameters

    op

    pointer to the underlying object

  • Designated initialiser from the underlying C data type. Will retain GtkTreeStore. i.e., ownership is transferred to the TreeStore instance.

    Declaration

    Swift

    @inlinable
    public init(retaining op: UnsafeMutablePointer<GtkTreeStore>)

    Parameters

    op

    pointer to the underlying object

  • Reference intialiser for a related type that implements TreeStoreProtocol Will retain GtkTreeStore.

    Declaration

    Swift

    @inlinable
    public init<T>(treeStore other: T) where T : TreeStoreProtocol

    Parameters

    other

    an instance of a related type that implements TreeStoreProtocol

  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TreeStoreProtocol.

    Declaration

    Swift

    @inlinable
    override public init<T>(cPointer p: UnsafeMutablePointer<T>)

    Parameters

    cPointer

    pointer to the underlying object

  • Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TreeStoreProtocol.

    Declaration

    Swift

    @inlinable
    override public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)

    Parameters

    cPointer

    pointer to the underlying object

  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TreeStoreProtocol.

    Declaration

    Swift

    @inlinable
    override public init(raw p: UnsafeRawPointer)

    Parameters

    p

    raw pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TreeStoreProtocol.

    Declaration

    Swift

    @inlinable
    override public init(retainingRaw raw: UnsafeRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TreeStoreProtocol.

    Declaration

    Swift

    @inlinable
    public required init(raw p: UnsafeMutableRawPointer)

    Parameters

    p

    mutable raw pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TreeStoreProtocol.

    Declaration

    Swift

    @inlinable
    required public init(retainingRaw raw: UnsafeMutableRawPointer)

    Parameters

    raw

    mutable raw pointer to the underlying object

  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TreeStoreProtocol.

    Declaration

    Swift

    @inlinable
    override public init(opaquePointer p: OpaquePointer)

    Parameters

    p

    opaque pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to TreeStoreProtocol.

    Declaration

    Swift

    @inlinable
    override public init(retainingOpaquePointer p: OpaquePointer)

    Parameters

    p

    opaque pointer to the underlying object

  • Non vararg creation function. Used primarily by language bindings.

    Declaration

    Swift

    @inlinable
    public init(nColumns: Int, types: UnsafeMutablePointer<GType>!)
  • Non vararg creation function. Used primarily by language bindings.

    Declaration

    Swift

    @inlinable
    public static func treeStoreNewv(nColumns: Int, types: UnsafeMutablePointer<GType>!) -> TreeStore!
  • Return a tree model reference for the list store

    Declaration

    Swift

    @inlinable
    var treeModel: TreeModelRef { get }
  • Convenience constructor specifying the column types

    Declaration

    Swift

    @inlinable
    convenience init(types: [GType])

    Parameters

    types

    array of column types for this tree model

  • Convenience constructor specifying the column types

    Declaration

    Swift

    @inlinable
    convenience init(_ types: GType...)

    Parameters

    types

    column types for this tree model

  • Set the given values for the current row

    Declaration

    Swift

    @inlinable
    func set<I, V>(iter i: I, values: [V], startColumn: Int = 0) where I : TreeIterProtocol, V : ValueProtocol

    Parameters

    i

    iterator representing the current row

    values

    array of values to add

    startColumn

    column to start from (defaults to 0)

  • Append the given values to the next row

    Declaration

    Swift

    @inlinable
    func append<I, V>(asNextRow i: I, parent p: I? = nil, values v: [V], startColumn s: Int = 0) where I : TreeIterProtocol, V : ValueProtocol

    Parameters

    i

    iterator representing the current row (updated to next row)

    p

    parent iterator to append to

    v

    array of values to add

    startColumn

    column to start from (defaults to 0)

  • Append the given values to the next row

    Declaration

    Swift

    @inlinable
    func append<I>(asNextRow i: I, parent p: I? = nil, startColumn s: Int = 0, _ values: Value...) where I : TreeIterProtocol

    Parameters

    i

    tree iterator representing the current row (updated to next row)

    p

    parent iterator to append to

    values

    array of values to add

    startColumn

    column to start from (defaults to 0)