gtk.switch_
Module for [Switch] class
Types 3
classSwitch : gtk.widget.Widget, gtk.actionable.Actionable, gtk.activatable.Activatable
#GtkSwitch is a widget 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 #GtkSwitch::state-set for details.
CSS nodes
switch
╰── sliderGtkSwitch has two css nodes, the main node with the name switch and a subnode named slider. Neither of them is using any style classes.
Methods
Switch self()Returns `this`, for use in `with` statements.SwitchGidBuilder builder()Get builder for [gtk.switch_.Switch] Returns: New builder objectbool active() @propertyGet `active` property. Returns: Whether the #GtkSwitch widget is in its on or off state.void active(bool propval) @propertySet `active` property. Params: propval = Whether the #GtkSwitch widget is in its on or off state.bool state() @propertyGet `state` property. Returns: The backend state that is controlled by the switch. See #GtkSwitch::state-set for details.void state(bool propval) @propertySet `state` property. Params: propval = The backend state that is controlled by the switch. See #GtkSwitch::state-set for details.bool getActive()Gets whether the #GtkSwitch is in its “on” or “off” state. Returns: true if the #GtkSwitch is active, and false otherwisebool getState()Gets the underlying state of the #GtkSwitch. Returns: the underlying statevoid setActive(bool isActive)Changes the state of sw to the desired one.void setState(bool state)Sets the underlying state of the #GtkSwitch.gulong connectActivate(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.switch_.Switch)))
&& Parameters!T.length < 2)Connect to `Activate` signal.gulong connectStateSet(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == bool)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == bool)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.switch_.Switch)))
&& Parameters!T.length < 3)Connect to `StateSet` signal.classSwitchGidBuilderImpl(T) : gtk.widget.WidgetGidBuilderImpl!T, gtk.actionable.ActionableGidBuilderImpl!T, gtk.activatable.ActivatableGidBuilderImpl!T
Methods
T active(bool propval)Set `active` property. Params: propval = Whether the #GtkSwitch widget is in its on or off state. Returns: Builder instance for fluent chainingT state(bool propval)Set `state` property. Params: propval = The backend state that is controlled by the switch. See #GtkSwitch::state-set for details. Returns: Builder instance for fluent chainingFluent builder for [gtk.switch_.Switch]
Methods
Switch build()