/* GTK - The GIMP Toolkit * * Copyright (C) 2003 Sun Microsystems, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library. If not, see . * * Authors: * Mark McLoughlin */ /** * SECTION:gtkexpander * @Short_description: A container which can hide its child * @Title: GtkExpander * * 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. * * Normally you use an expander as you would use a 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 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 * #GtkExpander:expanded property which can be used to monitor * its expansion state. You should watch this property with a signal * connection as follows: * * |[ * 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 * } * } * * static void * create_expander (void) * { * GtkWidget *expander = gtk_expander_new_with_mnemonic ("_More Options"); * g_signal_connect (expander, "notify::expanded", * G_CALLBACK (expander_callback), NULL); * * // ... * } * ]| * * # GtkExpander as GtkBuildable * * The GtkExpander implementation of the GtkBuildable interface supports * placing a child in the label position by specifying “label” as the * “type” attribute of a element. A normal content child can be * specified without specifying a type attribute. * * An example of a UI definition fragment with GtkExpander: * |[ * * * * * * * * * ]| * * # CSS nodes * * |[ * expander * ├── title * │ ├── arrow * │ ╰──