# Gtk::Expander Class Reference
[Widgets, Container Widgets]

A container which can hide its child. More...

Inherits Gtk::Bin.

Collaboration diagram for Gtk::Expander:
[legend]

List of all members.

## Public Member Functions

virtual | ~Expander ()
GtkExpander* | gobj ()
| Provides access to the underlying C GtkObject.
const GtkExpander* | gobj () const
| Provides access to the underlying C GtkObject.
| Expander ()
| Creates a new Expander.
| Expander (const Glib::ustring& label, bool mnemonic=false)
| Creates a new Expander with a label.
void | set_expanded (bool expanded=true)
| Sets the state of the expander.
bool | get_expanded () const
| Queries a Gtk::Expander and returns its current state.
void | set_spacing (int spacing)
| Sets the spacing field of expander, which is the number of pixels to place between expander and the child.
int | get_spacing () const
| Gets the value set by set_spacing().
void | set_label (const Glib::ustring& label)
| Sets the text of the label of the expander to label.
Glib::ustring | get_label () const
| Fetches the text from a label widget including any embedded underlines indicating mnemonics and Pango markup, as set by set_label().
void | set_use_underline (bool use_underline=true)
| If true, an underline in the text of the expander label indicates the next character should be used for the mnemonic accelerator key.
bool | get_use_underline () const
| Returns whether an embedded underline in the expander label indicates a mnemonic.
void | set_use_markup (bool use_markup=true)
| Sets whether the text of the label contains markup in <link linkend="PangoMarkupFormat">Pango's text markup language</link>.
bool | get_use_markup () const
| Returns whether the label's text is interpreted as marked up with the <link linkend="PangoMarkupFormat">Pango text markup language</link>.
void | set_label_widget (Widget& label_widget)
| Set the label widget for the expander.
Widget* | get_label_widget ()
| Retrieves the label widget for the frame.
const Widget* | get_label_widget () const
| Retrieves the label widget for the frame.
void | set_label_fill (bool label_fill=true)
| Sets whether the label widget should fill all available horizontal space allocated to expander.
bool | get_label_fill () const
| Returns whether the label widget will fill all available horizontal space allocated to expander.
Glib::PropertyProxy< bool > | property_expanded ()
| Whether the expander has been opened to reveal the child widget.
Glib::PropertyProxy_ReadOnly < bool > | property_expanded () const
| Whether the expander has been opened to reveal the child widget.
Glib::PropertyProxy < Glib::ustring > | property_label ()
| Text of the expander's label.
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_label () const
| Text of the expander's label.
Glib::PropertyProxy< bool > | property_use_underline ()
| If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key.
Glib::PropertyProxy_ReadOnly < bool > | property_use_underline () const
| If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key.
Glib::PropertyProxy< bool > | property_use_markup ()
| The text of the label includes XML markup.
Glib::PropertyProxy_ReadOnly < bool > | property_use_markup () const
| The text of the label includes XML markup.
Glib::PropertyProxy< int > | property_spacing ()
| Space to put between the label and the child.
Glib::PropertyProxy_ReadOnly< int > | property_spacing () const
| Space to put between the label and the child.
Glib::PropertyProxy< Widget* > | property_label_widget ()
| A widget to display in place of the usual expander label.
Glib::PropertyProxy_ReadOnly < Widget* > | property_label_widget () const
| A widget to display in place of the usual expander label.
Glib::PropertyProxy< bool > | property_label_fill ()
| Whether the label widget should fill all available horizontal space.
Glib::PropertyProxy_ReadOnly < bool > | property_label_fill () const
| Whether the label widget should fill all available horizontal space.

## Related Functions

(Note that these are not member functions.)
Gtk::Expander* | wrap (GtkExpander* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

A container which can hide its child.

An Expander allows the user to hide or show its child by clicking on an expander triangle similar to the triangles used in a Gtk::TreeView.

Normally you use an expander as you would use any other descendant of Gtk::Bin; you create the child widget and use 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 an Expander 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:

     expander.property_expanded().signal_changed().connect(
       sigc::mem_fun(*this, &SomeClass::on_expander_changed)
     );

## Constructor & Destructor Documentation

virtual Gtk::Expander::~Expander | ( |  | ) | `[virtual]`

Gtk::Expander::Expander | ( |  | ) |

Creates a new Expander.

The Expander has an empty label.

Since gtkmm 2.4:

Gtk::Expander::Expander | ( | const Glib::ustring & | label,
|  | bool | mnemonic = `false` |
| ) |  |  | `[explicit]`

Creates a new Expander with a label.

Creates a new expander using label as the text of the label. Settin mnemonic to true will allow you to precede characters in the label with an underscore which will make them 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.

Parameters:

  | label | The string for the label describing the Expander.
  | mnemonic | Wether the label may contain underscores to set up accelerators.

Since gtkmm 2.4:

## Member Function Documentation

bool Gtk::Expander::get_expanded | ( |  | ) | const

Queries a Gtk::Expander and returns its current state.

Returns `true` if the child widget is revealed.

See set_expanded().

Since gtkmm 2.4:

Returns:
  The current state of the expander.

Glib::ustring Gtk::Expander::get_label | ( |  | ) | const

Fetches the text from a label widget including any embedded underlines indicating mnemonics and Pango markup, as set by set_label().

If the label text has not been set the return value will be `0`. This will be the case if you create an empty button with Gtk::Button::new() to use as a container.

Note that this function behaved differently in versions prior to 2.14 and used to return the label text stripped of embedded underlines indicating mnemonics and Pango markup. This problem can be avoided by fetching the label text directly from the label widget.

Since gtkmm 2.4:

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

bool Gtk::Expander::get_label_fill | ( |  | ) | const

Returns whether the label widget will fill all available horizontal space allocated to expander.

Since gtkmm 2.22:

Returns:
  `true` if the label widget will fill all available horizontal space.

const Widget* Gtk::Expander::get_label_widget | ( |  | ) | const

Retrieves the label widget for the frame.

See set_label_widget().

Since gtkmm 2.4:

Returns:
  The label widget, or `0` if there is none.

Widget* Gtk::Expander::get_label_widget | ( |  | ) |

Retrieves the label widget for the frame.

See set_label_widget().

Since gtkmm 2.4:

Returns:
  The label widget, or `0` if there is none.

int Gtk::Expander::get_spacing | ( |  | ) | const

Gets the value set by set_spacing().

Since gtkmm 2.4:

Returns:
  Spacing between the expander and child.

bool Gtk::Expander::get_use_markup | ( |  | ) | const

Returns whether the label's text is interpreted as marked up with the <link linkend="PangoMarkupFormat">Pango text markup language</link>.

See set_use_markup().

Since gtkmm 2.4:

Returns:
  `true` if the label's text will be parsed for markup.

bool Gtk::Expander::get_use_underline | ( |  | ) | const

Returns whether an embedded underline in the expander label indicates a mnemonic.

See set_use_underline().

Since gtkmm 2.4:

Returns:
  `true` if an embedded underline in the expander label indicates the mnemonic accelerator keys.

const GtkExpander* Gtk::Expander::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Bin.

GtkExpander* Gtk::Expander::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Bin.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Expander::property_expanded | ( |  | ) | const

Whether the expander has been opened to reveal the child widget.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Expander::property_expanded | ( |  | ) |

Whether the expander has been opened to reveal the child widget.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Glib::ustring> Gtk::Expander::property_label | ( |  | ) | const

Text of the expander's label.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Glib::ustring> Gtk::Expander::property_label | ( |  | ) |

Text of the expander's label.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Expander::property_label_fill | ( |  | ) | const

Whether the label widget should fill all available horizontal space.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Expander::property_label_fill | ( |  | ) |

Whether the label widget should fill all available horizontal space.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Widget*> Gtk::Expander::property_label_widget | ( |  | ) | const

A widget to display in place of the usual expander label.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Widget*> Gtk::Expander::property_label_widget | ( |  | ) |

A widget to display in place of the usual expander label.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gtk::Expander::property_spacing | ( |  | ) | const

Space to put between the label and the child.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<int> Gtk::Expander::property_spacing | ( |  | ) |

Space to put between the label and the child.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Expander::property_use_markup | ( |  | ) | const

The text of the label includes XML markup.

See pango_parse_markup().

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Expander::property_use_markup | ( |  | ) |

The text of the label includes XML markup.

See pango_parse_markup().

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Expander::property_use_underline | ( |  | ) | const

If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Expander::property_use_underline | ( |  | ) |

If set, an underline in the text indicates the next character should be used for the mnemonic accelerator key.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

void Gtk::Expander::set_expanded | ( | bool | expanded = `true` | ) |

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.

Since gtkmm 2.4:

Parameters:

  | expanded | Whether the child widget is revealed.

void Gtk::Expander::set_label | ( | const Glib::ustring & | label | ) |

Sets the text of the label of the expander to label.

This will also clear any previously set labels.

Since gtkmm 2.4:

Parameters:

  | label | A string.

void Gtk::Expander::set_label_fill | ( | bool | label_fill = `true` | ) |

Sets whether the label widget should fill all available horizontal space allocated to expander.

Since gtkmm 2.22:

Parameters:

  | label_fill | `true` if the label should should fill all available horizontal space.

void Gtk::Expander::set_label_widget | ( | Widget& | label_widget | ) |

Set the label widget for the expander.

This is the widget that will appear embedded alongside the expander arrow.

Since gtkmm 2.4:

Parameters:

  | label_widget | The new label widget.

void Gtk::Expander::set_spacing | ( | int | spacing | ) |

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

Since gtkmm 2.4:

Parameters:

  | spacing | Distance between the expander and child in pixels.

void Gtk::Expander::set_use_markup | ( | bool | use_markup = `true` | ) |

Sets whether the text of the label contains markup in <link linkend="PangoMarkupFormat">Pango's text markup language</link>.

See Gtk::Label::set_markup().

Since gtkmm 2.4:

Parameters:

  | use_markup | `true` if the label's text should be parsed for markup.

void Gtk::Expander::set_use_underline | ( | bool | use_underline = `true` | ) |

If true, an underline in the text of the expander label indicates the next character should be used for the mnemonic accelerator key.

Since gtkmm 2.4:

Parameters:

  | use_underline | `true` if underlines in the text indicate mnemonics.

## Friends And Related Function Documentation

Gtk::Expander* wrap | ( | GtkExpander * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- gtkmm/expander.h