~ubuntu-branches/ubuntu/precise/gtk+2.0/precise-updates

« back to all changes in this revision

Viewing changes to docs/reference/gtk/tmpl/gtktogglebutton.sgml

  • Committer: Package Import Robot
  • Author(s): Ken VanDine
  • Date: 2011-12-01 11:40:06 UTC
  • mfrom: (1.14.11)
  • Revision ID: package-import@ubuntu.com-20111201114006-nrmf6qu3pg512veo
Tags: 2.24.8-0ubuntu1
* New upstream release 
  - gtkfilechooser should be more robust to malformed URIs
    in .gtk-bookmarks (LP: #189494)
* debian/patches/010_make_bg_changes_queue_repaint.patch
  - dropped it introduces performance regressions in some gtk2 
    apps (LP: #889019)
* 101_filechooser.patch, 000git_file_chooser.patch: dropped, upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!-- ##### SECTION Title ##### -->
2
 
GtkToggleButton
3
 
 
4
 
<!-- ##### SECTION Short_Description ##### -->
5
 
Create buttons which retain their state
6
 
 
7
 
<!-- ##### SECTION Long_Description ##### -->
8
 
<para>
9
 
A #GtkToggleButton is a #GtkButton which will remain 'pressed-in' when
10
 
clicked. Clicking again will cause the toggle button to return to its
11
 
normal state.
12
 
</para>
13
 
<para>
14
 
A toggle button is created by calling either gtk_toggle_button_new() or
15
 
gtk_toggle_button_new_with_label(). If using the former, it is advisable to
16
 
pack a widget, (such as a #GtkLabel and/or a #GtkPixmap), into the toggle
17
 
button's container. (See #GtkButton for more information).
18
 
</para>
19
 
<para>
20
 
The state of a #GtkToggleButton can be set specifically using
21
 
gtk_toggle_button_set_active(), and retrieved using
22
 
gtk_toggle_button_get_active().
23
 
</para>
24
 
<para>
25
 
To simply switch the state of a toggle button, use gtk_toggle_button_toggled.
26
 
</para>
27
 
<example>
28
 
<title>Creating two <structname>GtkToggleButton</structname> widgets.</title>
29
 
<programlisting>
30
 
 
31
 
void make_toggles (void) {
32
 
   GtkWidget *dialog, *toggle1, *toggle2;
33
 
 
34
 
   dialog = gtk_dialog_new (<!-- -->);
35
 
   toggle1 = gtk_toggle_button_new_with_label ("Hi, i'm a toggle button.");
36
 
 
37
 
   /* Makes this toggle button invisible */
38
 
   gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (toggle1), TRUE);
39
 
   
40
 
   g_signal_connect (toggle1, "toggled",
41
 
                     G_CALLBACK (output_state), NULL);
42
 
   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area),
43
 
                       toggle1, FALSE, FALSE, 2);
44
 
 
45
 
   toggle2 = gtk_toggle_button_new_with_label ("Hi, i'm another toggle button.");
46
 
   gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (toggle2), FALSE);
47
 
   g_signal_connect (toggle2, "toggled",
48
 
                     G_CALLBACK (output_state), NULL);
49
 
   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area),
50
 
                       toggle2, FALSE, FALSE, 2);
51
 
 
52
 
   gtk_widget_show_all (dialog);
53
 
}
54
 
 
55
 
</programlisting>
56
 
</example>
57
 
 
58
 
<!-- ##### SECTION See_Also ##### -->
59
 
<para>
60
 
<variablelist>
61
 
 
62
 
<varlistentry>
63
 
  <term>#GtkButton</term>
64
 
  <listitem><para>a more general button.</para></listitem>
65
 
</varlistentry>
66
 
 
67
 
<varlistentry>
68
 
  <term>#GtkCheckButton</term>
69
 
  <listitem><para>another way of presenting a toggle option.</para></listitem>
70
 
</varlistentry>
71
 
 
72
 
<varlistentry>
73
 
  <term>#GtkCheckMenuItem</term>
74
 
  <listitem><para>a #GtkToggleButton  as a menu item.</para></listitem>
75
 
</varlistentry>
76
 
 
77
 
</variablelist>
78
 
</para>
79
 
 
80
 
<!-- ##### SECTION Stability_Level ##### -->
81
 
 
82
 
 
83
 
<!-- ##### SECTION Image ##### -->
84
 
 
85
 
 
86
 
<!-- ##### STRUCT GtkToggleButton ##### -->
87
 
<para>
88
 
The #GtkToggleButton struct contains private data only, and should be manipulated using the functions below.
89
 
</para>
90
 
 
91
 
 
92
 
<!-- ##### SIGNAL GtkToggleButton::toggled ##### -->
93
 
<para>
94
 
Should be connected if you wish to perform an action whenever the
95
 
#GtkToggleButton's state is changed.
96
 
</para>
97
 
 
98
 
@togglebutton: the object which received the signal.
99
 
 
100
 
<!-- ##### ARG GtkToggleButton:active ##### -->
101
 
<para>
102
 
 
103
 
</para>
104
 
 
105
 
<!-- ##### ARG GtkToggleButton:draw-indicator ##### -->
106
 
<para>
107
 
 
108
 
</para>
109
 
 
110
 
<!-- ##### ARG GtkToggleButton:inconsistent ##### -->
111
 
<para>
112
 
 
113
 
</para>
114
 
 
115
 
<!-- ##### FUNCTION gtk_toggle_button_new ##### -->
116
 
<para>
117
 
Creates a new toggle button. A widget should be packed into the button, as in gtk_button_new().
118
 
</para>
119
 
 
120
 
@void: 
121
 
@Returns: a new toggle button.
122
 
 
123
 
 
124
 
<!-- ##### FUNCTION gtk_toggle_button_new_with_label ##### -->
125
 
<para>
126
 
Creates a new toggle button with a text label.
127
 
</para>
128
 
 
129
 
@label: a string containing the message to be placed in the toggle button.
130
 
@Returns: a new toggle button.
131
 
 
132
 
 
133
 
<!-- ##### FUNCTION gtk_toggle_button_new_with_mnemonic ##### -->
134
 
<para>
135
 
 
136
 
</para>
137
 
 
138
 
@label: 
139
 
@Returns: 
140
 
 
141
 
 
142
 
<!-- ##### FUNCTION gtk_toggle_button_set_mode ##### -->
143
 
<para>
144
 
</para>
145
 
 
146
 
@toggle_button: 
147
 
@draw_indicator: 
148
 
 
149
 
 
150
 
<!-- ##### FUNCTION gtk_toggle_button_get_mode ##### -->
151
 
<para>
152
 
 
153
 
</para>
154
 
 
155
 
@toggle_button: 
156
 
@Returns: 
157
 
 
158
 
 
159
 
<!-- ##### MACRO gtk_toggle_button_set_state ##### -->
160
 
<para>
161
 
This is a deprecated macro, and is only maintained for compatibility reasons.
162
 
</para>
163
 
 
164
 
@Deprecated: Use gtk_toggle_button_set_active() instead.
165
 
 
166
 
 
167
 
<!-- ##### FUNCTION gtk_toggle_button_toggled ##### -->
168
 
<para>
169
 
Emits the <link linkend="GtkToggleButton-toggled">toggled</link>
170
 
signal on the #GtkToggleButton. There is no good reason for an
171
 
application ever to call this function.
172
 
</para>
173
 
 
174
 
@toggle_button: a #GtkToggleButton.
175
 
 
176
 
 
177
 
<!-- ##### FUNCTION gtk_toggle_button_get_active ##### -->
178
 
<para>
179
 
Queries a #GtkToggleButton and returns its current state. Returns %TRUE if
180
 
the toggle button is pressed in and %FALSE if it is raised.
181
 
</para>
182
 
 
183
 
@toggle_button: a #GtkToggleButton.
184
 
@Returns: a #gboolean value.
185
 
 
186
 
 
187
 
<!-- ##### FUNCTION gtk_toggle_button_set_active ##### -->
188
 
<para>
189
 
Sets the status of the toggle button. Set to %TRUE if you want the
190
 
GtkToggleButton to be 'pressed in', and %FALSE to raise it.
191
 
This action causes the toggled signal to be emitted.
192
 
</para>
193
 
 
194
 
@toggle_button: a #GtkToggleButton.
195
 
@is_active: %TRUE or %FALSE.
196
 
 
197
 
 
198
 
<!-- ##### FUNCTION gtk_toggle_button_get_inconsistent ##### -->
199
 
<para>
200
 
 
201
 
</para>
202
 
 
203
 
@toggle_button: 
204
 
@Returns: 
205
 
 
206
 
 
207
 
<!-- ##### FUNCTION gtk_toggle_button_set_inconsistent ##### -->
208
 
<para>
209
 
 
210
 
</para>
211
 
 
212
 
@toggle_button: 
213
 
@setting: 
214
 
 
215