summaryrefslogtreecommitdiff
path: root/docs/reference/gtk/tmpl/gtkexpander.sgml
blob: 402ef58184f99ed5f058c9cb8b33d4f03c39ea0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<!-- ##### SECTION Title ##### -->
GtkExpander

<!-- ##### SECTION Short_Description ##### -->
A container which can hide its child

<!-- ##### SECTION Long_Description ##### -->
<para>
A #GtkExpander allows the user to hide or show its child by clicking 
on an expander triangle similar to the triangles used in a #GtkTreeView.
</para>

<para>
Normally you use an expander as you would use any other descendant
of #GtkBin; you create the child widget and use gtk_container_add() 
to add it to the expander. When the expander is toggled, it will take 
care of showing and hiding the child automatically.
</para>

<section id="expander-special-usage">
<title>Special Usage</title>

<para>
There are situations in which you may prefer to show and hide the 
expanded widget yourself, such as when you want to actually create 
the widget at expansion time. In this case, create a #GtkExpander 
but do not add a child to it. The expander widget has an 
<literal>expanded</literal> property which can be used to monitor 
its expansion state. You should watch this property with a signal 
connection as follows:
</para>

<programlisting id="expander-callback-example">
expander = gtk_expander_new_with_mnemonic ("_More Options");
g_signal_connect (expander, "notify::expanded",
                  G_CALLBACK (expander_callback), NULL);

...

static void
expander_callback (GObject    *object,
                   GParamSpec *param_spec,
                   gpointer    user_data)
{
  GtkExpander *expander;

  expander = GTK_EXPANDER (object);

  if (gtk_expander_get_expanded (expander))
    {
      /* Show or create widgets */
    }
  else
    {
      /* Hide or destroy widgets */
    }
}
</programlisting>
</section>
<refsect2 id="GtkExpander-BUILDER-UI">
<title>GtkExpander as GtkBuildable</title>
<para>
The GtkExpander implementation of the GtkBuildable interface 
supports placing a child in the label position by specifying
"label" as the "type" attribute of a &lt;child&gt; element.
A normal content child can be specified without specifying 
a &lt;child&gt; type attribute.
</para>
<example>
<title>A UI definition fragment with GtkExpander</title>
<programlisting><![CDATA[
<object class="GtkExpander">
  <child type="label">
    <object class="GtkLabel" id="expander-label"/>
  </child>
  <child>
    <object class="GtkEntry" id="expander-content"/>
  </child>
</object>
]]></programlisting>
</example>
</refsect2>

<!-- ##### SECTION See_Also ##### -->
<para>

</para>

<!-- ##### SECTION Stability_Level ##### -->


<!-- ##### SECTION Image ##### -->


<!-- ##### STRUCT GtkExpander ##### -->
<para>

</para>


<!-- ##### SIGNAL GtkExpander::activate ##### -->
<para>

</para>

@expander: the object which received the signal.

<!-- ##### ARG GtkExpander:expanded ##### -->
<para>

</para>

<!-- ##### ARG GtkExpander:label ##### -->
<para>

</para>

<!-- ##### ARG GtkExpander:label-widget ##### -->
<para>

</para>

<!-- ##### ARG GtkExpander:spacing ##### -->
<para>

</para>

<!-- ##### ARG GtkExpander:use-markup ##### -->
<para>

</para>

<!-- ##### ARG GtkExpander:use-underline ##### -->
<para>

</para>

<!-- ##### ARG GtkExpander:expander-size ##### -->
<para>

</para>

<!-- ##### ARG GtkExpander:expander-spacing ##### -->
<para>

</para>

<!-- ##### FUNCTION gtk_expander_new ##### -->
<para>

</para>

@label: 
@Returns: 


<!-- ##### FUNCTION gtk_expander_new_with_mnemonic ##### -->
<para>

</para>

@label: 
@Returns: 


<!-- ##### FUNCTION gtk_expander_set_expanded ##### -->
<para>

</para>

@expander: 
@expanded: 


<!-- ##### FUNCTION gtk_expander_get_expanded ##### -->
<para>

</para>

@expander: 
@Returns: 


<!-- ##### FUNCTION gtk_expander_set_spacing ##### -->
<para>

</para>

@expander: 
@spacing: 


<!-- ##### FUNCTION gtk_expander_get_spacing ##### -->
<para>

</para>

@expander: 
@Returns: 


<!-- ##### FUNCTION gtk_expander_set_label ##### -->
<para>

</para>

@expander: 
@label: 


<!-- ##### FUNCTION gtk_expander_get_label ##### -->
<para>

</para>

@expander: 
@Returns: 


<!-- ##### FUNCTION gtk_expander_set_use_underline ##### -->
<para>

</para>

@expander: 
@use_underline: 


<!-- ##### FUNCTION gtk_expander_get_use_underline ##### -->
<para>

</para>

@expander: 
@Returns: 


<!-- ##### FUNCTION gtk_expander_set_use_markup ##### -->
<para>

</para>

@expander: 
@use_markup: 


<!-- ##### FUNCTION gtk_expander_get_use_markup ##### -->
<para>

</para>

@expander: 
@Returns: 


<!-- ##### FUNCTION gtk_expander_set_label_widget ##### -->
<para>

</para>

@expander: 
@label_widget: 


<!-- ##### FUNCTION gtk_expander_get_label_widget ##### -->
<para>

</para>

@expander: 
@Returns: