SelectionProtocol
public protocol SelectionProtocol
AtkSelection
should be implemented by UI components with children
which are exposed by atk_object_ref_child
and
atk_object_get_n_children
, if the use of the parent UI component
ordinarily involves selection of one or more of the objects
corresponding to those AtkObject
children - for example,
selectable lists.
Note that other types of “selection” (for instance text selection)
are accomplished a other ATK interfaces - AtkSelection
is limited
to the selection/deselection of children.
The SelectionProtocol
protocol exposes the methods and properties of an underlying AtkSelection
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 Selection
.
Alternatively, use SelectionRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
AtkSelection
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
selection_ptr
Default implementationTyped pointer to the underlying
AtkSelection
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
AtkSelection
instance.Declaration
Swift
var selection_ptr: UnsafeMutablePointer<AtkSelection>! { get }
-
Required Initialiser for types conforming to
SelectionProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
connect(signal:
Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
SelectionSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: SelectionSignalName, 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 byuserData
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(signal:
Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
SelectionSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: SelectionSignalName, 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 byuserData
signalHandler
The C function to be called on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
onSelectionChanged(flags:
Extension methodhandler: ) The “selection-changed” signal is emitted by an object which implements AtkSelection interface when the selection changes.
Note
This represents the underlyingselection-changed
signalDeclaration
Swift
@discardableResult @inlinable func onSelectionChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: SelectionRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
selectionChanged
signal is emitted -
selectionChangedSignal
Extension methodTyped
selection-changed
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var selectionChangedSignal: SelectionSignalName { get }
-
addSelection(i:
Extension method) Adds the specified accessible child of the object to the object’s selection.
Declaration
Swift
@inlinable func addSelection(i: Int) -> Bool
-
clearSelection()
Extension methodClears the selection in the object so that no children in the object are selected.
Declaration
Swift
@inlinable func clearSelection() -> Bool
-
getSelectionCount()
Extension methodGets the number of accessible children currently selected. Note: callers should not rely on
nil
or on a zero value for indication of whether AtkSelectionIface is implemented, they should use type checking/interface checking macros or theatk_get_accessible_value()
convenience method.Declaration
Swift
@inlinable func getSelectionCount() -> Int
-
isChildSelected(i:
Extension method) Determines if the current child of this object is selected Note: callers should not rely on
nil
or on a zero value for indication of whether AtkSelectionIface is implemented, they should use type checking/interface checking macros or theatk_get_accessible_value()
convenience method.Declaration
Swift
@inlinable func isChildSelected(i: Int) -> Bool
-
refSelection(i:
Extension method) Gets a reference to the accessible object representing the specified selected child of the object. Note: callers should not rely on
nil
or on a zero value for indication of whether AtkSelectionIface is implemented, they should use type checking/interface checking macros or theatk_get_accessible_value()
convenience method.Declaration
Swift
@inlinable func refSelection(i: Int) -> Atk.ObjectRef!
-
removeSelection(i:
Extension method) Removes the specified child of the object from the object’s selection.
Declaration
Swift
@inlinable func removeSelection(i: Int) -> Bool
-
selectAllSelection()
Extension methodCauses every child of the object to be selected if the object supports multiple selections.
Declaration
Swift
@inlinable func selectAllSelection() -> Bool
-
selectionCount
Extension methodGets the number of accessible children currently selected. Note: callers should not rely on
nil
or on a zero value for indication of whether AtkSelectionIface is implemented, they should use type checking/interface checking macros or theatk_get_accessible_value()
convenience method.Declaration
Swift
@inlinable var selectionCount: Int { get }