RadioMenuItem

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.RadioMenuItem 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:

How to create a group of radio menu items.

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);
}

CSS nodes

|[<!-- language="plain" --> menuitem ├── radio.left ╰── <child>

GtkRadioMenuItem has a main CSS node with name menuitem, and a subnode
with name radio, which gets the .left or .right style class.

Constructors

this
this(GtkRadioMenuItem* gtkRadioMenuItem, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(RadioMenuItem radioMenuItem, string label, bool mnemonic)

Creates a new GtkRadioMenuItem whose child is a simple GtkLabel. The new GtkRadioMenuItem is added to the same group as group. If mnemonic is true the label will be created using Label.newWithMnemonic, so underscores in label indicate the mnemonic for the menu item. Since 2.4

this
this(ListSG group, string label, bool mnemonic)

Creates a new GtkRadioMenuItem whose child is a simple GtkLabel.

this
this(ListSG group)

Creates a new gtk.RadioMenuItem

this
this(RadioMenuItem group)

Creates a new gtk.RadioMenuItem adding it to the same group as group.

Members

Functions

addOnGroupChanged
gulong addOnGroupChanged(void delegate(RadioMenuItem) dlg, ConnectFlags connectFlags)
getGroup
ListSG getGroup()

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

getRadioMenuItemStruct
GtkRadioMenuItem* getRadioMenuItemStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

joinGroup
void joinGroup(RadioMenuItem groupSource)

Joins a gtk.RadioMenuItem object to the group of another gtk.RadioMenuItem object.

setGroup
void setGroup(ListSG group)

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

Static functions

getType
GType getType()

Variables

gtkRadioMenuItem
GtkRadioMenuItem* gtkRadioMenuItem;

the main Gtk struct

Inherited Members

From CheckMenuItem

gtkCheckMenuItem
GtkCheckMenuItem* gtkCheckMenuItem;

the main Gtk struct

getCheckMenuItemStruct
GtkCheckMenuItem* getCheckMenuItemStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getType
GType getType()
getActive
bool getActive()

Returns whether the check menu item is active. See gtk_check_menu_item_set_active ().

getDrawAsRadio
bool getDrawAsRadio()

Returns whether check_menu_item looks like a gtk.RadioMenuItem

getInconsistent
bool getInconsistent()

Retrieves the value set by CheckMenuItem.setInconsistent.

setActive
void setActive(bool isActive)

Sets the active state of the menu item’s check box.

setDrawAsRadio
void setDrawAsRadio(bool drawAsRadio)

Sets whether check_menu_item is drawn like a gtk.RadioMenuItem

setInconsistent
void setInconsistent(bool setting)

If the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a boolean setting, and the current values in that range are inconsistent, you may want to display the check in an “in between” state. This function turns on “in between” display. Normally you would turn off the inconsistent state again if the user explicitly selects a setting. This has to be done manually, CheckMenuItem.setInconsistent only affects visual appearance, it doesn’t affect the semantics of the widget.

toggled
void toggled()

Emits the toggled signal.

addOnToggled
gulong addOnToggled(void delegate(CheckMenuItem) dlg, ConnectFlags connectFlags)

This signal is emitted when the state of the check box is changed.