Next: , Previous: GtkImageMenuItem, Up: Top


61 GtkRadioMenuItem

A choice from multiple check menu items

61.1 Overview

A radio menu item is a check menu item that belongs to a group. At each instant exactly one of the radio menu items from a group is selected.

The group list does not need to be freed, as each <gtk-radio-menu-item> will remove itself and its list item when it is destroyed.

The correct way to create a group of radio menu items is approximatively this:

     
     GSList *group = NULL;
     GtkWidget *item;
     gint i;
     
     for (i = 0; i < 5; i++)
     {
       item = gtk_radio_menu_item_new_with_label (group, "This is an example");
       group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
       if (i == 1)
         gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE);
     }

61.2 Usage

— Class: <gtk-radio-menu-item>

Derives from <gtk-check-menu-item>.

This class defines the following slots:

group
The radio menu item whose group this widget belongs to.
— Signal on <gtk-radio-menu-item>: group-changed
— Function: gtk-radio-menu-item-new (group <gtk-radio-group*>) ⇒  (ret <gtk-widget>)

Creates a new <gtk-radio-menu-item>.

group
the group to which the radio menu item is to be attached
ret
a new <gtk-radio-menu-item>
— Function: gtk-radio-menu-item-new-with-label (group <gtk-radio-group*>) (label mchars) ⇒  (ret <gtk-widget>)

Creates a new <gtk-radio-menu-item> whose child is a simple <gtk-label>.

group
the group to which the radio menu item is to be attached
label
the text for the label
ret
a new <gtk-radio-menu-item>
— Function: gtk-radio-menu-item-new-from-widget (group <gtk-radio-menu-item>) ⇒  (ret <gtk-widget>)

Creates a new <gtk-radio-menu-item> adding it to the same group as group.

group
An existing <gtk-radio-menu-item>
ret
The new <gtk-radio-menu-item>

Since 2.4

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

Sets the group of a radio menu item, or changes it.

radio-menu-item
a <gtk-radio-menu-item>.
group
the new group.
— Function: gtk-radio-menu-item-get-group (self <gtk-radio-menu-item>) ⇒  (ret <gtk-radio-group*>)
— Method: get-group

Returns the group to which the radio menu item belongs, as a <g-list> of <gtk-radio-menu-item>. The list belongs to GTK+ and should not be freed.

radio-menu-item
a <gtk-radio-menu-item>.
ret
the group of radio-menu-item.