From f65e2a2a1ee9f14f98da4ca1cb002bc7c956617a Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Tue, 24 Feb 2004 23:09:16 +0000 Subject: [PATCH] Added a section about usage when you want to manage the expanded widgets 2004-02-24 Federico Mena Quintero * gtk/tmpl/gtkexpander.sgml: Added a section about usage when you want to manage the expanded widgets yourself. --- docs/reference/ChangeLog | 5 +++ docs/reference/gtk/tmpl/gtkexpander.sgml | 50 ++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index c65dc75ea..978af660b 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,8 @@ +2004-02-24 Federico Mena Quintero + + * 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 * === Released 2.3.3 === diff --git a/docs/reference/gtk/tmpl/gtkexpander.sgml b/docs/reference/gtk/tmpl/gtkexpander.sgml index d75a57688..b306f3008 100644 --- a/docs/reference/gtk/tmpl/gtkexpander.sgml +++ b/docs/reference/gtk/tmpl/gtkexpander.sgml @@ -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. + + 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. + + +
+ Special Usage + + + 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 expanded property + which can be used to monitor its expansion state. You should + watch this property with a signal connection as follows: + + + +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 */ + } +} + + +
+