ListBox

open class ListBox : Container, ListBoxProtocol

A GtkListBox is a vertical container that contains GtkListBoxRow children. These rows can be 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 gtk_container_add(), 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, GtkListBox::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.

The GtkListBox widget was added in GTK+ 3.10.

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 gtk_list_box_set_placeholder() for info.

CSS nodes

(plain Language Example):

list
╰── row[.activatable]

GtkListBox uses a single CSS node named list. Each GtkListBoxRow uses a single CSS node named row. The row nodes get the .activatable style class added when appropriate.

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

    Declaration

    Swift

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

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

    Declaration

    Swift

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

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

    Declaration

    Swift

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

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

    Declaration

    Swift

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

    Parameters

    op

    pointer to the underlying object

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

    Declaration

    Swift

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

    Parameters

    op

    pointer to the underlying object

  • Reference intialiser for a related type that implements ListBoxProtocol Will retain GtkListBox.

    Declaration

    Swift

    @inlinable
    public init<T>(listBox other: T) where T : ListBoxProtocol

    Parameters

    other

    an instance of a related type that implements ListBoxProtocol

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

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

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

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

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

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

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

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

    Declaration

    Swift

    @inlinable
    override public init(retainingOpaquePointer p: OpaquePointer)

    Parameters

    p

    opaque pointer to the underlying object

  • Creates a new GtkListBox container.

    Declaration

    Swift

    @inlinable
    public init()