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
GtkSingleSelection
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
single_selection_ptr
Default implementationTyped pointer to the underlying
GtkSingleSelection
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkSingleSelection
instance.Declaration
Swift
var single_selection_ptr: UnsafeMutablePointer<GtkSingleSelection>! { get }
-
Required Initialiser for types conforming to
SingleSelectionProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
SingleSelectionPropertyName
source 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 : 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 transformationtransform_to
ValueTransformer
to use for backwards transformationReturn Value
binding reference or
nil
in case of an error -
get(property:
Extension method) Get the value of a SingleSelection property
Declaration
Swift
@inlinable func get(property: SingleSelectionPropertyName) -> GLibObject.Value
Parameters
property
the 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
property
the 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
self
is 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_POSITION
is returned.Declaration
Swift
@inlinable func getSelected() -> Int
-
getSelectedItem()
Extension methodGets the selected item.
If no item is selected,
nil
is returned.Declaration
Swift
@inlinable func getSelectedItem() -> GLibObject.ObjectRef!
-
set(autoselect:
Extension method) Enables or disables autoselect.
If
autoselect
istrue
,self
will 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
self
should wrap.If
model
isnil
,self
will be empty.Declaration
Swift
@inlinable func set(model: GIO.ListModelRef? = nil)
-
set(model:
Extension method) Sets the model that
self
should wrap.If
model
isnil
,self
will 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
position
orGTK_INVALID_LIST_POSITION
is 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)
-
autoselect
Extension methodIf the selection will always select an item.
Declaration
Swift
@inlinable var autoselect: Bool { get nonmutating set }
-
canUnselect
Extension methodIf
true
,gtk_selection_model_unselect_item()
is supported and allows unselecting the selected item.Declaration
Swift
@inlinable var canUnselect: Bool { get nonmutating set }
-
model
Extension methodThe model being managed.
Declaration
Swift
@inlinable var model: GIO.ListModelRef! { get nonmutating set }
-
selected
Extension methodPosition of the selected item.
Declaration
Swift
@inlinable var selected: Int { get nonmutating set }
-
selectedItem
Extension methodGets the selected item.
If no item is selected,
nil
is returned.Declaration
Swift
@inlinable var selectedItem: GLibObject.ObjectRef! { get }