gi-gtk-3.0.11: Gtk bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.RadioMenuItem

Contents

Description

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

C code

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

plain code

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.

Synopsis

Exported types

Methods

getGroup

radioMenuItemGetGroup Source #

Arguments

:: (HasCallStack, MonadIO m, IsRadioMenuItem a) 
=> a

radioMenuItem: a RadioMenuItem

-> m [RadioMenuItem]

Returns: the group of radioMenuItem

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

joinGroup

radioMenuItemJoinGroup Source #

Arguments

:: (HasCallStack, MonadIO m, IsRadioMenuItem a, IsRadioMenuItem b) 
=> a

radioMenuItem: a RadioMenuItem

-> Maybe b

groupSource: a RadioMenuItem whose group we are joining, or Nothing to remove the radioMenuItem from its current group

-> m () 

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

This function should be used by language bindings to avoid the memory manangement of the opaque SList of radioMenuItemGetGroup and radioMenuItemSetGroup.

A common way to set up a group of RadioMenuItem instances is:

 GtkRadioMenuItem *last_item = NULL;

 while ( ...more items to add... )
   {
     GtkRadioMenuItem *radio_item;

     radio_item = gtk_radio_menu_item_new (...);

     gtk_radio_menu_item_join_group (radio_item, last_item);
     last_item = radio_item;
   }

Since: 3.18

new

radioMenuItemNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsRadioMenuItem a) 
=> [a]

group: the group to which the radio menu item is to be attached, or Nothing

-> m RadioMenuItem

Returns: a new RadioMenuItem

Creates a new RadioMenuItem.

newFromWidget

radioMenuItemNewFromWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsRadioMenuItem a) 
=> Maybe a

group: An existing RadioMenuItem

-> m RadioMenuItem

Returns: The new RadioMenuItem

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

Since: 2.4

newWithLabel

radioMenuItemNewWithLabel Source #

Arguments

:: (HasCallStack, MonadIO m, IsRadioMenuItem a) 
=> [a]

group: group the radio menu item is inside, or Nothing

-> Text

label: the text for the label

-> m RadioMenuItem

Returns: A new RadioMenuItem

Creates a new RadioMenuItem whose child is a simple Label.

newWithLabelFromWidget

radioMenuItemNewWithLabelFromWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsRadioMenuItem a) 
=> Maybe a

group: an existing RadioMenuItem

-> Maybe Text

label: the text for the label

-> m RadioMenuItem

Returns: The new RadioMenuItem

Creates a new GtkRadioMenuItem whose child is a simple GtkLabel. The new RadioMenuItem is added to the same group as group.

Since: 2.4

newWithMnemonic

radioMenuItemNewWithMnemonic Source #

Arguments

:: (HasCallStack, MonadIO m, IsRadioMenuItem a) 
=> [a]

group: group the radio menu item is inside, or Nothing

-> Text

label: the text of the button, with an underscore in front of the mnemonic character

-> m RadioMenuItem

Returns: a new RadioMenuItem

Creates a new RadioMenuItem containing a label. The label will be created using labelNewWithMnemonic, so underscores in label indicate the mnemonic for the menu item.

newWithMnemonicFromWidget

radioMenuItemNewWithMnemonicFromWidget Source #

Arguments

:: (HasCallStack, MonadIO m, IsRadioMenuItem a) 
=> Maybe a

group: An existing RadioMenuItem

-> Maybe Text

label: the text of the button, with an underscore in front of the mnemonic character

-> m RadioMenuItem

Returns: The new RadioMenuItem

Creates a new GtkRadioMenuItem containing a label. The label will be created using labelNewWithMnemonic, so underscores in label indicate the mnemonic for the menu item.

The new RadioMenuItem is added to the same group as group.

Since: 2.4

setGroup

radioMenuItemSetGroup Source #

Arguments

:: (HasCallStack, MonadIO m, IsRadioMenuItem a, IsRadioMenuItem b) 
=> a

radioMenuItem: a RadioMenuItem.

-> [b]

group: the new group, or Nothing.

-> m () 

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

Properties

group

data RadioMenuItemGroupPropertyInfo Source #

Instances

AttrInfo RadioMenuItemGroupPropertyInfo Source # 
type AttrOrigin RadioMenuItemGroupPropertyInfo Source # 
type AttrLabel RadioMenuItemGroupPropertyInfo Source # 
type AttrGetType RadioMenuItemGroupPropertyInfo Source # 
type AttrBaseTypeConstraint RadioMenuItemGroupPropertyInfo Source # 
type AttrSetTypeConstraint RadioMenuItemGroupPropertyInfo Source # 
type AttrAllowedOps RadioMenuItemGroupPropertyInfo Source # 

Signals

groupChanged