ComboBoxRef
public struct ComboBoxRef : ComboBoxProtocol, GWeakCapturing
A GtkComboBox is a widget that allows the user to choose from a list of
valid choices.

The GtkComboBox displays the selected choice; when activated, the
GtkComboBox displays a popup which allows the user to make a new choice.
The GtkComboBox uses the model-view pattern; the list of valid choices
is specified in the form of a tree model, and the display of the choices
can be adapted to the data in the model by using cell renderers, as you
would in a tree view. This is possible since GtkComboBox implements the
[ifaceGtk.CellLayout] interface. The tree model holding the valid
choices is not restricted to a flat list, it can be a real tree, and the
popup will reflect the tree structure.
To allow the user to enter values not in the model, the
[propertyGtk.ComboBox:has-entry] property allows the GtkComboBox to
contain a [classGtk.Entry]. This entry can be accessed by calling
[methodGtk.ComboBox.get_child] on the combo box.
For a simple list of textual choices, the model-view API of GtkComboBox
can be a bit overwhelming. In this case, [classGtk.ComboBoxText] offers
a simple alternative. Both GtkComboBox and GtkComboBoxText can contain
an entry.
CSS nodes
combobox
├── box.linked
│ ╰── button.combo
│ ╰── box
│ ├── cellview
│ ╰── arrow
╰── window.popup
A normal combobox contains a box with the .linked class, a button with the .combo class and inside those buttons, there are a cellview and an arrow.
combobox
├── box.linked
│ ├── entry.combo
│ ╰── button.combo
│ ╰── box
│ ╰── arrow
╰── window.popup
A GtkComboBox with an entry has a single CSS node with name combobox.
It contains a box with the .linked class. That box contains an entry and
a button, both with the .combo class added. The button also contains another
node with name arrow.
Accessibility
GtkComboBox uses the GTK_ACCESSIBLE_ROLE_COMBO_BOX role.
The ComboBoxRef type acts as a lightweight Swift reference to an underlying GtkComboBox instance.
It exposes methods that can operate on this data type through ComboBoxProtocol conformance.
Use ComboBoxRef only as an unowned reference to an existing GtkComboBox instance.
-
Untyped pointer to the underlying `GtkComboBox` instance.For type-safe access, use the generated, typed pointer
combo_box_ptrproperty instead.Declaration
Swift
public let ptr: UnsafeMutableRawPointer!
-
Designated initialiser from the underlying
Cdata typeDeclaration
Swift
@inlinable init(_ p: UnsafeMutablePointer<GtkComboBox>) -
Designated initialiser from a constant pointer to the underlying
Cdata typeDeclaration
Swift
@inlinable init(_ p: UnsafePointer<GtkComboBox>) -
Conditional initialiser from an optional pointer to the underlying
Cdata typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafeMutablePointer<GtkComboBox>?) -
Conditional initialiser from an optional, non-mutable pointer to the underlying
Cdata typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafePointer<GtkComboBox>?) -
Conditional initialiser from an optional
gpointerDeclaration
Swift
@inlinable init!(gpointer g: gpointer?) -
Conditional initialiser from an optional, non-mutable
gconstpointerDeclaration
Swift
@inlinable init!(gconstpointer g: gconstpointer?) -
Reference intialiser for a related type that implements
ComboBoxProtocolDeclaration
Swift
@inlinable init<T>(_ other: T) where T : ComboBoxProtocol -
This factory is syntactic sugar for setting weak pointers wrapped in
GWeak<T>Declaration
Swift
@inlinable static func unowned<T>(_ other: T) -> ComboBoxRef where T : ComboBoxProtocol -
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
ComboBoxProtocol.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
ComboBoxProtocol.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
ComboBoxProtocol.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
ComboBoxProtocol.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
ComboBoxProtocol.Declaration
Swift
@inlinable init(opaquePointer: OpaquePointer) -
Creates a new empty
GtkComboBox.Declaration
Swift
@inlinable init() -
Creates a new
GtkComboBoxwith a model.Declaration
Swift
@inlinable init<TreeModelT>(model: TreeModelT) where TreeModelT : TreeModelProtocol -
Creates a new empty
GtkComboBoxwith an entry and a model.See also [ctor
Gtk.ComboBox.new_with_entry].Declaration
Swift
@inlinable init<TreeModelT>(modelAndEntry model: TreeModelT) where TreeModelT : TreeModelProtocol -
Creates a new empty
GtkComboBoxwith an entry.In order to use a combo box with entry, you need to tell it which column of the model contains the text for the entry by calling [method
Gtk.ComboBox.set_entry_text_column].Declaration
Swift
@inlinable static func newWithEntry() -> WidgetRef! -
Creates a new
GtkComboBoxwith a model.Declaration
Swift
@inlinable static func newWith<TreeModelT>(model: TreeModelT) -> WidgetRef! where TreeModelT : TreeModelProtocol -
Creates a new empty
GtkComboBoxwith an entry and a model.See also [ctor
Gtk.ComboBox.new_with_entry].Declaration
Swift
@inlinable static func newWith<TreeModelT>(modelAndEntry model: TreeModelT) -> WidgetRef! where TreeModelT : TreeModelProtocol
View on GitHub
Install in Dash
ComboBoxRef Structure Reference