]> Pileus Git - ~andy/gtk/blob - docs/reference/gtk/tmpl/gtkexpander.sgml
Improve GtkBuilder DTD, remove treemodel section, add more information
[~andy/gtk] / docs / reference / gtk / tmpl / gtkexpander.sgml
1 <!-- ##### SECTION Title ##### -->
2 GtkExpander
3
4 <!-- ##### SECTION Short_Description ##### -->
5 A container which can hide its child
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
9 A #GtkExpander allows the user to hide or show its child by clicking 
10 on an expander triangle similar to the triangles used in a #GtkTreeView.
11 </para>
12
13 <para>
14 Normally you use an expander as you would use any other descendant
15 of #GtkBin; you create the child widget and use gtk_container_add() 
16 to add it to the expander. When the expander is toggled, it will take 
17 care of showing and hiding the child automatically.
18 </para>
19
20 <section id="expander-special-usage">
21 <title>Special Usage</title>
22
23 <para>
24 There are situations in which you may prefer to show and hide the 
25 expanded widget yourself, such as when you want to actually create 
26 the widget at expansion time. In this case, create a #GtkExpander 
27 but do not add a child to it. The expander widget has an 
28 <literal>expanded</literal> property which can be used to monitor 
29 its expansion state. You should watch this property with a signal 
30 connection as follows:
31 </para>
32
33 <programlisting id="expander-callback-example">
34 expander = gtk_expander_new_with_mnemonic ("_More Options");
35 g_signal_connect (expander, "notify::expanded",
36                   G_CALLBACK (expander_callback), NULL);
37
38 ...
39
40 static void
41 expander_callback (GObject    *object,
42                    GParamSpec *param_spec,
43                    gpointer    user_data)
44 {
45   GtkExpander *expander;
46
47   expander = GTK_EXPANDER (object);
48
49   if (gtk_expander_get_expanded (expander))
50     {
51       /* Show or create widgets */
52     }
53   else
54     {
55       /* Hide or destroy widgets */
56     }
57 }
58 </programlisting>
59 </section>
60 <refsect2 id="GtkExpander-BUILDER-UI">
61 <title>GtkExpander as GtkBuildable</title>
62 <para>
63 The GtkExpander implementation of the GtkBuildable interface 
64 supports placing a child in the label position by specifying
65 "label" as the "type" attribute of a &lt;child&gt; element.
66 A normal content child can be specified without specifying 
67 a &lt;child&gt; type attribute.
68 </para>
69 <example>
70 <title>A UI definition fragment with GtkExpander</title>
71 <programlisting><![CDATA[
72 <object class="GtkExpander">
73   <child type="label">
74     <object class="GtkLabel" id="expander-label"/>
75   </child>
76   <child>
77     <object class="GtkEntry" id="expander-content"/>
78   </child>
79 </object>
80 ]]></programlisting>
81 </example>
82 </refsect2>
83
84 <!-- ##### SECTION See_Also ##### -->
85 <para>
86
87 </para>
88
89 <!-- ##### SECTION Stability_Level ##### -->
90
91
92 <!-- ##### STRUCT GtkExpander ##### -->
93 <para>
94
95 </para>
96
97
98 <!-- ##### SIGNAL GtkExpander::activate ##### -->
99 <para>
100
101 </para>
102
103 @expander: the object which received the signal.
104
105 <!-- ##### ARG GtkExpander:expanded ##### -->
106 <para>
107
108 </para>
109
110 <!-- ##### ARG GtkExpander:label ##### -->
111 <para>
112
113 </para>
114
115 <!-- ##### ARG GtkExpander:label-widget ##### -->
116 <para>
117
118 </para>
119
120 <!-- ##### ARG GtkExpander:spacing ##### -->
121 <para>
122
123 </para>
124
125 <!-- ##### ARG GtkExpander:use-markup ##### -->
126 <para>
127
128 </para>
129
130 <!-- ##### ARG GtkExpander:use-underline ##### -->
131 <para>
132
133 </para>
134
135 <!-- ##### ARG GtkExpander:expander-size ##### -->
136 <para>
137
138 </para>
139
140 <!-- ##### ARG GtkExpander:expander-spacing ##### -->
141 <para>
142
143 </para>
144
145 <!-- ##### FUNCTION gtk_expander_new ##### -->
146 <para>
147
148 </para>
149
150 @label: 
151 @Returns: 
152
153
154 <!-- ##### FUNCTION gtk_expander_new_with_mnemonic ##### -->
155 <para>
156
157 </para>
158
159 @label: 
160 @Returns: 
161
162
163 <!-- ##### FUNCTION gtk_expander_set_expanded ##### -->
164 <para>
165
166 </para>
167
168 @expander: 
169 @expanded: 
170
171
172 <!-- ##### FUNCTION gtk_expander_get_expanded ##### -->
173 <para>
174
175 </para>
176
177 @expander: 
178 @Returns: 
179
180
181 <!-- ##### FUNCTION gtk_expander_set_spacing ##### -->
182 <para>
183
184 </para>
185
186 @expander: 
187 @spacing: 
188
189
190 <!-- ##### FUNCTION gtk_expander_get_spacing ##### -->
191 <para>
192
193 </para>
194
195 @expander: 
196 @Returns: 
197
198
199 <!-- ##### FUNCTION gtk_expander_set_label ##### -->
200 <para>
201
202 </para>
203
204 @expander: 
205 @label: 
206
207
208 <!-- ##### FUNCTION gtk_expander_get_label ##### -->
209 <para>
210
211 </para>
212
213 @expander: 
214 @Returns: 
215
216
217 <!-- ##### FUNCTION gtk_expander_set_use_underline ##### -->
218 <para>
219
220 </para>
221
222 @expander: 
223 @use_underline: 
224
225
226 <!-- ##### FUNCTION gtk_expander_get_use_underline ##### -->
227 <para>
228
229 </para>
230
231 @expander: 
232 @Returns: 
233
234
235 <!-- ##### FUNCTION gtk_expander_set_use_markup ##### -->
236 <para>
237
238 </para>
239
240 @expander: 
241 @use_markup: 
242
243
244 <!-- ##### FUNCTION gtk_expander_get_use_markup ##### -->
245 <para>
246
247 </para>
248
249 @expander: 
250 @Returns: 
251
252
253 <!-- ##### FUNCTION gtk_expander_set_label_widget ##### -->
254 <para>
255
256 </para>
257
258 @expander: 
259 @label_widget: 
260
261
262 <!-- ##### FUNCTION gtk_expander_get_label_widget ##### -->
263 <para>
264
265 </para>
266
267 @expander: 
268 @Returns: 
269
270