Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::Gtk::Expander Class Reference

A GtkExpander C++ wrapper class. More...

#include <xfc/gtk/expander.hh>

Inheritance diagram for Xfc::Gtk::Expander:

Xfc::Gtk::Bin Xfc::Gtk::Container Xfc::Gtk::Widget Xfc::Gtk::Object Xfc::Atk::Implementor Xfc::G::Object Xfc::G::TypeInterface Xfc::G::TypeInstance Xfc::G::TypeInstance Xfc::Trackable Xfc::Trackable List of all members.

Public Member Functions

Accessors
Methods

Detailed Description

A GtkExpander C++ wrapper class.

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 Gtk::Container::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 a Gtk::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:

 Gtk::Expander *expander = new Gtk::Expander("_More Options", true);
 expander->signal_notify("expanded").connect(this, &MyExpander::on_expanded);
 
 ...
 
 void 
 MyExpander::on_expanded(GParamSpec *param_spec)
 {
        if (get_expanded())
        {
                // Show or create widgets
        }
        else
        {
                // Hide or destroy widgets
        }
 }


Constructor & Destructor Documentation

Xfc::Gtk::Expander::Expander ( GtkExpander *  expander,
bool  owns_reference = false 
) [explicit, protected]

Construct a new Expander from an existing GtkExpander.

Parameters:
expander A pointer to a GtkExpander.
owns_reference Set false if the initial reference count is floating, set true if it's not.
The expander can be a newly created GtkExpander or an existing GtkExpander (see G::Object::Object).

Xfc::Gtk::Expander::Expander ( const String label,
bool  use_underline = false 
)

Constructs a new expander using label as the text of the label.

Parameters:
label The text of the label.
use_underline Whether a character preceded by an underscore is underlined.
If characters in label are preceded by an underscore and use_underline is true, they are underlined. If use_underline is true and 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.

Xfc::Gtk::Expander::Expander ( GtkExpander *  expander,
bool  owns_reference = false 
) [explicit, protected]

Construct a new Expander from an existing GtkExpander.

Parameters:
expander A pointer to a GtkExpander.
owns_reference Set false if the initial reference count is floating, set true if it's not.
The expander can be a newly created GtkExpander or an existing GtkExpander (see G::Object::Object).

Xfc::Gtk::Expander::Expander ( const String label,
bool  use_underline = false 
)

Constructs a new expander using label as the text of the label.

Parameters:
label The text of the label.
use_underline Whether a character preceded by an underscore is underlined.
If characters in label are preceded by an underscore and use_underline is true, they are underlined. If use_underline is true and 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.


Member Function Documentation

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

Queries the expander and returns its current state (see set_expanded()).

Returns:
true if the child widget is revealed, false if not.

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

Gets the value set by set_spacing().

Returns:
The spacing between the expander and child in pixels.

String Xfc::Gtk::Expander::get_label (  )  const

Fetches the text from the label of the expander, as set by set_label().

Returns:
The text of the label widget.
If the label text has not been set the return value will be a null String. This will be the case if you create an empty Gtk::Button to use as a container.

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

Determines 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 a mnemonic accelerator key.

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

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

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

Retrieves the label widget for the frame (see set_label_widget()).

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

void Xfc::Gtk::Expander::set_expanded ( bool  expanded  ) 

Sets the state of the expander.

Parameters:
expanded Whether the child widget is revealed.
Set expanded true if you want the child widget to be revealed, and false if you want the child widget to be hidden.

void Xfc::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.

Parameters:
spacing The distance between the expander and child in pixels.

void Xfc::Gtk::Expander::set_label ( const String label  ) 

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

Parameters:
label A text string.
This will also clear any previously set labels.

void Xfc::Gtk::Expander::set_use_underline ( bool  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.

Parameters:
use_underline Set true if underlines in the text indicate mnemonics.

void Xfc::Gtk::Expander::set_use_markup ( bool  use_markup  ) 

Sets whether the text of the label contains markup in Pango's text markup language (see Gtk::Label::set_markup()).

Parameters:
use_markup Set true if the label's text should be parsed for markup.

void Xfc::Gtk::Expander::set_label_widget ( Widget label_widget  ) 

Set the label widget for the expander.

Parameters:
label_widget The new label widget.
This is the widget that will appear embedded alongside the expander arrow.


The documentation for this class was generated from the following file: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3