Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gtk::ToggleButton Class Reference

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

`#include <inti/gtk/togglebutton.h>`

Inheritance diagram for Inti::Gtk::ToggleButton:

List of all members.

## 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.
- GtkToggleButtonClass * gtk_toggle_button_class () const
    Get a pointer to the GtkToggleButtonClass 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.

Property Proxies

- const ActivePropertyProxy prop_active ()
    If the toggle button should be pressed in or not (bool : Read / Write).
- const InconsistentPropertyProxy prop_inconsistent ()
    If the toggle button is in an "in between" state (bool : Read / Write).
- const DrawIndicatorPropertyProxy prop_draw_indicator ()
    If the toggle part of the button is displayed (bool : Read / Write).

Signal Proxies

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

## Protected Member Functions

Constructors

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

Signal Handlers

- virtual void on_toggled ()
    Called whenever the toggle button's state is changed.

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

## Constructor & Destructor Documentation

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

  | Construct a new ToggleButton from an existing GtkToggleButton. Parameters:
  toggle_button | A pointer to a GtkToggleButton.
  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).

Inti::Gtk::ToggleButton::ToggleButton | ( |  | ) |

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

Inti::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 Inti::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 Inti::Gtk::ToggleButton::get_inconsistent | ( |  | ) | const

| Gets the value set by set_inconsistent(). Returns: true if the button is displayed as inconsistent, false otherwise.

bool Inti::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 Inti::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 Inti::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 Inti::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.

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

- togglebutton.h

Main Page - Footer