Synopsis#include <gtk/gtk.h> GtkExpander; GtkWidget* gtk_expander_new (const gchar *label); GtkWidget* gtk_expander_new_with_mnemonic (const gchar *label); void gtk_expander_set_expanded (GtkExpander *expander, gboolean expanded); gboolean gtk_expander_get_expanded (GtkExpander *expander); void gtk_expander_set_spacing (GtkExpander *expander, gint spacing); gint gtk_expander_get_spacing (GtkExpander *expander); void gtk_expander_set_label (GtkExpander *expander, const gchar *label); const gchar* gtk_expander_get_label (GtkExpander *expander); void gtk_expander_set_use_underline (GtkExpander *expander, gboolean use_underline); gboolean gtk_expander_get_use_underline (GtkExpander *expander); void gtk_expander_set_use_markup (GtkExpander *expander, gboolean use_markup); gboolean gtk_expander_get_use_markup (GtkExpander *expander); void gtk_expander_set_label_widget (GtkExpander *expander, GtkWidget *label_widget); GtkWidget* gtk_expander_get_label_widget (GtkExpander *expander); Object HierarchyGObject +----GInitiallyUnowned +----GtkObject +----GtkWidget +----GtkContainer +----GtkBin +----GtkExpander Properties"expanded" gboolean : Read / Write / Construct "label" gchar* : Read / Write / Construct "label-widget" GtkWidget* : Read / Write "spacing" gint : Read / Write "use-markup" gboolean : Read / Write / Construct "use-underline" gboolean : Read / Write / Construct DescriptionA 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 any other descendant
of GtkBin; you create the child widget and use
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
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 */ } } GtkExpander as GtkBuildableThe GtkExpander implementation of the GtkBuildable interface supports placing a child in the label position by specifying "label" as the "type" attribute of a <child> element. A normal content child can be specified without specifying a <child> type attribute. Example 39. A UI definition fragment with GtkExpander <object class="GtkExpander"> <child type="label"> <object class="GtkLabel" id="expander-label"/> </child> <child> <object class="GtkEntry" id="expander-content"/> </child> </object> Detailsgtk_expander_new ()GtkWidget* gtk_expander_new (const gchar *label);
Creates a new expander using
Since 2.4 gtk_expander_new_with_mnemonic ()GtkWidget* gtk_expander_new_with_mnemonic (const gchar *label);
Creates a new expander using
Since 2.4 gtk_expander_set_expanded ()void gtk_expander_set_expanded (GtkExpander *expander, gboolean expanded);
Sets the state of the expander. Set to
Since 2.4 gtk_expander_get_expanded ()gboolean gtk_expander_get_expanded (GtkExpander *expander);
Queries a GtkExpander and returns its current state. Returns
See
Since 2.4 gtk_expander_set_spacing ()void gtk_expander_set_spacing (GtkExpander *expander, gint spacing);
Sets the spacing field of
Since 2.4 gtk_expander_get_spacing ()gint gtk_expander_get_spacing (GtkExpander *expander);
Gets the value set by
Since 2.4 gtk_expander_set_label ()void gtk_expander_set_label (GtkExpander *expander, const gchar *label);
Sets the text of the label of the expander to This will also clear any previously set labels.
Since 2.4 gtk_expander_get_label ()const gchar* gtk_expander_get_label (GtkExpander *expander);
Fetches the text from a label widget including any embedded
underlines indicating mnemonics and Pango markup, as set by
Since 2.4 gtk_expander_set_use_underline ()void gtk_expander_set_use_underline (GtkExpander *expander, gboolean use_underline); If true, an underline in the text of the expander label indicates the next character should be used for the mnemonic accelerator key.
Since 2.4 gtk_expander_get_use_underline ()gboolean gtk_expander_get_use_underline (GtkExpander *expander);
Returns whether an embedded underline in the expander label indicates a
mnemonic. See
Since 2.4 gtk_expander_set_use_markup ()void gtk_expander_set_use_markup (GtkExpander *expander, gboolean use_markup);
Sets whether the text of the label contains markup in Pango's text markup
language. See
Since 2.4 gtk_expander_get_use_markup ()gboolean gtk_expander_get_use_markup (GtkExpander *expander);
Returns whether the label's text is interpreted as marked up with
the Pango text markup
language. See
Since 2.4 gtk_expander_set_label_widget ()void gtk_expander_set_label_widget (GtkExpander *expander, GtkWidget *label_widget); Set the label widget for the expander. This is the widget that will appear embedded alongside the expander arrow.
Since 2.4 gtk_expander_get_label_widget ()GtkWidget* gtk_expander_get_label_widget (GtkExpander *expander);
Retrieves the label widget for the frame. See
Since 2.4 Property DetailsThe
|
|
the object which received the signal. |
|
user data set when the signal handler was connected. |