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)
This commit is contained in:
Matthias Clasen 2004-02-18 23:08:45 +00:00 committed by Matthias Clasen
parent d91e1cdd36
commit b337db3a54
9 changed files with 150 additions and 18 deletions

View File

@ -1,3 +1,12 @@
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)
Wed Feb 18 17:53:27 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gdk/gdkwindow.c (gdk_window_get_bg_gc): Use a scratch GC in the

View File

@ -1,3 +1,12 @@
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)
Wed Feb 18 17:53:27 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gdk/gdkwindow.c (gdk_window_get_bg_gc): Use a scratch GC in the

View File

@ -1,3 +1,12 @@
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)
Wed Feb 18 17:53:27 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gdk/gdkwindow.c (gdk_window_get_bg_gc): Use a scratch GC in the

View File

@ -1,3 +1,12 @@
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)
Wed Feb 18 17:53:27 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gdk/gdkwindow.c (gdk_window_get_bg_gc): Use a scratch GC in the

View File

@ -1,3 +1,12 @@
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)
Wed Feb 18 17:53:27 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gdk/gdkwindow.c (gdk_window_get_bg_gc): Use a scratch GC in the

View File

@ -1,3 +1,9 @@
Thu Feb 19 00:11:23 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtk-sections.txt: Add 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.
2004-02-17 Federico Mena Quintero <federico@ximian.com>
* gtk/migrating-checklist.sgml: Add a missing semicolon to an

View File

@ -2402,6 +2402,9 @@ GtkRadioMenuItem
gtk_radio_menu_item_new
gtk_radio_menu_item_new_with_label
gtk_radio_menu_item_new_with_mnemonic
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
gtk_radio_menu_item_group
gtk_radio_menu_item_set_group
gtk_radio_menu_item_get_group

View File

@ -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)
{

View File

@ -31,11 +31,7 @@
#include <gdk/gdk.h>
#include <gtk/gtkcheckmenuitem.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
G_BEGIN_DECLS
#define GTK_TYPE_RADIO_MENU_ITEM (gtk_radio_menu_item_get_type ())
#define GTK_RADIO_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RADIO_MENU_ITEM, GtkRadioMenuItem))
@ -68,11 +64,17 @@ struct _GtkRadioMenuItemClass
GType gtk_radio_menu_item_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_radio_menu_item_new (GSList *group);
GtkWidget* gtk_radio_menu_item_new_with_label (GSList *group,
const gchar *label);
GtkWidget* gtk_radio_menu_item_new_with_mnemonic (GSList *group,
const gchar *label);
GtkWidget* gtk_radio_menu_item_new_from_widget (GtkRadioMenuItem *group);
GtkWidget *gtk_radio_menu_item_new_with_mnemonic_from_widget (GtkRadioMenuItem *group,
const gchar *label);
GtkWidget *gtk_radio_menu_item_new_with_label_from_widget (GtkRadioMenuItem *group,
const gchar *label);
GSList* gtk_radio_menu_item_get_group (GtkRadioMenuItem *radio_menu_item);
void gtk_radio_menu_item_set_group (GtkRadioMenuItem *radio_menu_item,
GSList *group);
@ -81,9 +83,6 @@ void gtk_radio_menu_item_set_group (GtkRadioMenuItem *radio_menu_i
#define gtk_radio_menu_item_group gtk_radio_menu_item_get_group
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
G_END_DECLS
#endif /* __GTK_RADIO_MENU_ITEM_H__ */