Basics
Guides
API Reference
Basics
Guides
API Reference
[307:7] extends: object
Generated low-level callback wrapper for GIR callback activate.
SwitchActivateCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (nativeSelf, nativeUserData)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[28:7] extends: object
Shows a "light switch" that has two states: on or off.
GtkSwitch can also express situations where the underlying state changes
with a delay. In this case, the slider position indicates the user's recent
change (represented by the [property@Gtk.Switch:active] property), while the
trough color indicates the present underlying state (represented by the
[property@Gtk.Switch:state] property).
GtkSwitch supports pan and drag gestures to move the slider. # CSS nodes
switch ├── image ├── image ╰── slider GtkSwitch has four css nodes,
the main node with the name switch and subnodes for the slider and the on and
off images. Neither of them is using any style classes. # Accessibility
GtkSwitch uses the [enum@Gtk.AccessibleRole.switch] role.
Switch ()
Creates a new
GtkSwitchwidget.
toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asWidget ()
Wraps this handle as
Widget.
A Widget object.asAccessible ()
Wraps this handle as
Accessible.
A Accessible object.asActionable ()
Wraps this handle as
Actionable.
A Actionable object.asBuildable ()
Wraps this handle as
Buildable.
A Buildable object.asConstraintTarget ()
Wraps this handle as
ConstraintTarget.
A ConstraintTarget object.connectSignal (string Name, CallbackObj)
Connects one generated callback wrapper to a named signal.
Name is the signal name.CallbackObj is the generated callback wrapper to connect.The connected handler id.disconnectSignalHandler (int HandlerId)
Disconnects one retained signal handler id.
HandlerId is the signal handler id to disconnect.None.setOnActivate (callback Fn, UserData = null)
Emitted to animate the switch. Applications should never connect to this signal, but use the [property@Gtk.Switch:active] property.
Fn is the Aussom callback.Fn is called with (Switch Self).UserData is retained and passed through to the generated callback wrapper when provided.The connected handler id.setOnStateset (callback Fn, UserData = null)
Emitted to change the underlying state. The ::state-set signal is emitted when the user changes the switch position. The default handler calls [method@Gtk.Switch.set_state] with the value of @state. To implement delayed state change, applications can connect to this signal, initiate the change of the underlying state, and call [method@Gtk.Switch.set_state] when the underlying state change is complete. The signal handler should return %TRUE to prevent the default handler from running.
Fn is the Aussom callback.Fn is called with (Switch Self, bool State).UserData is retained and passed through to the generated callback wrapper when provided.The connected handler id.getProperty (string Name)
Reads one generated property by name.
setProperty (string Name, Value)
Writes one generated property by name.
setActive (bool Value)
Whether the
GtkSwitchwidget is in its on or off state.
Value is the new property value.None.setState (bool Value)
The backend state that is controlled by the switch. Applications should usually set the [property@Gtk.Switch:active] property, except when indicating a change to the backend state which occurs separately from the user's interaction. See [signal@Gtk.Switch::state-set] for details.
Value is the new property value.None.get_active ()
Gets whether the
GtkSwitchis in its “on” or “off” state.
get_state ()
Gets the underlying state of the
GtkSwitch.
set_active (bool is_active)
Changes the state of @self to the desired one.
is_active is %TRUE if @self should be active, and %FALSE otherwise.None.set_state (bool state)
Sets the underlying state of the
GtkSwitch. This function is typically called from a [signal@Gtk.Switch::state-set] signal handler in order to set up delayed state changes. See [signal@Gtk.Switch::state-set] for details.
state is the new state.None.[448:14] static extends: object
Generated metadata helpers for Switch class surfaces.
properties ()
Returns property metadata for
Switch.
A list.signals ()
Returns signal metadata for
Switch.
A list.[377:7] extends: object
Generated low-level callback wrapper for GIR callback state-set.
SwitchStatesetCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (nativeSelf, state, nativeUserData)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.

Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.