SingleSelectionProtocol
public protocol SingleSelectionProtocol : ObjectProtocol, SelectionModelProtocol
GtkSingleSelection is a GtkSelectionModel that allows selecting a single
item.
Note that the selection is persistent – if the selected item is removed
and re-added in the same items-changed emission, it stays selected.
In particular, this means that changing the sort order of an underlying sort
model will preserve the selection.
The SingleSelectionProtocol protocol exposes the methods and properties of an underlying GtkSingleSelection 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 SingleSelection.
Alternatively, use SingleSelectionRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkSingleSelectioninstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
single_selection_ptrDefault implementationTyped pointer to the underlying
GtkSingleSelectioninstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkSingleSelectioninstance.Declaration
Swift
var single_selection_ptr: UnsafeMutablePointer<GtkSingleSelection>! { get } -
Required Initialiser for types conforming to
SingleSelectionProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
SingleSelectionPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: SingleSelectionPropertyName, 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 SingleSelection property
Declaration
Swift
@inlinable func get(property: SingleSelectionPropertyName) -> 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 SingleSelection property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: SingleSelectionPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
getAutoselect()Extension methodChecks if autoselect has been enabled or disabled via
gtk_single_selection_set_autoselect().Declaration
Swift
@inlinable func getAutoselect() -> Bool -
getCanUnselect()Extension methodIf
true,gtk_selection_model_unselect_item()is supported and allows unselecting the selected item.Declaration
Swift
@inlinable func getCanUnselect() -> Bool -
getModel()Extension methodGets the model that
selfis wrapping.Declaration
Swift
@inlinable func getModel() -> GIO.ListModelRef! -
getSelected()Extension methodGets the position of the selected item.
If no item is selected,
GTK_INVALID_LIST_POSITIONis returned.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(autoselect:Extension method) Enables or disables autoselect.
If
autoselectistrue,selfwill enforce that an item is always selected. It will select a new item when the currently selected item is deleted and it will disallow unselecting the current item.Declaration
Swift
@inlinable func set(autoselect: Bool) -
set(canUnselect:Extension method) If
true, unselecting the current item viagtk_selection_model_unselect_item()is supported.Note that setting [property
Gtk.SingleSelection:autoselect] will cause unselecting to not work, so it practically makes no sense to set both at the same time the same time.Declaration
Swift
@inlinable func set(canUnselect: Bool) -
set(model:Extension method) Sets the model that
selfshould wrap.If
modelisnil,selfwill be empty.Declaration
Swift
@inlinable func set(model: GIO.ListModelRef? = nil) -
set(model:Extension method) Sets the model that
selfshould wrap.If
modelisnil,selfwill be empty.Declaration
Swift
@inlinable func set<ListModelT>(model: ListModelT?) where ListModelT : ListModelProtocol -
setSelected(position:Extension method) Selects the item at the given position.
If the list does not have an item at
positionorGTK_INVALID_LIST_POSITIONis given, the behavior depends on the value of the [propertyGtk.SingleSelection:autoselect] property: If it is set, no change will occur and the old item will stay selected. If it is unset, the selection will be unset and no item will be selected.Declaration
Swift
@inlinable func setSelected(position: Int) -
autoselectExtension methodIf the selection will always select an item.
Declaration
Swift
@inlinable var autoselect: Bool { get nonmutating set } -
canUnselectExtension methodIf
true,gtk_selection_model_unselect_item()is supported and allows unselecting the selected item.Declaration
Swift
@inlinable var canUnselect: Bool { get nonmutating set } -
modelExtension methodThe model being managed.
Declaration
Swift
@inlinable var model: GIO.ListModelRef! { get nonmutating set } -
selectedExtension methodPosition of the selected item.
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
SingleSelectionProtocol Protocol Reference