ComboBoxProtocol

public protocol ComboBoxProtocol : CellEditableProtocol, CellLayoutProtocol

A GtkComboBox is a widget that allows the user to choose from a list of valid choices.

An example GtkComboBox

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

  • ptr

    Untyped pointer to the underlying GtkComboBox instance.

    Declaration

    Swift

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

    Typed pointer to the underlying GtkComboBox instance.

    Default Implementation

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

    Declaration

    Swift

    var combo_box_ptr: UnsafeMutablePointer<GtkComboBox>! { get }
  • Required Initialiser for types conforming to ComboBoxProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

ComboBox Class

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

    Declaration

    Swift

    @discardableResult
    @inlinable
    func bind<Q, T>(property source_property: ComboBoxPropertyName, 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 ComboBox property

    Declaration

    Swift

    @inlinable
    func get(property: ComboBoxPropertyName) -> 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 ComboBox property. Note that this will only have an effect on properties that are writable and not construct-only!

    Declaration

    Swift

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

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

ComboBox signals

  • Connect a Swift signal handler to the given, typed ComboBoxSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: ComboBoxSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    handler

    The Swift signal handler (function or callback) to invoke on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • Connect a C signal handler to the given, typed ComboBoxSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: ComboBoxSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    signalHandler

    The C function to be called on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • onChanged(flags:handler:) Extension method

    Emitted when the active item is changed.

    The can be due to the user selecting a different item from the list, or due to a call to [methodGtk.ComboBox.set_active_iter]. It will also be emitted while typing into the entry of a combo box with an entry.

    Note

    This represents the underlying changed signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ComboBoxRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    handler

    The signal handler to call Run the given callback whenever the changed signal is emitted

  • changedSignal Extension method

    Typed changed signal for using the connect(signal:) methods

    Declaration

    Swift

    static var changedSignal: ComboBoxSignalName { get }
  • Emitted to allow changing how the text in a combo box’s entry is displayed.

    See [propertyGtk.ComboBox:has-entry].

    Connect a signal handler which returns an allocated string representing path. That string will then be used to set the text in the combo box’s entry. The default signal handler uses the text from the [propertyGtk.ComboBox:entry-text-column] model column.

    Here’s an example signal handler which fetches data from the model and displays it in the entry.

    static char *
    format_entry_text_callback (GtkComboBox *combo,
                                const char *path,
                                gpointer     user_data)
    {
      GtkTreeIter iter;
      GtkTreeModel model;
      double       value;
    
      model = gtk_combo_box_get_model (combo);
    
      gtk_tree_model_get_iter_from_string (model, &iter, path);
      gtk_tree_model_get (model, &iter,
                          THE_DOUBLE_VALUE_COLUMN, &value,
                          -1);
    
      return g_strdup_printf ("`g`", value);
    }
    

    Note

    This represents the underlying format-entry-text signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onFormatEntryText(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ComboBoxRef, _ path: String) -> String) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    path

    the [structGtk.TreePath] string from the combo box’s current model to format text for

    handler

    a newly allocated string representing path for the current GtkComboBox model. Run the given callback whenever the formatEntryText signal is emitted

  • formatEntryTextSignal Extension method

    Typed format-entry-text signal for using the connect(signal:) methods

    Declaration

    Swift

    static var formatEntryTextSignal: ComboBoxSignalName { get }
  • onMoveActive(flags:handler:) Extension method

    Emitted to move the active selection.

    This is an keybinding signal.

    Note

    This represents the underlying move-active signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onMoveActive(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ComboBoxRef, _ scrollType: ScrollType) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    scrollType

    a GtkScrollType

    handler

    The signal handler to call Run the given callback whenever the moveActive signal is emitted

  • moveActiveSignal Extension method

    Typed move-active signal for using the connect(signal:) methods

    Declaration

    Swift

    static var moveActiveSignal: ComboBoxSignalName { get }
  • onPopdown(flags:handler:) Extension method

    Emitted to popdown the combo box list.

    This is an keybinding signal.

    The default bindings for this signal are Alt+Up and Escape.

    Note

    This represents the underlying popdown signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onPopdown(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ComboBoxRef) -> Bool) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    handler

    The signal handler to call Run the given callback whenever the popdown signal is emitted

  • popdownSignal Extension method

    Typed popdown signal for using the connect(signal:) methods

    Declaration

    Swift

    static var popdownSignal: ComboBoxSignalName { get }
  • onPopup(flags:handler:) Extension method

    Emitted to popup the combo box list.

    This is an keybinding signal.

    The default binding for this signal is Alt+Down.

    Note

    This represents the underlying popup signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onPopup(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ComboBoxRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    handler

    The signal handler to call Run the given callback whenever the popup signal is emitted

  • popupSignal Extension method

    Typed popup signal for using the connect(signal:) methods

    Declaration

    Swift

    static var popupSignal: ComboBoxSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::active signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyActive(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ComboBoxRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyActive signal is emitted

  • notifyActiveSignal Extension method

    Typed notify::active signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyActiveSignal: ComboBoxSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::active-id signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyActiveId(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ComboBoxRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyActiveId signal is emitted

  • notifyActiveIdSignal Extension method

    Typed notify::active-id signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyActiveIdSignal: ComboBoxSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::button-sensitivity signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyButtonSensitivity(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ComboBoxRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyButtonSensitivity signal is emitted

  • Typed notify::button-sensitivity signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyButtonSensitivitySignal: ComboBoxSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::child signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyChild(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ComboBoxRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyChild signal is emitted

  • notifyChildSignal Extension method

    Typed notify::child signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyChildSignal: ComboBoxSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::entry-text-column signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyEntryTextColumn(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ComboBoxRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyEntryTextColumn signal is emitted

  • notifyEntryTextColumnSignal Extension method

    Typed notify::entry-text-column signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyEntryTextColumnSignal: ComboBoxSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::has-entry signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyHasEntry(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ComboBoxRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyHasEntry signal is emitted

  • notifyHasEntrySignal Extension method

    Typed notify::has-entry signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyHasEntrySignal: ComboBoxSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::has-frame signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyHasFrame(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ComboBoxRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyHasFrame signal is emitted

  • notifyHasFrameSignal Extension method

    Typed notify::has-frame signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyHasFrameSignal: ComboBoxSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::id-column signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyIdColumn(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ComboBoxRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyIdColumn signal is emitted

  • notifyIdColumnSignal Extension method

    Typed notify::id-column signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyIdColumnSignal: ComboBoxSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::model signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyModel(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ComboBoxRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyModel signal is emitted

  • notifyModelSignal Extension method

    Typed notify::model signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyModelSignal: ComboBoxSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::popup-fixed-width signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyPopupFixedWidth(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ComboBoxRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyPopupFixedWidth signal is emitted

  • notifyPopupFixedWidthSignal Extension method

    Typed notify::popup-fixed-width signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyPopupFixedWidthSignal: ComboBoxSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::popup-shown signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyPopupShown(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ComboBoxRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyPopupShown signal is emitted

  • notifyPopupShownSignal Extension method

    Typed notify::popup-shown signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyPopupShownSignal: ComboBoxSignalName { get }

ComboBox Class: ComboBoxProtocol extension (methods and fields)

  • getActive() Extension method

    Returns the index of the currently active item.

    If the model is a non-flat treemodel, and the active item is not an immediate child of the root of the tree, this function returns gtk_tree_path_get_indices (path)[0], where path is the [structGtk.TreePath] of the active item.

    Declaration

    Swift

    @inlinable
    func getActive() -> Int
  • getActiveId() Extension method

    Returns the ID of the active row of combo_box.

    This value is taken from the active row and the column specified by the [propertyGtk.ComboBox:id-column] property of combo_box (see [methodGtk.ComboBox.set_id_column]).

    The returned value is an interned string which means that you can compare the pointer by value to other interned strings and that you must not free it.

    If the [propertyGtk.ComboBox:id-column] property of combo_box is not set, or if no row is active, or if the active row has a nil ID value, then nil is returned.

    Declaration

    Swift

    @inlinable
    func getActiveId() -> String!
  • getActive(iter:) Extension method

    Sets iter to point to the currently active item.

    If no item is active, iter is left unchanged.

    Declaration

    Swift

    @inlinable
    func getActive<TreeIterT>(iter: TreeIterT) -> Bool where TreeIterT : TreeIterProtocol
  • getButtonSensitivity() Extension method

    Returns whether the combo box sets the dropdown button sensitive or not when there are no items in the model.

    Declaration

    Swift

    @inlinable
    func getButtonSensitivity() -> GtkSensitivityType
  • getChild() Extension method

    Gets the child widget of combo_box.

    Declaration

    Swift

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

    Returns the column which combo_box is using to get the strings from to display in the internal entry.

    Declaration

    Swift

    @inlinable
    func getEntryTextColumn() -> Int
  • getHasEntry() Extension method

    Returns whether the combo box has an entry.

    Declaration

    Swift

    @inlinable
    func getHasEntry() -> Bool
  • getIdColumn() Extension method

    Returns the column which combo_box is using to get string IDs for values from.

    Declaration

    Swift

    @inlinable
    func getIdColumn() -> Int
  • getModel() Extension method

    Returns the GtkTreeModel of combo_box.

    Declaration

    Swift

    @inlinable
    func getModel() -> TreeModelRef!
  • getPopupFixedWidth() Extension method

    Gets whether the popup uses a fixed width.

    Declaration

    Swift

    @inlinable
    func getPopupFixedWidth() -> Bool
  • getRowSeparatorFunc() Extension method

    Returns the current row separator function.

    Declaration

    Swift

    @inlinable
    func getRowSeparatorFunc() -> GtkTreeViewRowSeparatorFunc!
  • popdown() Extension method

    Hides the menu or dropdown list of combo_box.

    This function is mostly intended for use by accessibility technologies; applications should have little use for it.

    Declaration

    Swift

    @inlinable
    func popdown()
  • popup() Extension method

    Pops up the menu or dropdown list of combo_box.

    This function is mostly intended for use by accessibility technologies; applications should have little use for it.

    Before calling this, combo_box must be mapped, or nothing will happen.

    Declaration

    Swift

    @inlinable
    func popup()
  • popupFor(device:) Extension method

    Pops up the menu of combo_box.

    Note that currently this does not do anything with the device, as it was previously only used for list-mode combo boxes, and those were removed in GTK 4. However, it is retained in case similar functionality is added back later.

    Declaration

    Swift

    @inlinable
    func popupFor<DeviceT>(device: DeviceT) where DeviceT : DeviceProtocol
  • setActive(index:) Extension method

    Sets the active item of combo_box to be the item at index.

    Declaration

    Swift

    @inlinable
    func setActive(index: Int)
  • set(activeId:) Extension method

    Changes the active row of combo_box to the one that has an ID equal to active_id.

    If active_id is nil, the active row is unset. Rows having a nil ID string cannot be made active by this function.

    If the [propertyGtk.ComboBox:id-column] property of combo_box is unset or if no row has the given ID then the function does nothing and returns false.

    Declaration

    Swift

    @inlinable
    func set(activeId: UnsafePointer<CChar>? = nil) -> Bool
  • setActive(iter:) Extension method

    Sets the current active item to be the one referenced by iter.

    If iter is nil, the active item is unset.

    Declaration

    Swift

    @inlinable
    func setActive(iter: TreeIterRef? = nil)
  • setActive(iter:) Extension method

    Sets the current active item to be the one referenced by iter.

    If iter is nil, the active item is unset.

    Declaration

    Swift

    @inlinable
    func setActive<TreeIterT>(iter: TreeIterT?) where TreeIterT : TreeIterProtocol
  • setButton(sensitivity:) Extension method

    Sets whether the dropdown button of the combo box should update its sensitivity depending on the model contents.

    Declaration

    Swift

    @inlinable
    func setButton(sensitivity: GtkSensitivityType)
  • set(child:) Extension method

    Sets the child widget of combo_box.

    Declaration

    Swift

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

    Sets the child widget of combo_box.

    Declaration

    Swift

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

    Sets the model column which combo_box should use to get strings from to be text_column.

    For this column no separate [classGtk.CellRenderer] is needed.

    The column text_column in the model of combo_box must be of type G_TYPE_STRING.

    This is only relevant if combo_box has been created with [propertyGtk.ComboBox:has-entry] as true.

    Declaration

    Swift

    @inlinable
    func setEntry(textColumn: Int)
  • set(idColumn:) Extension method

    Sets the model column which combo_box should use to get string IDs for values from.

    The column id_column in the model of combo_box must be of type G_TYPE_STRING.

    Declaration

    Swift

    @inlinable
    func set(idColumn: Int)
  • set(model:) Extension method

    Sets the model used by combo_box to be model.

    Will unset a previously set model (if applicable). If model is nil, then it will unset the model.

    Note that this function does not clear the cell renderers, you have to call [methodGtk.CellLayout.clear] yourself if you need to set up different cell renderers for the new model.

    Declaration

    Swift

    @inlinable
    func set(model: TreeModelRef? = nil)
  • set(model:) Extension method

    Sets the model used by combo_box to be model.

    Will unset a previously set model (if applicable). If model is nil, then it will unset the model.

    Note that this function does not clear the cell renderers, you have to call [methodGtk.CellLayout.clear] yourself if you need to set up different cell renderers for the new model.

    Declaration

    Swift

    @inlinable
    func set<TreeModelT>(model: TreeModelT?) where TreeModelT : TreeModelProtocol
  • setPopupFixedWidth(fixed:) Extension method

    Specifies whether the popup’s width should be a fixed width.

    If fixed is true, the popup’s width is set to match the allocated width of the combo box.

    Declaration

    Swift

    @inlinable
    func setPopupFixedWidth(fixed: Bool)
  • Sets the row separator function, which is used to determine whether a row should be drawn as a separator.

    If the row separator function is nil, no separators are drawn. This is the default value.

    Declaration

    Swift

    @inlinable
    func setRowSeparatorFunc(func: GtkTreeViewRowSeparatorFunc? = nil, data: gpointer! = nil, destroy: GDestroyNotify? = nil)
  • active Extension method

    The item which is currently active.

    If the model is a non-flat treemodel, and the active item is not an immediate child of the root of the tree, this property has the value gtk_tree_path_get_indices (path)[0], where path is the [structGtk.TreePath] of the active item.

    Declaration

    Swift

    @inlinable
    var active: Int { get nonmutating set }
  • activeId Extension method

    Returns the ID of the active row of combo_box.

    This value is taken from the active row and the column specified by the [propertyGtk.ComboBox:id-column] property of combo_box (see [methodGtk.ComboBox.set_id_column]).

    The returned value is an interned string which means that you can compare the pointer by value to other interned strings and that you must not free it.

    If the [propertyGtk.ComboBox:id-column] property of combo_box is not set, or if no row is active, or if the active row has a nil ID value, then nil is returned.

    Declaration

    Swift

    @inlinable
    var activeId: String! { get nonmutating set }
  • buttonSensitivity Extension method

    Returns whether the combo box sets the dropdown button sensitive or not when there are no items in the model.

    Declaration

    Swift

    @inlinable
    var buttonSensitivity: GtkSensitivityType { get nonmutating set }
  • child Extension method

    The child widget.

    Declaration

    Swift

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

    Returns the column which combo_box is using to get the strings from to display in the internal entry.

    Declaration

    Swift

    @inlinable
    var entryTextColumn: Int { get nonmutating set }
  • hasEntry Extension method

    Returns whether the combo box has an entry.

    Declaration

    Swift

    @inlinable
    var hasEntry: Bool { get }
  • idColumn Extension method

    Returns the column which combo_box is using to get string IDs for values from.

    Declaration

    Swift

    @inlinable
    var idColumn: Int { get nonmutating set }
  • model Extension method

    The model from which the combo box takes its values.

    Declaration

    Swift

    @inlinable
    var model: TreeModelRef! { get nonmutating set }
  • popupFixedWidth Extension method

    Gets whether the popup uses a fixed width.

    Declaration

    Swift

    @inlinable
    var popupFixedWidth: Bool { get nonmutating set }
  • rowSeparatorFunc Extension method

    Returns the current row separator function.

    Declaration

    Swift

    @inlinable
    var rowSeparatorFunc: GtkTreeViewRowSeparatorFunc! { get }
  • parentInstance Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var parentInstance: GtkWidget { get }