package Implements_Gtk_Actionable is new Glib.Types.Implements (Gtk.Actionable.Gtk_Actionable, Gtk_Radio_Button_Record, Gtk_Radio_Button);
package Implements_Gtk_Activatable is new Glib.Types.Implements (Gtk.Activatable.Gtk_Activatable, Gtk_Radio_Button_Record, Gtk_Radio_Button);
package Implements_Gtk_Buildable is new Glib.Types.Implements (Gtk.Buildable.Gtk_Buildable, Gtk_Radio_Button_Record, Gtk_Radio_Button);
type Gtk_Radio_Button_Record is new Gtk_Check_Button_Record with null record;
type Gtk_Radio_Button is access all Gtk_Radio_Button_Record'Class;
type Cb_Gtk_Radio_Button_Void is not null access procedure (Self : access Gtk_Radio_Button_Record'Class);
type Cb_GObject_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class);
Group_Property : constant Glib.Properties.Property_Object;
Signal_Group_Changed : constant Glib.Signal_Name := "group-changed";
procedure Gtk_New
( | Radio_Button | : out Gtk_Radio_Button; |
Group | : Gtk.Widget.Widget_SList.GSlist := Widget_SList.Null_List; | |
Label | : UTF8_String := ""); |
procedure Initialize
( | Radio_Button | : not null access Gtk_Radio_Button_Record'Class; |
Group | : Gtk.Widget.Widget_SList.GSlist := Widget_SList.Null_List; | |
Label | : UTF8_String := ""); |
function Gtk_Radio_Button_New_With_Label
( | Group | : Gtk.Widget.Widget_SList.GSlist := Widget_SList.Null_List; |
Label | : UTF8_String := "") return Gtk_Radio_Button; |
procedure Gtk_New
( | Radio_Button | : out Gtk_Radio_Button; |
Group | : access Gtk_Radio_Button_Record'Class; | |
Label | : UTF8_String := ""); |
procedure Initialize
( | Radio_Button | : not null access Gtk_Radio_Button_Record'Class; |
Group | : access Gtk_Radio_Button_Record'Class; | |
Label | : UTF8_String := ""); |
function Gtk_Radio_Button_New_With_Label_From_Widget
( | Group | : access Gtk_Radio_Button_Record'Class; |
Label | : UTF8_String := "") return Gtk_Radio_Button; |
procedure Gtk_New_With_Mnemonic
( | Radio_Button | : out Gtk_Radio_Button; |
Group | : Gtk.Widget.Widget_SList.GSlist := Widget_SList.Null_List; | |
Label | : UTF8_String); |
procedure Initialize_With_Mnemonic
( | Radio_Button | : not null access Gtk_Radio_Button_Record'Class; |
Group | : Gtk.Widget.Widget_SList.GSlist := Widget_SList.Null_List; | |
Label | : UTF8_String); |
procedure Gtk_New_With_Mnemonic
( | Radio_Button | : out Gtk_Radio_Button; |
Group | : access Gtk_Radio_Button_Record'Class; | |
Label | : UTF8_String); |
procedure Initialize_With_Mnemonic
( | Radio_Button | : not null access Gtk_Radio_Button_Record'Class; |
Group | : access Gtk_Radio_Button_Record'Class; | |
Label | : UTF8_String); |
function Gtk_Radio_Button_New_With_Mnemonic
( | Group | : Gtk.Widget.Widget_SList.GSlist := Widget_SList.Null_List; |
Label | : UTF8_String) return Gtk_Radio_Button; |
function Gtk_Radio_Button_New_With_Mnemonic_From_Widget
( | Group | : access Gtk_Radio_Button_Record'Class; |
Label | : UTF8_String) return Gtk_Radio_Button; |
function Get_Type return Glib.GType;
function Get_Group
( | Radio_Button | : not null access Gtk_Radio_Button_Record) return Gtk.Widget.Widget_SList.GSlist; |
procedure Set_Group
( | Radio_Button | : not null access Gtk_Radio_Button_Record; |
Group | : Gtk.Widget.Widget_SList.GSlist); |
procedure Join_Group
( | Radio_Button | : not null access Gtk_Radio_Button_Record; |
Group_Source | : access Gtk_Radio_Button_Record'Class); |
function Get_Action_Name
( | Self | : not null access Gtk_Radio_Button_Record) return UTF8_String; |
procedure Set_Action_Name
( | Self | : not null access Gtk_Radio_Button_Record; |
Action_Name | : UTF8_String); |
function Get_Action_Target_Value
( | Self | : not null access Gtk_Radio_Button_Record) return Glib.Variant.Gvariant; |
procedure Set_Action_Target_Value
( | Self | : not null access Gtk_Radio_Button_Record; |
Target_Value | : Glib.Variant.Gvariant); |
procedure Set_Detailed_Action_Name
( | Self | : not null access Gtk_Radio_Button_Record; |
Detailed_Action_Name | : UTF8_String); |
procedure Do_Set_Related_Action
( | Self | : not null access Gtk_Radio_Button_Record; |
Action | : not null access Gtk.Action.Gtk_Action_Record'Class); |
function Get_Related_Action
( | Self | : not null access Gtk_Radio_Button_Record) return Gtk.Action.Gtk_Action; |
procedure Set_Related_Action
( | Self | : not null access Gtk_Radio_Button_Record; |
Action | : not null access Gtk.Action.Gtk_Action_Record'Class); |
function Get_Use_Action_Appearance
( | Self | : not null access Gtk_Radio_Button_Record) return Boolean; |
procedure Set_Use_Action_Appearance
( | Self | : not null access Gtk_Radio_Button_Record; |
Use_Appearance | : Boolean); |
procedure Sync_Action_Properties
( | Self | : not null access Gtk_Radio_Button_Record; |
Action | : access Gtk.Action.Gtk_Action_Record'Class); |
procedure On_Group_Changed
( | Self | : not null access Gtk_Radio_Button_Record; |
Call | : Cb_Gtk_Radio_Button_Void; | |
After | : Boolean := False); |
procedure On_Group_Changed
( | Self | : not null access Gtk_Radio_Button_Record; |
Call | : Cb_GObject_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
function "+"
( | Widget | : access Gtk_Radio_Button_Record'Class) return Gtk.Actionable.Gtk_Actionable renames Implements_Gtk_Actionable.To_Interface; |
function "-"
( | Interf | : Gtk.Actionable.Gtk_Actionable) return Gtk_Radio_Button renames Implements_Gtk_Actionable.To_Object; |
function "+"
( | Widget | : access Gtk_Radio_Button_Record'Class) return Gtk.Activatable.Gtk_Activatable renames Implements_Gtk_Activatable.To_Interface; |
function "-"
( | Interf | : Gtk.Activatable.Gtk_Activatable) return Gtk_Radio_Button renames Implements_Gtk_Activatable.To_Object; |
function "+"
( | Widget | : access Gtk_Radio_Button_Record'Class) return Gtk.Buildable.Gtk_Buildable renames Implements_Gtk_Buildable.To_Interface; |
function "-"
( | Interf | : Gtk.Buildable.Gtk_Buildable) return Gtk_Radio_Button renames Implements_Gtk_Buildable.To_Object; |
A single radio button performs the same basic function as a Gtk.Check_Button.Gtk_Check_Button, as its position in the object hierarchy reflects. It is only when multiple radio buttons are grouped together that they become a different user interface component in their own right.
Every radio button is a member of some group of radio buttons. When one is selected, all other radio buttons in the same group are deselected. A Gtk.Radio_Button.Gtk_Radio_Button is one way of giving the user a choice from many options.
Radio button widgets are created with gtk_radio_button_new, passing null as the argument if this is the first radio button in a group. In subsequent calls, the group you wish to add this button to should be passed as an argument. Optionally, Gtk.Radio_Button.Gtk_New can be used if you want a text label on the radio button.
Alternatively, when adding widgets to an existing group of radio buttons, use gtk_radio_button_new_from_widget with a Gtk.Radio_Button.Gtk_Radio_Button that already has a group assigned to it.
The convenience function Gtk.Radio_Button.Gtk_New is also provided.
To retrieve the group a Gtk.Radio_Button.Gtk_Radio_Button is assigned to, use Gtk.Radio_Button.Get_Group.
To remove a Gtk.Radio_Button.Gtk_Radio_Button from one group and make it part of a new one, use Gtk.Radio_Button.Set_Group.
The group list does not need to be freed, as each Gtk.Radio_Button.Gtk_Radio_Button will remove itself and its list item when it is destroyed. == How to create a group of two radio buttons. == void create_radio_buttons (void) { GtkWidget *window, *radio1, *radio2, *box, *entry; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); gtk_box_set_homogeneous (GTK_BOX (box), TRUE); /* Create a radio button with a GtkEntry widget */ radio1 = gtk_radio_button_new (NULL); entry = gtk_entry_new (<!-- -->); gtk_container_add (GTK_CONTAINER (radio1), entry); /* Create a radio button with a label */ radio2 = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio1), "I'm the second radio button."); /* Pack them into a box, then show all the widgets */ gtk_box_pack_start (GTK_BOX (box), radio1, TRUE, TRUE, 2); gtk_box_pack_start (GTK_BOX (box), radio2, TRUE, TRUE, 2); gtk_container_add (GTK_CONTAINER (window), box); gtk_widget_show_all (window); return; } When an unselected button in the group is clicked the clicked button receives the Gtk.Toggle_Button.Gtk_Toggle_Button::toggled signal, as does the previously selected button. Inside the Gtk.Toggle_Button.Gtk_Toggle_Button::toggled handler, Gtk.Toggle_Button.Get_Active can be used to determine if the button has been selected or deselected.