Main Page Widgets Namespaces Book

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

Inheritance diagram for Gtk::Expander:

[legend]
List of all members.

## 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)
     );

## Public Member Functions

| Expander (const Glib::ustring& label, bool mnemonic=false)
| Creates a new Expander with a label.
| Expander ()
| Creates a new Expander.
bool | get_expanded () const
| Queries a Gtk::Expander and returns its current state.
Glib::ustring | get_label () const
| Fetches the text from the label of the expander, as set by set_label().
const Widget* | get_label_widget () const
| Retrieves the label widget for the frame.
Widget* | get_label_widget ()
| Retrieves the label widget for the frame.
int | get_spacing () const
| Gets the value set by set_spacing().
bool | get_use_markup () const
| Returns whether the label's text is interpreted as marked up with the Pango text markup language.
bool | get_use_underline () const
| Returns whether an embedded underline in the expander label indicates a mnemonic.
const GtkExpander* | gobj () const
| Provides access to the underlying C GtkObject.
GtkExpander* | gobj ()
| Provides access to the underlying C GtkObject.
Glib::PropertyProxy_ReadOnly< bool > | property_expanded () const
| Whether the expander has been opened to reveal the child widget.
Glib::PropertyProxy<bool> | property_expanded ()
| Whether the expander has been opened to reveal the child widget.
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_label () const
| Text of the expander's label.
Glib::PropertyProxy<Glib::ustring> | property_label ()
| Text of the expander's label.
Glib::PropertyProxy_ReadOnly< Widget* > | property_label_widget () const
| A widget to display in place of the usual expander label.
Glib::PropertyProxy<Widget*> | property_label_widget ()
| A widget to display in place of the usual expander label.
Glib::PropertyProxy_ReadOnly< int > | property_spacing () const
| Space to put between the label and the child.
Glib::PropertyProxy<int> | property_spacing ()
| Space to put between the label and the child.
Glib::PropertyProxy_ReadOnly< bool > | property_use_markup () const
| The text of the label includes XML markup.
Glib::PropertyProxy<bool> | property_use_markup ()
| The text of the label includes XML markup.
Glib::PropertyProxy_ReadOnly< bool > | property_use_underline () const
| If set.
Glib::PropertyProxy<bool> | property_use_underline ()
| If set.
void | set_expanded (bool expanded=true)
| Sets the state of the expander.
void | set_label (const Glib::ustring& label)
| Sets the text of the label of the expander to label .
void | set_label_widget (Widget& label_widget)
| Set the label widget for the expander.
void | set_spacing (int spacing)
| Sets the spacing field of expander , which is the number of pixels to place between expander and the child.
void | set_use_markup (bool use_markup=true)
| Sets whether the text of the label contains markup in Pango's text markup language.
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.
virtual | ~Expander ()

## 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.

## 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().

Returns:
  The current state of the expander.

Since gtkmm 2.4:

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

Fetches the text from the label of the expander, 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.

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

Since gtkmm 2.4:

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

Retrieves the label widget for the frame.

See set_label_widget().

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

Since gtkmm 2.4:

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

Retrieves the label widget for the frame.

See set_label_widget().

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

Since gtkmm 2.4:

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

Gets the value set by set_spacing().

Returns:
  Spacing between the expander and child.

Since gtkmm 2.4:

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

Returns whether the label's text is interpreted as marked up with the Pango text markup language.

See set_use_markup().

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

Since gtkmm 2.4:

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

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

See set_use_underline().

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

Since gtkmm 2.4:

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

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.

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_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 Pango's text markup language.

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:

- expander.h