SwitchRef
public struct SwitchRef : SwitchProtocol, GWeakCapturing
GtkSwitch is a “light switch” that has two states: on or off.

The user can control which state should be active by clicking the empty area, or by dragging the handle.
GtkSwitch can also handle situations where the underlying state
changes with a delay. See [signalGtkSwitch::state-set] for details.
CSS nodes
switch
├── label
├── label
╰── slider
GtkSwitch has four css nodes, the main node with the name switch and
subnodes for the slider and the on and off labels. Neither of them is
using any style classes.
Accessibility
GtkSwitch uses the GTK_ACCESSIBLE_ROLE_SWITCH role.
The SwitchRef type acts as a lightweight Swift reference to an underlying GtkSwitch instance.
It exposes methods that can operate on this data type through SwitchProtocol conformance.
Use SwitchRef only as an unowned reference to an existing GtkSwitch instance.
-
Untyped pointer to the underlying `GtkSwitch` instance.For type-safe access, use the generated, typed pointer
switch_ptrproperty instead.Declaration
Swift
public let ptr: UnsafeMutableRawPointer!
-
Designated initialiser from the underlying
Cdata typeDeclaration
Swift
@inlinable init(_ p: UnsafeMutablePointer<GtkSwitch>) -
Designated initialiser from a constant pointer to the underlying
Cdata typeDeclaration
Swift
@inlinable init(_ p: UnsafePointer<GtkSwitch>) -
Conditional initialiser from an optional pointer to the underlying
Cdata typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafeMutablePointer<GtkSwitch>?) -
Conditional initialiser from an optional, non-mutable pointer to the underlying
Cdata typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafePointer<GtkSwitch>?) -
Conditional initialiser from an optional
gpointerDeclaration
Swift
@inlinable init!(gpointer g: gpointer?) -
Conditional initialiser from an optional, non-mutable
gconstpointerDeclaration
Swift
@inlinable init!(gconstpointer g: gconstpointer?) -
Reference intialiser for a related type that implements
SwitchProtocolDeclaration
Swift
@inlinable init<T>(_ other: T) where T : SwitchProtocol -
This factory is syntactic sugar for setting weak pointers wrapped in
GWeak<T>Declaration
Swift
@inlinable static func unowned<T>(_ other: T) -> SwitchRef where T : SwitchProtocol -
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
SwitchProtocol.Declaration
Swift
@inlinable init<T>(cPointer: UnsafeMutablePointer<T>) -
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
SwitchProtocol.Declaration
Swift
@inlinable init<T>(constPointer: UnsafePointer<T>) -
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
SwitchProtocol.Declaration
Swift
@inlinable init(mutating raw: UnsafeRawPointer) -
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
SwitchProtocol.Declaration
Swift
@inlinable init(raw: UnsafeMutableRawPointer) -
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
SwitchProtocol.Declaration
Swift
@inlinable init(opaquePointer: OpaquePointer) -
Creates a new
GtkSwitchwidget.Declaration
Swift
@inlinable init()
View on GitHub
Install in Dash
SwitchRef Structure Reference