Gtk.Switch.Gtk_Switch 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 Gtk.Switch.Gtk_Switch::state-set for details.
# CSS nodes
switch
â°ââ slider
GtkSwitch has two css nodes, the main node with the name switch and a subnode named slider. Neither of them is using any style classes.
function "+"
(Widget : access Gtk_Switch_Record'Class)
return Gtk.Actionable.Gtk_Actionable
function "+"
(Widget : access Gtk_Switch_Record'Class)
return Gtk.Activatable.Gtk_Activatable
function "+"
(Widget : access Gtk_Switch_Record'Class)
return Gtk.Buildable.Gtk_Buildable
function "-"
(Interf : Gtk.Actionable.Gtk_Actionable)
return Gtk_Switch
function "-"
(Interf : Gtk.Activatable.Gtk_Activatable)
return Gtk_Switch
function "-"
(Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_Switch
Active_Property : constant Glib.Properties.Property_Boolean;
Whether the Gtk.Switch.Gtk_Switch widget is in its on or off state.
type Cb_GObject_Boolean_Boolean is not null access function
(Self : access Glib.Object.GObject_Record'Class;
State : Boolean) return Boolean;
type Cb_GObject_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class);
type Cb_Gtk_Switch_Boolean_Boolean is not null access function
(Self : access Gtk_Switch_Record'Class;
State : Boolean) return Boolean;
type Cb_Gtk_Switch_Void is not null access procedure (Self : access Gtk_Switch_Record'Class);
procedure Do_Set_Related_Action
(Self : not null access Gtk_Switch_Record;
Action : not null access Gtk.Action.Gtk_Action_Record'Class)
function Get_Action_Name
(Self : not null access Gtk_Switch_Record) return UTF8_String
function Get_Action_Target_Value
(Self : not null access Gtk_Switch_Record)
return Glib.Variant.Gvariant
function Get_Active
(Self : not null access Gtk_Switch_Record) return Boolean
Gets whether the Gtk.Switch.Gtk_Switch is in its "on" or "off" state. Since: gtk+ 3.0
True if the Gtk.Switch.Gtk_Switch is active, and False otherwise
function Get_Related_Action
(Self : not null access Gtk_Switch_Record)
return Gtk.Action.Gtk_Action
function Get_State
(Self : not null access Gtk_Switch_Record) return Boolean
Gets the underlying state of the Gtk.Switch.Gtk_Switch. Since: gtk+ 3.14
the underlying state
function Get_Type return Glib.GType
function Get_Use_Action_Appearance
(Self : not null access Gtk_Switch_Record) return Boolean
procedure Gtk_New (Self : out Gtk_Switch)
Creates a new Gtk.Switch.Gtk_Switch widget. Since: gtk+ 3.0 Initialize does nothing if the object was already created with another call to Initialize* or G_New.
type Gtk_Switch is access all Gtk_Switch_Record'Class;
function Gtk_Switch_New return Gtk_Switch
Creates a new Gtk.Switch.Gtk_Switch widget. Since: gtk+ 3.0
type Gtk_Switch_Record is new Gtk_Widget_Record with null record;
package Implements_Gtk_Actionable is new Glib.Types.Implements
(Gtk.Actionable.Gtk_Actionable, Gtk_Switch_Record, Gtk_Switch);
package Implements_Gtk_Activatable is new Glib.Types.Implements
(Gtk.Activatable.Gtk_Activatable, Gtk_Switch_Record, Gtk_Switch);
package Implements_Gtk_Buildable is new Glib.Types.Implements
(Gtk.Buildable.Gtk_Buildable, Gtk_Switch_Record, Gtk_Switch);
procedure Initialize (Self : not null access Gtk_Switch_Record'Class)
Creates a new Gtk.Switch.Gtk_Switch widget. Since: gtk+ 3.0 Initialize does nothing if the object was already created with another call to Initialize* or G_New.
procedure On_Activate
(Self : not null access Gtk_Switch_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
The ::activate signal on GtkSwitch is an action signal and emitting it causes the switch to animate. Applications should never connect to this signal, but use the notify::active signal.
procedure On_Activate
(Self : not null access Gtk_Switch_Record;
Call : Cb_Gtk_Switch_Void;
After : Boolean := False)
The ::activate signal on GtkSwitch is an action signal and emitting it causes the switch to animate. Applications should never connect to this signal, but use the notify::active signal.
procedure On_State_Set
(Self : not null access Gtk_Switch_Record;
Call : Cb_GObject_Boolean_Boolean;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
The ::state-set signal on GtkSwitch is emitted to change the underlying state. It is emitted when the user changes the switch position. The default handler keeps the state in sync with the Gtk.Switch.Gtk_Switch:active property.
To implement delayed state change, applications can connect to this signal, initiate the change of the underlying state, and call Gtk.Switch.Set_State when the underlying state change is complete. The signal handler should return True to prevent the default handler from running.
Visually, the underlying state is represented by the trough color of the switch, while the Gtk.Switch.Gtk_Switch:active property is represented by the position of the switch.
Callback parameters: -- @param State the new state of the switch
procedure On_State_Set
(Self : not null access Gtk_Switch_Record;
Call : Cb_Gtk_Switch_Boolean_Boolean;
After : Boolean := False)
The ::state-set signal on GtkSwitch is emitted to change the underlying state. It is emitted when the user changes the switch position. The default handler keeps the state in sync with the Gtk.Switch.Gtk_Switch:active property.
To implement delayed state change, applications can connect to this signal, initiate the change of the underlying state, and call Gtk.Switch.Set_State when the underlying state change is complete. The signal handler should return True to prevent the default handler from running.
Visually, the underlying state is represented by the trough color of the switch, while the Gtk.Switch.Gtk_Switch:active property is represented by the position of the switch.
Callback parameters: -- @param State the new state of the switch
procedure Set_Action_Name
(Self : not null access Gtk_Switch_Record;
Action_Name : UTF8_String := "")
procedure Set_Action_Target_Value
(Self : not null access Gtk_Switch_Record;
Target_Value : Glib.Variant.Gvariant)
procedure Set_Active
(Self : not null access Gtk_Switch_Record;
Is_Active : Boolean)
Changes the state of Sw to the desired one. Since: gtk+ 3.0
True if Sw should be active, and False otherwise
procedure Set_Detailed_Action_Name
(Self : not null access Gtk_Switch_Record;
Detailed_Action_Name : UTF8_String)
procedure Set_Related_Action
(Self : not null access Gtk_Switch_Record;
Action : not null access Gtk.Action.Gtk_Action_Record'Class)
procedure Set_State
(Self : not null access Gtk_Switch_Record;
State : Boolean)
Sets the underlying state of the Gtk.Switch.Gtk_Switch. Normally, this is the same as Gtk.Switch.Gtk_Switch:active, unless the switch is set up for delayed state changes. This function is typically called from a Gtk.Switch.Gtk_Switch::state-set signal handler. See Gtk.Switch.Gtk_Switch::state-set for details. Since: gtk+ 3.14
the new state
procedure Set_Use_Action_Appearance
(Self : not null access Gtk_Switch_Record;
Use_Appearance : Boolean)
Signal_Activate : constant Glib.Signal_Name := "activate";
The ::activate signal on GtkSwitch is an action signal and emitting it causes the switch to animate. Applications should never connect to this signal, but use the notify::active signal.
Signal_State_Set : constant Glib.Signal_Name := "state-set";
The ::state-set signal on GtkSwitch is emitted to change the underlying state. It is emitted when the user changes the switch position. The default handler keeps the state in sync with the Gtk.Switch.Gtk_Switch:active property.
To implement delayed state change, applications can connect to this signal, initiate the change of the underlying state, and call Gtk.Switch.Set_State when the underlying state change is complete. The signal handler should return True to prevent the default handler from running.
Visually, the underlying state is represented by the trough color of the switch, while the Gtk.Switch.Gtk_Switch:active property is represented by the position of the switch.
Callback parameters: -- @param State the new state of the switch
State_Property : constant Glib.Properties.Property_Boolean;
The backend state that is controlled by the switch. See Gtk.Switch.Gtk_Switch::state-set for details.
procedure Sync_Action_Properties
(Self : not null access Gtk_Switch_Record;
Action : access Gtk.Action.Gtk_Action_Record'Class)