ListBoxRef

public struct ListBoxRef : ListBoxProtocol, GWeakCapturing

GtkListBox is a vertical list.

A GtkListBox only contains GtkListBoxRow children. These rows can by dynamically sorted and filtered, and headers can be added dynamically depending on the row content. It also allows keyboard and mouse navigation and selection like a typical list.

Using GtkListBox is often an alternative to GtkTreeView, especially when the list contents has a more complicated layout than what is allowed by a GtkCellRenderer, or when the contents is interactive (i.e. has a button in it).

Although a GtkListBox must have only GtkListBoxRow children, you can add any kind of widget to it via [methodGtk.ListBox.prepend], [methodGtk.ListBox.append] and [methodGtk.ListBox.insert] and a GtkListBoxRow widget will automatically be inserted between the list and the widget.

GtkListBoxRows can be marked as activatable or selectable. If a row is activatable, [signalGtk.ListBox::row-activated] will be emitted for it when the user tries to activate it. If it is selectable, the row will be marked as selected when the user tries to select it.

GtkListBox as GtkBuildable

The GtkListBox implementation of the GtkBuildable interface supports setting a child as the placeholder by specifying “placeholder” as the “type” attribute of a <child> element. See [methodGtk.ListBox.set_placeholder] for info.

CSS nodes

(plain Language Example):

list[.separators][.rich-list][.navigation-sidebar]
╰── row[.activatable]

GtkListBox uses a single CSS node named list. It may carry the .separators style class, when the [propertyGtk.ListBox:show-separators] property is set. Each GtkListBoxRow uses a single CSS node named row. The row nodes get the .activatable style class added when appropriate.

The main list node may also carry style classes to select the style of list presentation: .rich-list, .navigation-sidebar or .data-table.

Accessibility

GtkListBox uses the GTK_ACCESSIBLE_ROLE_LIST role and GtkListBoxRow uses the GTK_ACCESSIBLE_ROLE_LIST_ITEM role.

The ListBoxRef type acts as a lightweight Swift reference to an underlying GtkListBox instance. It exposes methods that can operate on this data type through ListBoxProtocol conformance. Use ListBoxRef only as an unowned reference to an existing GtkListBox instance.

  • ptr
    Untyped pointer to the underlying `GtkListBox` instance.
    

    For type-safe access, use the generated, typed pointer list_box_ptr property instead.

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

ListBox Class

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafeMutablePointer<GtkListBox>)
  • Designated initialiser from a constant pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafePointer<GtkListBox>)
  • Conditional initialiser from an optional pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafeMutablePointer<GtkListBox>?)
  • Conditional initialiser from an optional, non-mutable pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GtkListBox>?)
  • Conditional initialiser from an optional gpointer

    Declaration

    Swift

    @inlinable
    init!(gpointer g: gpointer?)
  • Conditional initialiser from an optional, non-mutable gconstpointer

    Declaration

    Swift

    @inlinable
    init!(gconstpointer g: gconstpointer?)
  • Reference intialiser for a related type that implements ListBoxProtocol

    Declaration

    Swift

    @inlinable
    init<T>(_ other: T) where T : ListBoxProtocol
  • This factory is syntactic sugar for setting weak pointers wrapped in GWeak<T>

    Declaration

    Swift

    @inlinable
    static func unowned<T>(_ other: T) -> ListBoxRef where T : ListBoxProtocol
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to ListBoxProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(cPointer: UnsafeMutablePointer<T>)
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to ListBoxProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(constPointer: UnsafePointer<T>)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to ListBoxProtocol.

    Declaration

    Swift

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

    Declaration

    Swift

    @inlinable
    init(raw: UnsafeMutableRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to ListBoxProtocol.

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)
  • Creates a new GtkListBox container.

    Declaration

    Swift

    @inlinable
    init()