## GtkExpander

GtkExpander — A container which can hide its child

## Synopsis

    #include <gtk/gtk.h>

    struct      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);
    G_CONST_RETURN 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 Hierarchy

      GObject
       +----GtkObject
             +----GtkWidget
                   +----GtkContainer
                         +----GtkBin
                               +----GtkExpander

## Implemented Interfaces

GtkExpander implements AtkImplementorIface.

## Properties

      "expanded"             gboolean             : Read / Write / Construct
      "label"                gchararray           : Read / Write / Construct
      "label-widget"         GtkWidget            : Read / Write
      "spacing"              gint                 : Read / Write
      "use-markup"           gboolean             : Read / Write / Construct
      "use-underline"        gboolean             : Read / Write / Construct

## Style Properties

      "expander-size"        gint                 : Read
      "expander-spacing"     gint                 : Read

## Signal Prototypes

    "activate"  void        user_function      (GtkExpander *expander,
                                                gpointer user_data);

## Description

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.

## Details

### struct GtkExpander

    struct GtkExpander;

### gtk_expander_new ()

    GtkWidget*  gtk_expander_new                (const gchar *label);

Creates a new expander using `label` as the text of the label.

`label` : | the text of the label
Returns : | a new GtkExpander widget.

Since 2.4

### gtk_expander_new_with_mnemonic ()

    GtkWidget*  gtk_expander_new_with_mnemonic  (const gchar *label);

Creates a new expander using `label` as the text of the label. If characters in `label` are preceded by an underscore, they are underlined. If you need a literal underscore character in a label, use '__' (two underscores). The first underlined character represents a keyboard accelerator called a mnemonic. Pressing Alt and that key activates the button.

`label` : | the text of the label with an underscore in front of the mnemonic character
Returns : | a new GtkExpander widget.

Since 2.4

### gtk_expander_set_expanded ()

    void        gtk_expander_set_expanded       (GtkExpander *expander,
                                                 gboolean expanded);

Sets the state of the expander. Set to `TRUE`, if you want the child widget to be revealed, and `FALSE` if you want the child widget to be hidden.

`expander` : | a GtkExpander
`expanded` : | whether the child widget is revealed

Since 2.4

### gtk_expander_get_expanded ()

    gboolean    gtk_expander_get_expanded       (GtkExpander *expander);

Queries a GtkExpander and returns its current state. Returns `TRUE` if the child widget is revealed.

See `gtk_expander_set_expanded()`.

`expander` : | a GtkExpander
Returns : | the current state of the expander.

Since 2.4

### gtk_expander_set_spacing ()

    void        gtk_expander_set_spacing        (GtkExpander *expander,
                                                 gint spacing);

Sets the spacing field of `expander`, which is the number of pixels to place between expander and the child.

`expander` : | a GtkExpander
`spacing` : | distance between the expander and child in pixels.

Since 2.4

### gtk_expander_get_spacing ()

    gint        gtk_expander_get_spacing        (GtkExpander *expander);

Gets the value set by `gtk_expander_set_spacing()`.

`expander` : | a GtkExpander
Returns : | spacing between the expander and child.

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 `label`.

This will also clear any previously set labels.

`expander` : | a GtkExpander
`label` : | a string

Since 2.4

### gtk_expander_get_label ()

    G_CONST_RETURN gchar* gtk_expander_get_label
                                                (GtkExpander *expander);

Fetches the text from the label of the expander, as set by `gtk_expander_set_label()`. If the label text has not been set the return value will be `NULL`. This will be the case if you create an empty button with `gtk_button_new()` to use as a container.

`expander` : | a GtkExpander
Returns : | The text of the label widget. This string is owned by the widget and must not be modified or freed.

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.

`expander` : | a GtkExpander
`use_underline` : | `TRUE` if underlines in the text indicate mnemonics

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 `gtk_expander_set_use_underline()`.

`expander` : | a GtkExpander
Returns : | `TRUE` if an embedded underline in the expander label indicates the mnemonic accelerator keys.

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 `gtk_label_set_markup()`.

`expander` : | a GtkExpander
`use_markup` : | `TRUE` if the label's text should be parsed for markup

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 `gtk_expander_set_use_markup()`.

`expander` : | a GtkExpander
Returns : | `TRUE` if the label's text will be parsed for markup

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.

`expander` : | a GtkExpander
`label_widget` : | the new label widget

Since 2.4

### gtk_expander_get_label_widget ()

    GtkWidget*  gtk_expander_get_label_widget   (GtkExpander *expander);

Retrieves the label widget for the frame. See `gtk_expander_set_label_widget()`.

`expander` : | a GtkExpander
Returns : | the label widget, or `NULL` if there is none.

Since 2.4

## Properties

"`expanded`" (gboolean : Read / Write / Construct) | Whether the expander has been opened to reveal the child widget.
"`label`" (gchararray : Read / Write / Construct) | Text of the expander's label.
"`label-widget`" (GtkWidget : Read / Write) | A widget to display in place of the usual expander label.
"`spacing`" (gint : Read / Write) | Space to put between the label and the child.
"`use-markup`" (gboolean : Read / Write / Construct) | The text of the label includes XML markup. See pango_parse_markup().
"`use-underline`" (gboolean : Read / Write / Construct) | If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key.

## Style Properties

"`expander-size`" (gint : Read) | Size of the expander arrow.
"`expander-spacing`" (gint : Read) | Spacing around expander arrow.

## Signals

### The "activate" signal

    void        user_function                  (GtkExpander *expander,
                                                gpointer user_data);

`expander` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.