Description Methods and Functions Hierarchy Interfaces Detailed Description Special Usage GtkExpander as GtkBuildable Structures Convenient Construction Signals Properties Style Properties Author(s) References
A container which can hide its child
gtkExpanderNew(label = NULL, show = TRUE)
gtkExpanderNewWithMnemonic(label = NULL)
gtkExpanderSetExpanded(object, expanded)
gtkExpanderGetExpanded(object)
gtkExpanderSetSpacing(object, spacing)
gtkExpanderGetSpacing(object)
gtkExpanderSetLabel(object, label = NULL)
gtkExpanderGetLabel(object)
gtkExpanderSetUseUnderline(object, use.underline)
gtkExpanderGetUseUnderline(object)
gtkExpanderSetUseMarkup(object, use.markup)
gtkExpanderGetUseMarkup(object)
gtkExpanderSetLabelWidget(object, label.widget = NULL)
gtkExpanderGetLabelWidget(object)
gtkExpander(label = NULL, show = TRUE)
1 2 3 4 5 6 7 | GObject
+----GInitiallyUnowned
+----GtkObject
+----GtkWidget
+----GtkContainer
+----GtkBin
+----GtkExpander
|
GtkExpander implements
AtkImplementorIface and GtkBuildable.
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 any other descendant
of GtkBin; you create the child widget and use gtkContainerAdd
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 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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 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 */
}
}
|
The 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.
A UI definition fragment with GtkExpander
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | expander <- gtkExpanderNewWithMnemonic("_More Options")
gSignalConnect(expander, "notify::expanded", expander_callback)
...
expander_callback <- (expander, param_spec, user_data)
{
if (expander$getExpanded()) {
# Show or create widgets
} else {
# Hide or destroy widgets
}
}
|
GtkExpanderundocumented
gtkExpander is the equivalent of gtkExpanderNew.
activate(expander, user.data)undocumented
expanderthe object which received the signal.
user.datauser data set when the signal handler was connected.
expanded [logical : Read / Write / Construct]Whether the expander has been opened to reveal the child widget. Default value: FALSE
label [character : * : Read / Write / Construct]Text of the expander's label. Default value: NULL
label-widget [GtkWidget : * : Read / Write]A widget to display in place of the usual expander label.
spacing [integer : Read / Write]Space to put between the label and the child. Allowed values: >= 0 Default value: 0
use-markup [logical : Read / Write / Construct]The text of the label includes XML markup. See pango_parse_markup(). Default value: FALSE
use-underline [logical : Read / Write / Construct]If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key. Default value: FALSE
expander-size [integer : Read]Size of the expander arrow. Allowed values: >= 0 Default value: 10
expander-spacing [integer : Read]Spacing around expander arrow. Allowed values: >= 0 Default value: 2
Derived by RGtkGen from GTK+ documentation
https://developer.gnome.org/gtk2/stable/GtkExpander.html
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.