]> Pileus Git - ~andy/gtk/blob - docs/reference/gtk/tmpl/gtkradiobutton.sgml
Add two more folder modes to the enum.
[~andy/gtk] / docs / reference / gtk / tmpl / gtkradiobutton.sgml
1 <!-- ##### SECTION Title ##### -->
2 GtkRadioButton
3
4 <!-- ##### SECTION Short_Description ##### -->
5 A choice from multiple check buttons.
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
9 A single radio button performs the same basic function as a #GtkCheckButton,
10 as its position in the object hierarchy reflects. It is only when multiple
11 radio buttons are grouped together that they become a different user
12 interface component in their own right.</para>
13 <para>
14 Every radio button is a member of some group of radio buttons. When one is selected, all other
15 radio buttons in the same group are deselected. A #GtkRadioButton is one way
16 of giving the user a choice from many options.
17 </para>
18 <para>
19 Radio button widgets are created with gtk_radio_button_new(), passing NULL
20 as the argument if this is the first radio button in a group. In subsequent
21 calls, the group you wish to add this button to should be passed as an
22 argument. Optionally, gtk_radio_button_new_with_label() can be used if you
23 want a text label on the radio button.
24 </para>
25 <para>
26 Alternatively, when adding widgets to an existing group of radio buttons,
27 use gtk_radio_button_new_from_widget() with a #GtkRadioButton that already
28 has a group assigned to it. The convenience function
29 gtk_radio_button_new_with_label_from_widget() is also provided.
30 </para>
31 <para>
32 To retrieve the group a #GtkRadioButton is assigned to, use
33 gtk_radio_button_get_group().
34 </para>
35 <para>
36 To remove a #GtkRadioButton from one group and make it part of a new one, use gtk_radio_button_set_group().
37 </para>
38 <para>
39 The group list does not need to be freed, as each #GtkRadioButton will remove
40 itself and its list item when it is destroyed.
41 </para>
42 <para>
43 <example>
44 <title>How to create a group of two radio buttons.</title>
45 <programlisting>
46
47 void create_radio_buttons (void) {
48
49    GtkWidget *window, *radio1, *radio2, *box, *entry;
50    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
51    box = gtk_vbox_new (TRUE, 2);
52    
53    /* Create a radio button with a GtkEntry widget */
54    radio1 = gtk_radio_button_new (NULL);
55    entry = gtk_entry_new (<!-- -->);
56    gtk_container_add (GTK_CONTAINER (radio1), entry);
57    
58    
59    /* Create a radio button with a label */
60    radio2 = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio1),
61                                                         "I'm the second radio button.");
62    
63    /* Pack them into a box, then show all the widgets */
64    gtk_box_pack_start (GTK_BOX (box), radio1, TRUE, TRUE, 2);
65    gtk_box_pack_start (GTK_BOX (box), radio2, TRUE, TRUE, 2);
66    gtk_container_add (GTK_CONTAINER (window), box);
67    gtk_widget_show_all (window);
68    return;
69 }
70
71 </programlisting>
72 </example>
73 </para>
74
75 <!-- ##### SECTION See_Also ##### -->
76 <para>
77 <variablelist>
78 <varlistentry>
79 <term>#GtkOptionMenu</term>
80 <listitem><para>Another way of offering the user a single choice from
81 many.</para></listitem>
82 </varlistentry>
83 </variablelist>
84
85 </para>
86
87 <!-- ##### STRUCT GtkRadioButton ##### -->
88 <para>
89 Contains only private data that should be read and manipulated using the
90 functions below.
91 </para>
92
93
94 <!-- ##### SIGNAL GtkRadioButton::group-changed ##### -->
95 <para>
96
97 </para>
98
99 @radiobutton: the object which received the signal.
100
101 <!-- ##### ARG GtkRadioButton:group ##### -->
102 <para>
103 Sets a new group for a radio button.
104 </para>
105
106 <!-- ##### FUNCTION gtk_radio_button_new ##### -->
107 <para>
108 Creates a new #GtkRadioButton. To be of any practical value, a widget should
109 then be packed into the radio button.
110 </para>
111
112 @group: an existing radio button group, or %NULL if you are creating a new group.
113 @Returns: a new radio button.
114
115
116 <!-- ##### FUNCTION gtk_radio_button_new_from_widget ##### -->
117 <para>
118 Creates a new #GtkRadioButton, adding it to the same group as @group. As
119 with gtk_radio_button_new(), a widget should be packed into the radio button.
120 </para>
121
122 @group: an existing #GtkRadioButton.
123 @Returns: a new radio button.
124
125
126 <!-- ##### FUNCTION gtk_radio_button_new_with_label ##### -->
127 <para>
128 Creates a new #GtkRadioButton with a text label.
129 </para>
130
131 @group: an existing radio button group, or %NULL if you are creating a new
132 group.
133 @label: the text label to display next to the radio button.
134 @Returns: a new radio button.
135
136
137 <!-- ##### FUNCTION gtk_radio_button_new_with_label_from_widget ##### -->
138 <para>
139 Creates a new #GtkRadioButton with a text label, adding it to the same group
140 as @group.
141 </para>
142
143 @group: an existing #GtkRadioButton.
144 @label: a text string to display next to the radio button.
145 @Returns: a new radio button.
146
147
148 <!-- ##### FUNCTION gtk_radio_button_new_with_mnemonic ##### -->
149 <para>
150
151 </para>
152
153 @group: 
154 @label: 
155 @Returns: 
156
157
158 <!-- ##### FUNCTION gtk_radio_button_new_with_mnemonic_from_widget ##### -->
159 <para>
160
161 </para>
162
163 @group: 
164 @label: 
165 @Returns: 
166
167
168 <!-- ##### MACRO gtk_radio_button_group ##### -->
169 <para>
170 Deprecated compatibility macro. Use gtk_radio_button_get_group() instead.
171 </para>
172
173
174
175 <!-- ##### FUNCTION gtk_radio_button_set_group ##### -->
176 <para>
177 Sets a #GtkRadioButton's group. It should be noted that this does not change
178 the layout of your interface in any way, so if you are changing the group,
179 it is likely you will need to re-arrange the user interface to reflect these
180 changes.
181 </para>
182
183 @radio_button: a #GtkRadioButton.
184 @group: an existing radio button group, such as one returned from
185 gtk_radio_button_get_group().
186
187
188 <!-- ##### FUNCTION gtk_radio_button_get_group ##### -->
189 <para>
190 Retrieves the group assigned to a radio button.
191 </para>
192
193 @radio_button: a #GtkRadioButton.
194 @Returns: a linked list containing all the radio buttons in the same group
195 as @radio_button.
196
197