It derives from <GtkWidget>.
Shows 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 slider.
<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
switch:active property), while the
trough color indicates the present underlying state (represented by the
switch:state property).
See switch:state-set for details.
<GtkSwitch> supports pan and drag gestures to move
the slider.
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.
<GtkSwitch> uses the
Gtk.AccessibleRole.switch role.
Whether the <GtkSwitch> widget is in its on or off
state.
Its value is a boolean.
Set it with (set! (switch:active self) value).
The backend state that is controlled by the switch.
Applications should usually set the switch:active property, except when indicating a change to the
backend state which occurs separately from the user’s interaction.
See switch:state-set for details.
Its value is a boolean.
Set it with (set! (switch:state self) value).
Gets whether the <GtkSwitch> is in its “on” or
“off” state.
Passed: a <GtkSwitch>.
Returned: a boolean.
#t if the <GtkSwitch> is active, and
#f otherwise
Gets the underlying state of the <GtkSwitch>.
Passed: a <GtkSwitch>.
Returned: a boolean.
the underlying state
Creates a new <GtkSwitch> widget.
Returned: a <GtkWidget>.
the newly created <GtkSwitch> instance
Changes the state of self to the desired one.
Passed: a <GtkSwitch>.
Passed: a boolean.
#t if self should be active, and #f otherwise
Sets the underlying state of the <GtkSwitch>.
This function is typically called from a switch:state-set signal handler in order to set up delayed
state changes.
See switch:state-set for details.
Passed: a <GtkSwitch>.
Passed: a boolean.
the new state
Connect a handler with (connect object switch:activate handler).
It is called as (handler self).
Emitted to animate the switch.
Applications should never connect to this signal, but use the
switch:active property.
Passed: a <GtkSwitch>.
Connect a handler with (connect object switch:state-set handler).
It is called as (handler self state) ⇒ %return.
Emitted to change the underlying state.
The ::state-set signal is emitted when the user changes the switch
position. The default handler calls 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
switch:set-state when the underlying
state change is complete. The signal handler should return #t to
prevent the default handler from running.
Passed: a <GtkSwitch>.
Passed: a boolean.
the new state of the switch
Returned: a boolean.
#t to stop the signal emission