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

# Xfc::Gtk::ToggleAction Class Reference

A GtkToggleAction C++ wrapper class. More...

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

Inheritance diagram for Xfc::Gtk::ToggleAction:

List of all members.

## Signal Prototypes

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

## Public Member Functions

Constructors

- ToggleAction (const String &name, const String &label, bool is_active)
    Constructs a new ToggleAction object with a reference count of 1 that the caller owns.
- ToggleAction (const String &name, const StockId &stock_id, bool is_active)
    Constructs a new ToggleAction object.
- ToggleAction (const String &name, const String &label, const StockId &stock_id, bool is_active)
    Constructs a new ToggleAction object.
- virtual ~ToggleAction ()
    Destructor.

Accessors

- GtkToggleAction * gtk_toggle_action () const
    Get a pointer to the GtkToggleAction structure.
- operator GtkToggleAction * () const
    Conversion operator; safely converts an ToggleAction to a GtkToggleAction pointer.
- bool get_active () const
    Determines the checked state of the toggle action.
- bool get_draw_as_radio () const
    Determines whether the action should have proxies like a radio action.

Methods

- void toggled ()
    Emits the "toggled" signal on the toggle action.
- void set_active (bool is_active)
    Sets the checked state of the toggle action.
- void set_draw_as_radio (bool draw_as_radio)
    Sets whether the action should have proxies like a radio action.

Signal Proxies

- const ToggledSignalProxy signal_toggled ()
    Connect to the toggled_signal; emitted when the action is toggled between its two states.

## Protected Member Functions

Constructors

- ToggleAction (GtkToggleAction *action, bool owns_reference=true)
    Construct a new ToggleAction from an existing GtkToggleAction.

## Detailed Description

A GtkToggleAction C++ wrapper class.

A ToggleAction corresponds roughly to a CheckMenuItem. It has an "active" state specifying whether the action has been checked or not.

Note: dynamically allocated objects must either be unreferenced or assigned to a smart pointer. Stack objects are automatically unreferenced when they go out of scope.

See also: the User Interface Manager HOWTO and example.

## Constructor & Destructor Documentation

Xfc::Gtk::ToggleAction::ToggleAction | ( | GtkToggleAction * | action,
|  | bool | owns_reference = `true`
| ) | `[explicit, protected]`

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

Xfc::Gtk::ToggleAction::ToggleAction | ( | const String & | name,
|  | const String & | label,
|  | bool | is_active
| ) |

  | Constructs a new ToggleAction object with a reference count of 1 that the caller owns. Parameters:
  | name | A unique name for the action.
  | label | The label displayed in menu items and on buttons.
  | is_active | Whether the initial state of the toggle action is active.
To add the action to a ActionGroup and set the accelerator for the action, call Gtk::ActionGroup::add_action().

Xfc::Gtk::ToggleAction::ToggleAction | ( | const String & | name,
|  | const StockId & | stock_id,
|  | bool | is_active
| ) |

  | Constructs a new ToggleAction object. Parameters:
  | name | A unique name for the action.
  | is_active | Whether the initial state of the toggle action is active.
  | stock_id | The stock icon and label to display in widgets representing the action.
To add the action to a ActionGroup and set the accelerator for the action, call Gtk::ActionGroup::add_action(). The ToggleAction is created with a reference count of 1 that the caller owns.

Xfc::Gtk::ToggleAction::ToggleAction | ( | const String & | name,
|  | const String & | label,
|  | const StockId & | stock_id,
|  | bool | is_active
| ) |

  | Constructs a new ToggleAction object. Parameters:
  | name | A unique name for the action.
  | label | The label displayed in menu items and on buttons.
  | is_active | Whether the initial state of the toggle action is active.
  | stock_id | The stock icon to display in widgets representing the action.
To add the action to a ActionGroup and set the accelerator for the action, call Gtk::ActionGroup::add_action(). Note that label is displayed instead of the stock_id label. The ToggleAction is created with a reference count of 1 that the caller owns.

## Member Function Documentation

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

| Determines the checked state of the toggle action. Returns: true if the toggle action is checked.

bool Xfc::Gtk::ToggleAction::get_draw_as_radio | ( |  | ) | const

| Determines whether the action should have proxies like a radio action. Returns: Whether the action should have proxies like a radio action.

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

  | Sets the checked state of the toggle action. Parameters:
  | is_active | Whether the action should be checked or not.

void Xfc::Gtk::ToggleAction::set_draw_as_radio | ( | bool | draw_as_radio | ) |

  | Sets whether the action should have proxies like a radio action. Parameters:
  | draw_as_radio | Whether the action should have proxies like a radio action.

## Member Data Documentation

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

| Toggled signal (see signal_toggled()). Calls a slot with the signature:
                 void function();

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

- toggleaction.hh

Xfce Foundation Classes

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