
@c %start of fragment

@node GtkExpander
@chapter GtkExpander
A container which can hide its child

@section Overview
A @code{<gtk-expander>} allows the user to hide or show its child by clicking on
an expander triangle similar to the triangles used in a @code{<gtk-tree-view>}.

Normally you use an expander as you would use any other descendant of
@code{<gtk-bin>}; you create the child widget and use @code{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.

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 @code{<gtk-expander>} but do not add a
child to it. The expander widget has an @samp{expanded} property which can be
used to monitor its expansion state. You should watch this property with a
signal connection as follows:

@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 */
    @}
@}

    
@end example

@section Usage
@include defuns-gtkexpander.xml.texi

@c %end of fragment
