TreeExpanderProtocol

public protocol TreeExpanderProtocol : WidgetProtocol

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 TreeExpanderProtocol protocol exposes the methods and properties of an underlying GtkTreeExpander 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 TreeExpander. Alternatively, use TreeExpanderRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying GtkTreeExpander instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • tree_expander_ptr Default implementation

    Typed pointer to the underlying GtkTreeExpander instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GtkTreeExpander instance.

    Declaration

    Swift

    var tree_expander_ptr: UnsafeMutablePointer<GtkTreeExpander>! { get }
  • Required Initialiser for types conforming to TreeExpanderProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

TreeExpander Class

  • Bind a TreeExpanderPropertyName source property to a given target object.

    Declaration

    Swift

    @discardableResult
    @inlinable
    func bind<Q, T>(property source_property: TreeExpanderPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocol

    Parameters

    source_property

    the source property to bind

    target

    the target object to bind to

    target_property

    the target property to bind to

    flags

    the flags to pass to the Binding

    transform_from

    ValueTransformer to use for forward transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return Value

    binding reference or nil in case of an error

  • get(property:) Extension method

    Get the value of a TreeExpander property

    Declaration

    Swift

    @inlinable
    func get(property: TreeExpanderPropertyName) -> GLibObject.Value

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

  • set(property:value:) Extension method

    Set the value of a TreeExpander property. Note that this will only have an effect on properties that are writable and not construct-only!

    Declaration

    Swift

    @inlinable
    func set(property: TreeExpanderPropertyName, value v: GLibObject.Value)

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

TreeExpander Class: TreeExpanderProtocol extension (methods and fields)

  • getChild() Extension method

    Gets the child widget displayed by self.

    Declaration

    Swift

    @inlinable
    func getChild() -> WidgetRef!
  • getItem() Extension method

    Forwards the item set on the GtkTreeListRow that self is managing.

    This call is essentially equivalent to calling:

    gtk_tree_list_row_get_item (gtk_tree_expander_get_list_row (`self`));
    

    Declaration

    Swift

    @inlinable
    func getItem() -> GLibObject.ObjectRef!
  • getListRow() Extension method

    Gets the list row managed by self.

    Declaration

    Swift

    @inlinable
    func getListRow() -> TreeListRowRef!
  • set(child:) Extension method

    Sets the content widget to display.

    Declaration

    Swift

    @inlinable
    func set(child: WidgetRef? = nil)
  • set(child:) Extension method

    Sets the content widget to display.

    Declaration

    Swift

    @inlinable
    func set<WidgetT>(child: WidgetT?) where WidgetT : WidgetProtocol
  • set(listRow:) Extension method

    Sets the tree list row that this expander should manage.

    Declaration

    Swift

    @inlinable
    func set(listRow: TreeListRowRef? = nil)
  • set(listRow:) Extension method

    Sets the tree list row that this expander should manage.

    Declaration

    Swift

    @inlinable
    func set<TreeListRowT>(listRow: TreeListRowT?) where TreeListRowT : TreeListRowProtocol
  • child Extension method

    The child widget with the actual contents.

    Declaration

    Swift

    @inlinable
    var child: WidgetRef! { get nonmutating set }
  • item Extension method

    The item held by this expander’s row.

    Declaration

    Swift

    @inlinable
    var item: GLibObject.ObjectRef! { get }
  • listRow Extension method

    Gets the list row managed by self.

    Declaration

    Swift

    @inlinable
    var listRow: TreeListRowRef! { get nonmutating set }