Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Gtk::ToggleButton Class Reference

A GtkToggleButton C++ wrapper class. More...

`#include <xfc/gtk/togglebutton.hh>`

Inheritance diagram for Xfc::Gtk::ToggleButton:

List of all members.

## Signal Prototypes

- const ToggledSignalType toggled_signal
    Toggled signal (see signal_destroy()).

## Public Member Functions

Constructors

- ToggleButton ()
    Constructs a new toggle button.
- ToggleButton (const String &label, bool use_underline=false)
    Constructs a new toggle button with a text label.
- virtual ~ToggleButton ()
    Destructor.

Accessors

- GtkToggleButton * gtk_toggle_button () const
    Get a pointer to the GtkToggleButton structure.
- operator GtkToggleButton * () const
    Conversion operator; safely converts a ToggleButton to a GtkToggleButton pointer.
- bool get_active () const
    Queries the toggle button and returns it's current state.
- bool get_mode () const
    Retrieves whether the button is displayed as a separate indicator and label (see set_mode()).
- bool get_inconsistent () const
    Gets the value set by set_inconsistent().

Methods

- void set_mode (bool draw_indicator)
    Sets whether the button is displayed as a separate indicator and label.
- void set_active (bool is_active)
    Sets the status of the toggle button.
- void set_inconsistent (bool setting)
    If the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a toggle button, and the current values in that range are inconsistent, you may want to display the toggle in an "in between" state.
- void toggled ()
    Emits the toggled signal on the toggle button.

Signal Proxies

- const ToggledSignalProxy signal_toggled ()
    Connect to the toggled_signal; emitted whenever the toggle button's state is changed.

## Protected Member Functions

Constructors

- ToggleButton (GtkToggleButton *toggle_button, bool owns_reference=false)
    Construct a new ToggleButton from an existing GtkToggleButton.

## Detailed Description

A GtkToggleButton C++ wrapper class.

A ToggleButton is a Button which will remain 'pressed-in' when clicked. Clicking again will cause the toggle button to return to it's normal state. If you create an empty toggle button it is advisable to pack a widget, (such as a Label and/or a Image), into the toggle button container (see GtkButton for more information).

The state of a ToggleButton can be set specifically using set_active(), and retrieved using get_active(). To simply switch the state of a toggle button, use toggled.

See also: the Button Widget HOWTOs and examples.

## Constructor & Destructor Documentation

Xfc::Gtk::ToggleButton::ToggleButton | ( | GtkToggleButton * | toggle_button,
|  | bool | owns_reference = `false`
| ) | `[explicit, protected]`

Construct a new ToggleButton from an existing GtkToggleButton.

Parameters:

  | toggle_button | A pointer to a GtkToggleButton.
  | owns_reference | Set false if the initial reference count is floating, set true if it's not.

The toggle_button can be a newly created GtkToggleButton or an existing GtkToggleButton (see G::Object::Object).

Xfc::Gtk::ToggleButton::ToggleButton | ( |  | ) |

| Constructs a new toggle button. A widget should be packed into the button, such as a Label and/or Image.

Xfc::Gtk::ToggleButton::ToggleButton | ( | const String & | label,
|  | bool | use_underline = `false`
| ) | `[explicit]`

Constructs a new toggle button with a text label.

Parameters:

  | label | The text you want the Label to hold.
  | use_underline | Set true if label contains a mnemonic character.

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.

## Member Function Documentation

bool Xfc::Gtk::ToggleButton::get_active | ( |  | ) | const

Queries the toggle button and returns it's current state.

Returns:
  true if the toggle button is pressed in and false if it is raised.

bool Xfc::Gtk::ToggleButton::get_inconsistent | ( |  | ) | const

Gets the value set by set_inconsistent().

Returns:
  true if the button is displayed as inconsistent, false otherwise.

bool Xfc::Gtk::ToggleButton::get_mode | ( |  | ) | const

Retrieves whether the button is displayed as a separate indicator and label (see set_mode()).

Returns:
  true if the togglebutton is drawn as a separate indicator and label.

void Xfc::Gtk::ToggleButton::set_active | ( | bool | is_active | ) |

Sets the status of the toggle button.

Parameters:

  | is_active | Either true or false.

Set is_active true if you want the toggle button to be 'pressed in', and false to raise it. This action causes the toggled signal to be emitted.

void Xfc::Gtk::ToggleButton::set_inconsistent | ( | bool | setting | ) |

If the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a toggle button, and the current values in that range are inconsistent, you may want to display the toggle in an "in between" state.

Parameters:

  | setting | true if the state is inconsistent.

This method turns on "in between" display. Normally you would turn off the inconsistent state again if the user toggles the toggle button. This has to be done manually, set_inconsistent() only affects visual appearance, it doesn't affect the semantics of the button.

void Xfc::Gtk::ToggleButton::set_mode | ( | bool | draw_indicator | ) |

Sets whether the button is displayed as a separate indicator and label.

Parameters:

  | draw_indicator | If true, draw the button as a separate indicator and label; if false, draw the button like a normal button.

You can call this method on a checkbutton or a radiobutton with draw_indicator set to false to make the button look like a normal button. This method only effects instances of classes like CheckButton and RadioButton that< derive from ToggleButton, not instances of ToggleButton itself.

## Member Data Documentation

const ToggledSignalType Xfc::Gtk::ToggleButton::toggled_signal `[static, protected]`

Toggled signal (see signal_destroy()).

Calls a slot with the signature:

                 void function();

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

- togglebutton.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3