Added a section about usage when you want to manage the expanded widgets
2004-02-24 Federico Mena Quintero <federico@ximian.com> * gtk/tmpl/gtkexpander.sgml: Added a section about usage when you want to manage the expanded widgets yourself.
This commit is contained in:

committed by
Federico Mena Quintero

parent
b435c31d75
commit
f65e2a2a1e
@ -1,3 +1,8 @@
|
|||||||
|
2004-02-24 Federico Mena Quintero <federico@ximian.com>
|
||||||
|
|
||||||
|
* gtk/tmpl/gtkexpander.sgml: Added a section about usage when you
|
||||||
|
want to manage the expanded widgets yourself.
|
||||||
|
|
||||||
Tue Feb 24 14:45:03 2004 Owen Taylor <otaylor@redhat.com>
|
Tue Feb 24 14:45:03 2004 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* === Released 2.3.3 ===
|
* === Released 2.3.3 ===
|
||||||
|
@ -10,6 +10,56 @@ A #GtkExpander allows the user to hide or show its child by clicking on an expan
|
|||||||
the triangles used in a #GtkTreeView.
|
the triangles used in a #GtkTreeView.
|
||||||
</para>
|
</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 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>
|
||||||
|
|
||||||
<!-- ##### SECTION See_Also ##### -->
|
<!-- ##### SECTION See_Also ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user