TreeView
open class TreeView : Container, TreeViewProtocol
Widget that displays any object that implements the GtkTreeModel interface.
Please refer to the tree widget conceptual overview for an overview of all the objects and data types related to the tree widget and how they work together.
Several different coordinate systems are exposed in the GtkTreeView API. These are:

Coordinate systems in GtkTreeView API:
Widget coordinates: Coordinates relative to the widget (usually
widget->window).Bin window coordinates: Coordinates relative to the window that GtkTreeView renders to.
Tree coordinates: Coordinates relative to the entire scrollable area of GtkTreeView. These coordinates start at (0, 0) for row 0 of the tree.
Several functions are available for converting between the different
coordinate systems. The most common translations are between widget and bin
window coordinates and between bin window and tree coordinates. For the
former you can use gtk_tree_view_convert_widget_to_bin_window_coords()
(and vice versa), for the latter gtk_tree_view_convert_bin_window_to_tree_coords()
(and vice versa).
GtkTreeView as GtkBuildable
The GtkTreeView implementation of the GtkBuildable interface accepts
GtkTreeViewColumn objects as <child> elements and exposes the internal
GtkTreeSelection in UI definitions.
An example of a UI definition fragment with GtkTreeView:
<object class="GtkTreeView" id="treeview">
<property name="model">liststore1</property>
<child>
<object class="GtkTreeViewColumn" id="test-column">
<property name="title">Test</property>
<child>
<object class="GtkCellRendererText" id="test-renderer"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
<child internal-child="selection">
<object class="GtkTreeSelection" id="selection">
<signal name="changed" handler="on_treeview_selection_changed"/>
</object>
</child>
</object>
CSS nodes
(plain Language Example):
treeview.view
├── header
│ ├── <column header>
┊ ┊
│ ╰── <column header>
│
╰── [rubberband]
GtkTreeView has a main CSS node with name treeview and style class .view. It has a subnode with name header, which is the parent for all the column header widgets’ CSS nodes. For rubberband selection, a subnode with name rubberband is used.
The TreeView type acts as a reference-counted owner of an underlying GtkTreeView instance.
It provides the methods that can operate on this data type through TreeViewProtocol conformance.
Use TreeView as a strong reference or owner of a GtkTreeView 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
TreeViewinstance.Declaration
Swift
@inlinable public init(_ op: UnsafeMutablePointer<GtkTreeView>)Parameters
oppointer to the underlying object
-
Designated initialiser from a constant pointer to the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theTreeViewinstance.Declaration
Swift
@inlinable public init(_ op: UnsafePointer<GtkTreeView>)Parameters
oppointer to the underlying object
-
Optional initialiser from a non-mutating
gpointerto the underlyingCdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theTreeViewinstance.Declaration
Swift
@inlinable override public init!(gpointer op: gpointer?)Parameters
opgpointer to the underlying object
-
Optional initialiser from a non-mutating
gconstpointerto the underlyingCdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theTreeViewinstance.Declaration
Swift
@inlinable override public init!(gconstpointer op: gconstpointer?)Parameters
oppointer to the underlying object
-
Optional initialiser from a constant pointer to the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theTreeViewinstance.Declaration
Swift
@inlinable public init!(_ op: UnsafePointer<GtkTreeView>?)Parameters
oppointer to the underlying object
-
Optional initialiser from the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theTreeViewinstance.Declaration
Swift
@inlinable public init!(_ op: UnsafeMutablePointer<GtkTreeView>?)Parameters
oppointer to the underlying object
-
Designated initialiser from the underlying
Cdata type. Will retainGtkTreeView. i.e., ownership is transferred to theTreeViewinstance.Declaration
Swift
@inlinable public init(retaining op: UnsafeMutablePointer<GtkTreeView>)Parameters
oppointer to the underlying object
-
Reference intialiser for a related type that implements
TreeViewProtocolWill retainGtkTreeView.Declaration
Swift
@inlinable public init<T>(treeView other: T) where T : TreeViewProtocolParameters
otheran instance of a related type that implements
TreeViewProtocol -
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
TreeViewProtocol.Declaration
Swift
@inlinable override public init<T>(cPointer p: UnsafeMutablePointer<T>)Parameters
cPointerpointer to the underlying object
-
Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
TreeViewProtocol.Declaration
Swift
@inlinable override public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)Parameters
cPointerpointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
TreeViewProtocol.Declaration
Swift
@inlinable override public init(raw p: UnsafeRawPointer)Parameters
praw 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
TreeViewProtocol.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
TreeViewProtocol.Declaration
Swift
@inlinable public required init(raw p: UnsafeMutableRawPointer)Parameters
pmutable 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
TreeViewProtocol.Declaration
Swift
@inlinable required public init(retainingRaw raw: UnsafeMutableRawPointer)Parameters
rawmutable 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
TreeViewProtocol.Declaration
Swift
@inlinable override public init(opaquePointer p: OpaquePointer)Parameters
popaque 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
TreeViewProtocol.Declaration
Swift
@inlinable override public init(retainingOpaquePointer p: OpaquePointer)Parameters
popaque pointer to the underlying object
-
Creates a new
GtkTreeViewwidget.Declaration
Swift
@inlinable public init() -
Creates a new
GtkTreeViewwidget with the model initialized tomodel.Declaration
Swift
@inlinable public init<TreeModelT>(model: TreeModelT) where TreeModelT : TreeModelProtocol -
Creates a new
GtkTreeViewwidget with the model initialized tomodel.Declaration
Swift
@inlinable public static func newWith<TreeModelT>(model: TreeModelT) -> Widget! where TreeModelT : TreeModelProtocol -
Convenience Tree View constructor
Declaration
Swift
@inlinable convenience init(model store: TreeStore)Parameters
storetree view store description
-
Append the given columns
Declaration
Swift
@inlinable func append<T>(_ columns: [T]) where T : TreeViewColumnProtocolParameters
columnsarray of columns to append
-
Append the given columns
Declaration
Swift
@inlinable func append<T>(_ columns: T...) where T : TreeViewColumnProtocolParameters
columnslist of of columns to append
View on GitHub
Install in Dash
TreeView Class Reference