DropDownProtocol
public protocol DropDownProtocol : WidgetProtocol
GtkDropDown is a widget that allows the user to choose an item
from a list of options.

The GtkDropDown displays the selected choice.
The options are given to GtkDropDown in the form of GListModel
and how the individual options are represented is determined by
a [classGtk.ListItemFactory]. The default factory displays simple strings.
GtkDropDown knows how to obtain strings from the items in a
[classGtk.StringList]; for other models, you have to provide an expression
to find the strings via [methodGtk.DropDown.set_expression].
GtkDropDown can optionally allow search in the popup, which is
useful if the list of options is long. To enable the search entry,
use [methodGtk.DropDown.set_enable_search].
CSS nodes
GtkDropDown has a single CSS node with name dropdown,
with the button and popover nodes as children.
Accessibility
GtkDropDown uses the GTK_ACCESSIBLE_ROLE_COMBO_BOX role.
The DropDownProtocol protocol exposes the methods and properties of an underlying GtkDropDown 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 DropDown.
Alternatively, use DropDownRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkDropDowninstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
drop_down_ptrDefault implementationTyped pointer to the underlying
GtkDropDowninstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkDropDowninstance.Declaration
Swift
var drop_down_ptr: UnsafeMutablePointer<GtkDropDown>! { get } -
Required Initialiser for types conforming to
DropDownProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
DropDownPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: DropDownPropertyName, 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 : ObjectProtocolParameters
source_propertythe source property to bind
targetthe target object to bind to
target_propertythe target property to bind to
flagsthe flags to pass to the
Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Value
binding reference or
nilin case of an error -
get(property:Extension method) Get the value of a DropDown property
Declaration
Swift
@inlinable func get(property: DropDownPropertyName) -> GLibObject.ValueParameters
propertythe property to get the value for
Return Value
the value of the named property
-
set(property:Extension methodvalue: ) Set the value of a DropDown property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: DropDownPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
getEnableSearch()Extension methodReturns whether search is enabled.
Declaration
Swift
@inlinable func getEnableSearch() -> Bool -
getExpression()Extension methodGets the expression set that is used to obtain strings from items.
See [method
Gtk.DropDown.set_expression].Declaration
Swift
@inlinable func getExpression() -> ExpressionRef! -
getFactory()Extension methodGets the factory that’s currently used to populate list items.
The factory returned by this function is always used for the item in the button. It is also used for items in the popup if [property
Gtk.DropDown:list-factory] is not set.Declaration
Swift
@inlinable func getFactory() -> ListItemFactoryRef! -
getListFactory()Extension methodGets the factory that’s currently used to populate list items in the popup.
Declaration
Swift
@inlinable func getListFactory() -> ListItemFactoryRef! -
getModel()Extension methodGets the model that provides the displayed items.
Declaration
Swift
@inlinable func getModel() -> GIO.ListModelRef! -
getSelected()Extension methodGets the position of the selected item.
Declaration
Swift
@inlinable func getSelected() -> Int -
getSelectedItem()Extension methodGets the selected item. If no item is selected,
nilis returned.Declaration
Swift
@inlinable func getSelectedItem() -> GLibObject.ObjectRef! -
set(enableSearch:Extension method) Sets whether a search entry will be shown in the popup that allows to search for items in the list.
Note that [property
Gtk.DropDown:expression] must be set for search to work.Declaration
Swift
@inlinable func set(enableSearch: Bool) -
set(expression:Extension method) Sets the expression that gets evaluated to obtain strings from items.
This is used for search in the popup. The expression must have a value type of
G_TYPE_STRING.Declaration
Swift
@inlinable func set(expression: ExpressionRef? = nil) -
set(expression:Extension method) Sets the expression that gets evaluated to obtain strings from items.
This is used for search in the popup. The expression must have a value type of
G_TYPE_STRING.Declaration
Swift
@inlinable func set<ExpressionT>(expression: ExpressionT?) where ExpressionT : ExpressionProtocol -
set(factory:Extension method) Sets the
GtkListItemFactoryto use for populating list items.Declaration
Swift
@inlinable func set(factory: ListItemFactoryRef? = nil) -
set(factory:Extension method) Sets the
GtkListItemFactoryto use for populating list items.Declaration
Swift
@inlinable func set<ListItemFactoryT>(factory: ListItemFactoryT?) where ListItemFactoryT : ListItemFactoryProtocol -
setList(factory:Extension method) Sets the
GtkListItemFactoryto use for populating list items in the popup.Declaration
Swift
@inlinable func setList(factory: ListItemFactoryRef? = nil) -
setList(factory:Extension method) Sets the
GtkListItemFactoryto use for populating list items in the popup.Declaration
Swift
@inlinable func setList<ListItemFactoryT>(factory: ListItemFactoryT?) where ListItemFactoryT : ListItemFactoryProtocol -
set(model:Extension method) Sets the
GListModelto use.Declaration
Swift
@inlinable func set(model: GIO.ListModelRef? = nil) -
set(model:Extension method) Sets the
GListModelto use.Declaration
Swift
@inlinable func set<ListModelT>(model: ListModelT?) where ListModelT : ListModelProtocol -
setSelected(position:Extension method) Selects the item at the given position.
Declaration
Swift
@inlinable func setSelected(position: Int) -
enableSearchExtension methodReturns whether search is enabled.
Declaration
Swift
@inlinable var enableSearch: Bool { get nonmutating set } -
expressionExtension methodAn expression to evaluate to obtain strings to match against the search term.
See [property
Gtk.DropDown:enable-search] for how to enable search. If [propertyGtk.DropDown:factory] is not set, the expression is also used to bind strings to labels produced by a default factory.Declaration
Swift
@inlinable var expression: ExpressionRef! { get nonmutating set } -
factoryExtension methodFactory for populating list items.
Declaration
Swift
@inlinable var factory: ListItemFactoryRef! { get nonmutating set } -
listFactoryExtension methodGets the factory that’s currently used to populate list items in the popup.
Declaration
Swift
@inlinable var listFactory: ListItemFactoryRef! { get nonmutating set } -
modelExtension methodModel for the displayed items.
Declaration
Swift
@inlinable var model: GIO.ListModelRef! { get nonmutating set } -
selectedExtension methodThe position of the selected item.
If no item is selected, the property has the value
GTK_INVALID_LIST_POSITION.Declaration
Swift
@inlinable var selected: Int { get nonmutating set } -
selectedItemExtension methodGets the selected item. If no item is selected,
nilis returned.Declaration
Swift
@inlinable var selectedItem: GLibObject.ObjectRef! { get }
View on GitHub
Install in Dash
DropDownProtocol Protocol Reference