TreeExpander

open class TreeExpander : Widget, TreeExpanderProtocol

GtkTreeExpander is a widget that provides an expander for a list.

It is typically placed as a bottommost child into a GtkListView to allow users to expand and collapse children in a list with a [classGtk.TreeListModel]. GtkTreeExpander provides the common UI elements, gestures and keybindings for this purpose.

On top of this, the “listitem.expand”, “listitem.collapse” and “listitem.toggle-expand” actions are provided to allow adding custom UI for managing expanded state.

The GtkTreeListModel must be set to not be passthrough. Then it will provide [classGtk.TreeListRow] items which can be set via [methodGtk.TreeExpander.set_list_row] on the expander. The expander will then watch that row item automatically. [methodGtk.TreeExpander.set_child] sets the widget that displays the actual row contents.

CSS nodes

treeexpander
├── [indent]*
├── [expander]
╰── <child>

GtkTreeExpander has zero or one CSS nodes with the name “expander” that should display the expander icon. The node will be :checked when it is expanded. If the node is not expandable, an “indent” node will be displayed instead.

For every level of depth, another “indent” node is prepended.

Accessibility

GtkTreeExpander uses the GTK_ACCESSIBLE_ROLE_GROUP role. The expander icon is represented as a GTK_ACCESSIBLE_ROLE_BUTTON, labelled by the expander’s child, and toggling it will change the GTK_ACCESSIBLE_STATE_EXPANDED state.

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

    Declaration

    Swift

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

    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 TreeExpander instance.

    Declaration

    Swift

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

    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 TreeExpander 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 TreeExpander 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 TreeExpander instance.

    Declaration

    Swift

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

    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 TreeExpander instance.

    Declaration

    Swift

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

    Parameters

    op

    pointer to the underlying object

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

    Declaration

    Swift

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

    Parameters

    op

    pointer to the underlying object

  • Reference intialiser for a related type that implements TreeExpanderProtocol Will retain GtkTreeExpander.

    Declaration

    Swift

    @inlinable
    public init<T>(treeExpander other: T) where T : TreeExpanderProtocol

    Parameters

    other

    an instance of a related type that implements TreeExpanderProtocol

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

    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 TreeExpanderProtocol.

    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 TreeExpanderProtocol.

    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 TreeExpanderProtocol.

    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 TreeExpanderProtocol.

    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 TreeExpanderProtocol.

    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 TreeExpanderProtocol.

    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 TreeExpanderProtocol.

    Declaration

    Swift

    @inlinable
    override public init(retainingOpaquePointer p: OpaquePointer)

    Parameters

    p

    opaque pointer to the underlying object

  • Creates a new GtkTreeExpander

    Declaration

    Swift

    @inlinable
    public init()