manpagez: man pages & more
html files: gtk3
Home | html | info | man

GtkRadioMenuItem

GtkRadioMenuItem — A choice from multiple check menu items

Properties

Signals

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkContainer
                ╰── GtkBin
                    ╰── GtkMenuItem
                        ╰── GtkCheckMenuItem
                            ╰── GtkRadioMenuItem

Implemented Interfaces

GtkRadioMenuItem implements AtkImplementorIface, GtkBuildable, GtkActivatable and GtkActionable.

Includes

#include <gtk/gtk.h>

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

1
2
3
4
5
6
7
8
9
10
11
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

1
2
3
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.

Functions

gtk_radio_menu_item_new ()

GtkWidget *
gtk_radio_menu_item_new (GSList *group);

Creates a new GtkRadioMenuItem.

Parameters

group

the group to which the radio menu item is to be attached, or NULL.

[element-type GtkRadioMenuItem][allow-none]

Returns

a new GtkRadioMenuItem


gtk_radio_menu_item_new_with_label ()

GtkWidget *
gtk_radio_menu_item_new_with_label (GSList *group,
                                    const gchar *label);

Creates a new GtkRadioMenuItem whose child is a simple GtkLabel.

Parameters

group

group the radio menu item is inside, or NULL.

[element-type GtkRadioMenuItem][allow-none]

label

the text for the label

 

Returns

A new GtkRadioMenuItem.

[transfer none]


gtk_radio_menu_item_new_with_mnemonic ()

GtkWidget *
gtk_radio_menu_item_new_with_mnemonic (GSList *group,
                                       const gchar *label);

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

Parameters

group

group the radio menu item is inside, or NULL.

[element-type GtkRadioMenuItem][allow-none]

label

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

 

Returns

a new GtkRadioMenuItem


gtk_radio_menu_item_new_from_widget ()

GtkWidget *
gtk_radio_menu_item_new_from_widget (GtkRadioMenuItem *group);

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

[constructor]

Parameters

group

An existing GtkRadioMenuItem.

[allow-none]

Returns

The new GtkRadioMenuItem.

[transfer none]

Since: 2.4


gtk_radio_menu_item_new_with_label_from_widget ()

GtkWidget *
gtk_radio_menu_item_new_with_label_from_widget
                               (GtkRadioMenuItem *group,
                                const gchar *label);

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

[constructor]

Parameters

group

an existing GtkRadioMenuItem.

[allow-none]

label

the text for the label.

[allow-none]

Returns

The new GtkRadioMenuItem.

[transfer none]

Since: 2.4


gtk_radio_menu_item_new_with_mnemonic_from_widget ()

GtkWidget *
gtk_radio_menu_item_new_with_mnemonic_from_widget
                               (GtkRadioMenuItem *group,
                                const gchar *label);

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

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

[constructor]

Parameters

group

An existing GtkRadioMenuItem.

[allow-none]

label

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

[allow-none]

Returns

The new GtkRadioMenuItem.

[transfer none]

Since: 2.4


gtk_radio_menu_item_set_group ()

void
gtk_radio_menu_item_set_group (GtkRadioMenuItem *radio_menu_item,
                               GSList *group);

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

Parameters

radio_menu_item

a GtkRadioMenuItem.

 

group

the new group, or NULL.

[element-type GtkRadioMenuItem][allow-none]

gtk_radio_menu_item_get_group ()

GSList *
gtk_radio_menu_item_get_group (GtkRadioMenuItem *radio_menu_item);

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

Parameters

radio_menu_item

a GtkRadioMenuItem

 

Returns

the group of radio_menu_item .

[element-type GtkRadioMenuItem][transfer none]


gtk_radio_menu_item_join_group ()

void
gtk_radio_menu_item_join_group (GtkRadioMenuItem *radio_menu_item,
                                GtkRadioMenuItem *group_source);

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

This function should be used by language bindings to avoid the memory manangement of the opaque GSList of gtk_radio_menu_item_get_group() and gtk_radio_menu_item_set_group().

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

1
2
3
4
5
6
7
8
9
10
11
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;
  }

Parameters

radio_menu_item

a GtkRadioMenuItem

 

group_source

a GtkRadioMenuItem whose group we are joining, or NULL to remove the radio_menu_item from its current group.

[allow-none]

Since: 3.18

Types and Values

struct GtkRadioMenuItem

struct GtkRadioMenuItem;

Property Details

The “group” property

  “group”                    GtkRadioMenuItem *

The radio menu item whose group this widget belongs to.

Flags: Write

Since: 2.8

Signal Details

The “group-changed” signal

void
user_function (GtkRadioMenuItem *radiomenuitem,
               gpointer          user_data)

Flags: Run First

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.