SelectionModel
open class SelectionModel : GIO.ListModel, SelectionModelProtocol
GtkSelectionModel
is an interface that add support for selection to list models.
This support is then used by widgets using list models to add the ability to select and unselect various items.
GTK provides default implementations of the most common selection modes such
as [classGtk.SingleSelection
], so you will only need to implement this
interface if you want detailed control about how selections should be handled.
A GtkSelectionModel
supports a single boolean per item indicating if an item is
selected or not. This can be queried via [methodGtk.SelectionModel.is_selected
].
When the selected state of one or more items changes, the model will emit the
[signalGtk.SelectionModel::selection-changed
] signal by calling the
[methodGtk.SelectionModel.selection_changed
] function. The positions given
in that signal may have their selection state changed, though that is not a
requirement. If new items added to the model via the items-changed
signal
are selected or not is up to the implementation.
Note that items added via items-changed
may already be selected and no
[Gtk.SelectionModelselection-changed
] will be emitted for them. So to
track which items are selected, it is necessary to listen to both signals.
Additionally, the interface can expose functionality to select and unselect
items. If these functions are implemented, GTK’s list widgets will allow users
to select and unselect items. However, GtkSelectionModel
s are free to only
implement them partially or not at all. In that case the widgets will not
support the unimplemented operations.
When selecting or unselecting is supported by a model, the return values of the selection functions do not indicate if selection or unselection happened. They are only meant to indicate complete failure, like when this mode of selecting is not supported by the model.
Selections may happen asynchronously, so the only reliable way to find out when an item was selected is to listen to the signals that indicate selection.
The SelectionModel
type acts as an owner of an underlying GtkSelectionModel
instance.
It provides the methods that can operate on this data type through SelectionModelProtocol
conformance.
Use SelectionModel
as a strong reference or owner of a GtkSelectionModel
instance.
-
Designated initialiser from the underlying `C` data type.
This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the
SelectionModel
instance.Declaration
Swift
@inlinable public init(_ op: UnsafeMutablePointer<GtkSelectionModel>)
Parameters
op
pointer to the underlying object
-
Designated initialiser from a constant pointer to the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theSelectionModel
instance.Declaration
Swift
@inlinable public init(_ op: UnsafePointer<GtkSelectionModel>)
Parameters
op
pointer to the underlying object
-
Optional initialiser from a non-mutating
gpointer
to the underlyingC
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theSelectionModel
instance.Declaration
Swift
@inlinable override public init!(gpointer op: gpointer?)
Parameters
op
gpointer to the underlying object
-
Optional initialiser from a non-mutating
gconstpointer
to the underlyingC
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theSelectionModel
instance.Declaration
Swift
@inlinable override public init!(gconstpointer op: gconstpointer?)
Parameters
op
pointer to the underlying object
-
Optional initialiser from a constant pointer to the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theSelectionModel
instance.Declaration
Swift
@inlinable public init!(_ op: UnsafePointer<GtkSelectionModel>?)
Parameters
op
pointer to the underlying object
-
Optional initialiser from the underlying
C
data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to theSelectionModel
instance.Declaration
Swift
@inlinable public init!(_ op: UnsafeMutablePointer<GtkSelectionModel>?)
Parameters
op
pointer to the underlying object
-
Designated initialiser from the underlying
C
data type.GtkSelectionModel
does not allow reference counting, so despite the name no actual retaining will occur. i.e., ownership is transferred to theSelectionModel
instance.Declaration
Swift
@inlinable public init(retaining op: UnsafeMutablePointer<GtkSelectionModel>)
Parameters
op
pointer to the underlying object
-
Reference intialiser for a related type that implements
SelectionModelProtocol
GtkSelectionModel
does not allow reference counting.Declaration
Swift
@inlinable public init<T>(selectionModel other: T) where T : SelectionModelProtocol
Parameters
other
an instance of a related type that implements
SelectionModelProtocol
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
SelectionModelProtocol
.Declaration
Swift
@inlinable override public init<T>(cPointer p: UnsafeMutablePointer<T>)
Parameters
cPointer
pointer to the underlying object
-
Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
SelectionModelProtocol
.Declaration
Swift
@inlinable override public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)
Parameters
cPointer
pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
SelectionModelProtocol
.Declaration
Swift
@inlinable override public init(raw p: UnsafeRawPointer)
Parameters
p
raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
SelectionModelProtocol
.Declaration
Swift
@inlinable override public init(retainingRaw raw: UnsafeRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
SelectionModelProtocol
.Declaration
Swift
@inlinable public required init(raw p: UnsafeMutableRawPointer)
Parameters
p
mutable raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
SelectionModelProtocol
.Declaration
Swift
@inlinable override public init(retainingRaw raw: UnsafeMutableRawPointer)
Parameters
raw
mutable raw pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
SelectionModelProtocol
.Declaration
Swift
@inlinable override public init(opaquePointer p: OpaquePointer)
Parameters
p
opaque pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
SelectionModelProtocol
.Declaration
Swift
@inlinable override public init(retainingOpaquePointer p: OpaquePointer)
Parameters
p
opaque pointer to the underlying object