ComboBoxTextRef
public struct ComboBoxTextRef : ComboBoxTextProtocol, GWeakCapturing
A GtkComboBoxText
is a simple variant of GtkComboBox
for text-only
use cases.
GtkComboBoxText
hides the model-view complexity of GtkComboBox
.
To create a GtkComboBoxText
, use [ctorGtk.ComboBoxText.new
] or
[ctorGtk.ComboBoxText.new_with_entry
].
You can add items to a GtkComboBoxText
with
[methodGtk.ComboBoxText.append_text
],
[methodGtk.ComboBoxText.insert_text
] or
[methodGtk.ComboBoxText.prepend_text
] and remove options with
[methodGtk.ComboBoxText.remove
].
If the GtkComboBoxText
contains an entry (via the
[propertyGtk.ComboBox:has-entry
] property), its contents can be retrieved
using [methodGtk.ComboBoxText.get_active_text
].
You should not call [methodGtk.ComboBox.set_model
] or attempt to pack more
cells into this combo box via its [ifaceGtk.CellLayout
] interface.
GtkComboBoxText as GtkBuildable
The GtkComboBoxText
implementation of the GtkBuildable
interface supports
adding items directly using the <items> element and specifying <item>
elements for each item. Each <item> element can specify the “id”
corresponding to the appended text and also supports the regular
translation attributes “translatable”, “context” and “comments”.
Here is a UI definition fragment specifying GtkComboBoxText
items:
<object class="GtkComboBoxText">
<items>
<item translatable="yes" id="factory">Factory</item>
<item translatable="yes" id="home">Home</item>
<item translatable="yes" id="subway">Subway</item>
</items>
</object>
CSS nodes
combobox
╰── box.linked
├── entry.combo
├── button.combo
╰── window.popup
GtkComboBoxText
has a single CSS node with name combobox. It adds
the style class .combo to the main CSS nodes of its entry and button
children, and the .linked class to the node of its internal box.
The ComboBoxTextRef
type acts as a lightweight Swift reference to an underlying GtkComboBoxText
instance.
It exposes methods that can operate on this data type through ComboBoxTextProtocol
conformance.
Use ComboBoxTextRef
only as an unowned
reference to an existing GtkComboBoxText
instance.
-
Untyped pointer to the underlying `GtkComboBoxText` instance.
For type-safe access, use the generated, typed pointer
combo_box_text_ptr
property instead.Declaration
Swift
public let ptr: UnsafeMutableRawPointer!
-
Designated initialiser from the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafeMutablePointer<GtkComboBoxText>)
-
Designated initialiser from a constant pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafePointer<GtkComboBoxText>)
-
Conditional initialiser from an optional pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafeMutablePointer<GtkComboBoxText>?)
-
Conditional initialiser from an optional, non-mutable pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafePointer<GtkComboBoxText>?)
-
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
ComboBoxTextProtocol
Declaration
Swift
@inlinable init<T>(_ other: T) where T : ComboBoxTextProtocol
-
This factory is syntactic sugar for setting weak pointers wrapped in
GWeak<T>
Declaration
Swift
@inlinable static func unowned<T>(_ other: T) -> ComboBoxTextRef where T : ComboBoxTextProtocol
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
ComboBoxTextProtocol
.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
ComboBoxTextProtocol
.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
ComboBoxTextProtocol
.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
ComboBoxTextProtocol
.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
ComboBoxTextProtocol
.Declaration
Swift
@inlinable init(opaquePointer: OpaquePointer)
-
Creates a new
GtkComboBoxText
.Declaration
Swift
@inlinable init()
-
Creates a new
GtkComboBoxText
with an entry.Declaration
Swift
@inlinable static func comboBoxTextNewWithEntry() -> WidgetRef!