diff options
author | Matthias Clasen <maclas@gmx.de> | 2004-02-18 23:08:45 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2004-02-18 23:08:45 +0000 |
commit | b337db3a54b1a5d887ec7d1c53dcfd0ea40a25d3 (patch) | |
tree | 0e4ce89d4489f8dc43db508e98315cc8376397d2 /gtk/gtkradiomenuitem.c | |
parent | d91e1cdd36e9a50e9a84cead6c0ebce856439ff1 (diff) | |
download | gtk+-b337db3a54b1a5d887ec7d1c53dcfd0ea40a25d3.tar.gz |
New convenience functions analogous to similar API on GtkRadioButton.
Thu Feb 19 00:09:35 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkradiomenuitem.h:
* gtk/gtkradiomenuitem.c (gtk_radio_menu_item_new_from_widget):
(gtk_radio_menu_item_new_with_label_from_widget):
(gtk_radio_menu_item_new_with_mnemonic_from_widget): New
convenience functions analogous to similar API on GtkRadioButton.
(#51700, Vitaly Tishkov, patch by Soeren Sandmann)
Diffstat (limited to 'gtk/gtkradiomenuitem.c')
-rw-r--r-- | gtk/gtkradiomenuitem.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/gtk/gtkradiomenuitem.c b/gtk/gtkradiomenuitem.c index 2662923353..b0bcd2d0ed 100644 --- a/gtk/gtkradiomenuitem.c +++ b/gtk/gtkradiomenuitem.c @@ -169,6 +169,85 @@ gtk_radio_menu_item_new_with_mnemonic (GSList *group, return radio_menu_item; } +/** + * gtk_radio_menu_item_new_from_widget: + * @group: An existing #GtkRadioMenuItem + * + * Creates a new #GtkRadioMenuItem adding it to the same group as @group. + * + * Return value: The new #GtkRadioMenuItem + * + * Since: 2.4 + **/ +GtkWidget * +gtk_radio_menu_item_new_from_widget (GtkRadioMenuItem *group) +{ + GSList *list = NULL; + + g_return_val_if_fail (GTK_IS_RADIO_MENU_ITEM (group), NULL); + + if (group) + list = gtk_radio_menu_item_get_group (group); + + return gtk_radio_menu_item_new (list); +} + +/** + * gtk_radio_menu_item_new_with_mnemonic_from_widget: + * @group: An existing #GtkRadioMenuItem + * @label: the text of the button, with an underscore in front of the + * mnemonic character + * + * 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. + * + * Return value: The new #GtkRadioMenuItem + * + * Since: 2.4 + **/ +GtkWidget * +gtk_radio_menu_item_new_with_mnemonic_from_widget (GtkRadioMenuItem *group, + const gchar *label) +{ + GSList *list = NULL; + + g_return_val_if_fail (GTK_IS_RADIO_MENU_ITEM (group), NULL); + + if (group) + list = gtk_radio_menu_item_get_group (group); + + return gtk_radio_menu_item_new_with_mnemonic (list, label); +} + +/** + * gtk_radio_menu_item_new_with_label_from_widget: + * @group: an existing #GtkRadioMenuItem + * @label: the text for the label + * + * Creates a new GtkRadioMenuItem whose child is a simple GtkLabel. + * The new #GtkRadioMenuItem is added to the same group as @group. + * + * Return value: The new #GtkRadioMenuItem + * + * Since: 2.4 + **/ +GtkWidget * +gtk_radio_menu_item_new_with_label_from_widget (GtkRadioMenuItem *group, + const gchar *label) +{ + GSList *list = NULL; + + g_return_val_if_fail (GTK_IS_RADIO_MENU_ITEM (group), NULL); + + if (group) + list = gtk_radio_menu_item_get_group (group); + + return gtk_radio_menu_item_new_with_label (list, label); +} + GSList* gtk_radio_menu_item_get_group (GtkRadioMenuItem *radio_menu_item) { |