package Implements_Gtk_Actionable is new Glib.Types.Implements (Gtk.Actionable.Gtk_Actionable, Gtk_Toggle_Button_Record, Gtk_Toggle_Button);
package Implements_Gtk_Activatable is new Glib.Types.Implements (Gtk.Activatable.Gtk_Activatable, Gtk_Toggle_Button_Record, Gtk_Toggle_Button);
package Implements_Gtk_Buildable is new Glib.Types.Implements (Gtk.Buildable.Gtk_Buildable, Gtk_Toggle_Button_Record, Gtk_Toggle_Button);
type Gtk_Toggle_Button_Record is new Gtk_Button_Record with null record;
type Gtk_Toggle_Button is access all Gtk_Toggle_Button_Record'Class;
type Cb_Gtk_Toggle_Button_Void is not null access procedure (Self : access Gtk_Toggle_Button_Record'Class);
type Cb_GObject_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class);
Active_Property : constant Glib.Properties.Property_Boolean;
Draw_Indicator_Property : constant Glib.Properties.Property_Boolean;
Inconsistent_Property : constant Glib.Properties.Property_Boolean;
Signal_Toggled : constant Glib.Signal_Name := "toggled";
procedure Gtk_New
( | Toggle_Button | : out Gtk_Toggle_Button; |
Label | : UTF8_String := ""); |
procedure Initialize
( | Toggle_Button | : not null access Gtk_Toggle_Button_Record'Class; |
Label | : UTF8_String := ""); |
function Gtk_Toggle_Button_New_With_Label
( | Label | : UTF8_String := "") return Gtk_Toggle_Button; |
procedure Gtk_New_With_Mnemonic
( | Toggle_Button | : out Gtk_Toggle_Button; |
Label | : UTF8_String); |
procedure Initialize_With_Mnemonic
( | Toggle_Button | : not null access Gtk_Toggle_Button_Record'Class; |
Label | : UTF8_String); |
function Gtk_Toggle_Button_New_With_Mnemonic
( | Label | : UTF8_String) return Gtk_Toggle_Button; |
function Get_Type return Glib.GType;
function Get_Active
( | Toggle_Button | : not null access Gtk_Toggle_Button_Record) return Boolean; |
procedure Set_Active
( | Toggle_Button | : not null access Gtk_Toggle_Button_Record; |
Is_Active | : Boolean); |
function Get_Inconsistent
( | Toggle_Button | : not null access Gtk_Toggle_Button_Record) return Boolean; |
procedure Set_Inconsistent
( | Toggle_Button | : not null access Gtk_Toggle_Button_Record; |
Setting | : Boolean := True); |
function Get_Mode
( | Toggle_Button | : not null access Gtk_Toggle_Button_Record) return Boolean; |
procedure Set_Mode
( | Toggle_Button | : not null access Gtk_Toggle_Button_Record; |
Draw_Indicator | : Boolean); |
procedure Toggled
( | Toggle_Button | : not null access Gtk_Toggle_Button_Record); |
function Get_Action_Name
( | Self | : not null access Gtk_Toggle_Button_Record) return UTF8_String; |
procedure Set_Action_Name
( | Self | : not null access Gtk_Toggle_Button_Record; |
Action_Name | : UTF8_String); |
function Get_Action_Target_Value
( | Self | : not null access Gtk_Toggle_Button_Record) return Glib.Variant.Gvariant; |
procedure Set_Action_Target_Value
( | Self | : not null access Gtk_Toggle_Button_Record; |
Target_Value | : Glib.Variant.Gvariant); |
procedure Set_Detailed_Action_Name
( | Self | : not null access Gtk_Toggle_Button_Record; |
Detailed_Action_Name | : UTF8_String); |
procedure Do_Set_Related_Action
( | Self | : not null access Gtk_Toggle_Button_Record; |
Action | : not null access Gtk.Action.Gtk_Action_Record'Class); |
function Get_Related_Action
( | Self | : not null access Gtk_Toggle_Button_Record) return Gtk.Action.Gtk_Action; |
procedure Set_Related_Action
( | Self | : not null access Gtk_Toggle_Button_Record; |
Action | : not null access Gtk.Action.Gtk_Action_Record'Class); |
function Get_Use_Action_Appearance
( | Self | : not null access Gtk_Toggle_Button_Record) return Boolean; |
procedure Set_Use_Action_Appearance
( | Self | : not null access Gtk_Toggle_Button_Record; |
Use_Appearance | : Boolean); |
procedure Sync_Action_Properties
( | Self | : not null access Gtk_Toggle_Button_Record; |
Action | : access Gtk.Action.Gtk_Action_Record'Class); |
procedure On_Toggled
( | Self | : not null access Gtk_Toggle_Button_Record; |
Call | : Cb_Gtk_Toggle_Button_Void; | |
After | : Boolean := False); |
procedure On_Toggled
( | Self | : not null access Gtk_Toggle_Button_Record; |
Call | : Cb_GObject_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
function "+"
( | Widget | : access Gtk_Toggle_Button_Record'Class) return Gtk.Actionable.Gtk_Actionable renames Implements_Gtk_Actionable.To_Interface; |
function "-"
( | Interf | : Gtk.Actionable.Gtk_Actionable) return Gtk_Toggle_Button renames Implements_Gtk_Actionable.To_Object; |
function "+"
( | Widget | : access Gtk_Toggle_Button_Record'Class) return Gtk.Activatable.Gtk_Activatable renames Implements_Gtk_Activatable.To_Interface; |
function "-"
( | Interf | : Gtk.Activatable.Gtk_Activatable) return Gtk_Toggle_Button renames Implements_Gtk_Activatable.To_Object; |
function "+"
( | Widget | : access Gtk_Toggle_Button_Record'Class) return Gtk.Buildable.Gtk_Buildable renames Implements_Gtk_Buildable.To_Interface; |
function "-"
( | Interf | : Gtk.Buildable.Gtk_Buildable) return Gtk_Toggle_Button renames Implements_Gtk_Buildable.To_Object; |
A Gtk.Toggle_Button.Gtk_Toggle_Button is a Gtk.Button.Gtk_Button which will remain 'pressed-in' when clicked. Clicking again will cause the toggle button to return to its normal state.
A toggle button is created by calling either gtk_toggle_button_new or Gtk.Toggle_Button.Gtk_New. If using the former, it is advisable to pack a widget, (such as a Gtk.Label.Gtk_Label and/or a Gtk.Image.Gtk_Image), into the toggle button's container. (See Gtk.Button.Gtk_Button for more information).
The state of a Gtk.Toggle_Button.Gtk_Toggle_Button can be set specifically using Gtk.Toggle_Button.Set_Active, and retrieved using Gtk.Toggle_Button.Get_Active.
To simply switch the state of a toggle button, use Gtk.Toggle_Button.Toggled. == Creating two Gtk.Toggle_Button.Gtk_Toggle_Button widgets. == void make_toggles (void) { GtkWidget *dialog, *toggle1, *toggle2; dialog = gtk_dialog_new (<!-- -->); toggle1 = gtk_toggle_button_new_with_label ("Hi, i'm a toggle button."); // Makes this toggle button invisible gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (toggle1), TRUE); g_signal_connect (toggle1, "toggled", G_CALLBACK (output_state), NULL); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), toggle1, FALSE, FALSE, 2); toggle2 = gtk_toggle_button_new_with_label ("Hi, i'm another toggle button."); gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (toggle2), FALSE); g_signal_connect (toggle2, "toggled", G_CALLBACK (output_state), NULL); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), toggle2, FALSE, FALSE, 2); gtk_widget_show_all (dialog); }