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

# Xfc::Gtk::RadioAction Class Reference

A GtkRadioAction C++ wrapper class. More...

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

Inheritance diagram for Xfc::Gtk::RadioAction:

List of all members.

## Signal Prototypes

- const ChangedSignalType changed_signal
    Changed signal (see signal_changed()).

## Public Types

- typedef GSList Group
    The radio action group.

## Public Member Functions

Constructors

- RadioAction (const RadioAction *group, const String &name, const String &label, int value)
    Constructs a RadioAction object that is a member of group.
- RadioAction (const RadioAction *group, const String &name, const StockId &stock_id, int value)
    Constructs a RadioAction object that is a member of group.
- RadioAction (const RadioAction *group, const String &name, const String &label, const StockId &stock_id, int value)
    Constructs a RadioAction object that is a member of group.
- virtual ~RadioAction ()
    Destructor.

Accessors

- GtkRadioAction * gtk_radio_action () const
    Get a pointer to the GtkRadioAction structure.
- operator GtkRadioAction * () const
    Conversion operator; safely converts an RadioAction to a GtkRadioAction pointer.
- Group * get_group () const
    Returns the list representing the radio group for this object.
- int get_value () const
    Obtains the value for this radio action.
- int get_current_value () const
    Obtains the value of the currently active member of the group to which action belongs.

Methods

- void set_group (Group *group)
    Sets the radio group for the radio action object.

Signal Proxies

- const ChangedSignalProxy signal_changed ()
    Connect to the changed_signal; emitted on every member of a radio group when the active member is changed.

## Protected Member Functions

Constructors

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

## Detailed Description

A GtkRadioAction C++ wrapper class.

A RadioAction is similar to RadioMenuItem. A number of radio actions can be linked together so that only one may be active at any one time.

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::RadioAction::RadioAction | ( | GtkRadioAction * | action,
|  | bool | owns_reference = `true`
| ) | `[explicit, protected]`

Construct a new RadioAction from an existing GtkRadioAction.

Parameters:

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

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

Xfc::Gtk::RadioAction::RadioAction | ( | const RadioAction * | group,
|  | const String & | name,
|  | const String & | label,
|  | int | value
| ) |

Constructs a RadioAction object that is a member of group.

Parameters:

  | group | An existing radio button group, or null to start a new group.
  | name | A unique name for the action.
  | label | The label displayed in menu items and on buttons.
  | value | The value which get_current_value() should return if this action is selected.

To add the action to an ActionGroup and set the accelerator for the action, call Gtk::ActionGroup::add_action(). The RadioAction is created with a reference count of 1 that the caller owns.

Xfc::Gtk::RadioAction::RadioAction | ( | const RadioAction * | group,
|  | const String & | name,
|  | const StockId & | stock_id,
|  | int | value
| ) |

Constructs a RadioAction object that is a member of group.

Parameters:

  | group | An existing radio button group, or null to start a new group.
  | name | A unique name for the action.
  | stock_id | The stock icon and label to display in widgets representing the action.
  | value | The value which get_current_value() should return if this action is selected.

To add the action to an ActionGroup and set the accelerator for the action, call Gtk::ActionGroup::add_action(). The RadioAction is created with a reference count of 1 that the caller owns.

Xfc::Gtk::RadioAction::RadioAction | ( | const RadioAction * | group,
|  | const String & | name,
|  | const String & | label,
|  | const StockId & | stock_id,
|  | int | value
| ) |

Constructs a RadioAction object that is a member of group.

Parameters:

  | group | An existing radio button group, or null to start a new group.
  | name | A unique name for the action.
  | label | The label displayed in menu items and on buttons.
  | stock_id | The stock icon to display in widgets representing the action.
  | value | The value which get_current_value() should return if this action is selected.

To add the action to an 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 RadioAction is created with a reference count of 1 that the caller owns.

## Member Function Documentation

int Xfc::Gtk::RadioAction::get_current_value | ( |  | ) | const

Obtains the value of the currently active member of the group to which action belongs.

Returns:
  The value of the currently active group member.

Group* Xfc::Gtk::RadioAction::get_group | ( |  | ) | const

Returns the list representing the radio group for this object.

Returns:
  The list representing the radio group for this object.

int Xfc::Gtk::RadioAction::get_value | ( |  | ) | const

Obtains the value for this radio action.

Returns:
  The value that identifies this radio action.

void Xfc::Gtk::RadioAction::set_group | ( | Group * | group | ) |

Sets the radio group for the radio action object.

Parameters:

  | group | A list representing a radio group.

const ChangedSignalProxy Xfc::Gtk::RadioAction::signal_changed | ( |  | ) |

| Connect to the changed_signal; emitted on every member of a radio group when the active member is changed. The signal gets emitted after the "activate" signals for the previous and current active members. When creating a group radio actions manually with Gtk::ActionGroup::add_action() you only need to connect the changed_signal to the first radio action in the group.

## Member Data Documentation

const ChangedSignalType Xfc::Gtk::RadioAction::changed_signal `[static, protected]`

Changed signal (see signal_changed()).

Calls a slot with the signature:

                 void function(RadioAction& current);
                 // current: The member of the action group which has just been activated.

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

- radioaction.hh

Xfce Foundation Classes

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