Next: , Previous: GtkToggleAction, Up: Top

76 GtkRadioAction

An action of which only one in a group can be active

76.1 Overview

A <gtk-radio-action> is similar to <gtk-radio-menu-item>. A number of radio actions can be linked together so that only one may be active at any one time.

76.2 Usage

— Class: <gtk-radio-action>

Derives from <gtk-toggle-action>.

This class defines the following slots:

The value returned by gtk_radio_action_get_current_value() when this action is the current action of its group.
The radio action whose group this action belongs to.
The value property of the currently active member of the group to which this action belongs.
— Signal on <gtk-radio-action>: changed (arg0 <gtk-radio-action>)

The ::changed signal is 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.

Since 2.4

— Function: gtk-radio-action-new (name mchars) (label mchars) (tooltip mchars) (stock_id mchars) (value int) ⇒  (ret <gtk-radio-action>)

Creates a new <gtk-radio-action> object. To add the action to a <gtk-action-group> and set the accelerator for the action, call gtk-action-group-add-action-with-accel.

A unique name for the action
The label displayed in menu items and on buttons
A tooltip for this action
The stock icon to display in widgets representing this action
The value which gtk-radio-action-get-current-value should return if this action is selected.
a new <gtk-radio-action>

Since 2.4

— Function: gtk-radio-action-get-group (self <gtk-radio-action>) ⇒  (ret <gtk-radio-group*>)
— Method: get-group

Returns the list representing the radio group for this object. Note that the returned list is only valid until the next change to the group.

A common way to set up a group of radio group is the following:

            GSList *group = NULL;
            GtkRadioAction *action;
            while (/* more actions to add */)
                 action = gtk_radio_action_new (...);
                 gtk_radio_action_set_group (action, group);
                 group = gtk_radio_action_get_group (action);
the action object
the list representing the radio group for this object

Since 2.4

— Function: gtk-radio-action-set-group (self <gtk-radio-action>) (group <gtk-radio-group*>)
— Method: set-group

Sets the radio group for the radio action object.

the action object
a list representing a radio group

Since 2.4

— Function: gtk-radio-action-get-current-value (self <gtk-radio-action>) ⇒  (ret int)
— Method: get-current-value

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

a <gtk-radio-action>
The value of the currently active group member

Since 2.4

— Function: gtk-radio-action-set-current-value (self <gtk-radio-action>) (current_value int)
— Method: set-current-value

Sets the currently active group member to the member with value property current-value.

a <gtk-radio-action>
the new value

Since 2.10