diff --git a/docs/reference/gtk/tmpl/.gitignore b/docs/reference/gtk/tmpl/.gitignore index 12b97aeb0b..997eb9e0f6 100644 --- a/docs/reference/gtk/tmpl/.gitignore +++ b/docs/reference/gtk/tmpl/.gitignore @@ -71,6 +71,7 @@ gtkliststore.sgml gtkmain.sgml gtkmenu.sgml gtkmenubar.sgml +gtkmenuitem.sgml gtkmenushell.sgml gtkmenutoolbutton.sgml gtkmessagedialog.sgml diff --git a/docs/reference/gtk/tmpl/gtkmenuitem.sgml b/docs/reference/gtk/tmpl/gtkmenuitem.sgml deleted file mode 100644 index 881646eef2..0000000000 --- a/docs/reference/gtk/tmpl/gtkmenuitem.sgml +++ /dev/null @@ -1,344 +0,0 @@ - -GtkMenuItem - - -The widget used for item in menus - - - -The #GtkMenuItem widget and the derived widgets are the only valid -childs for menus. Their function is to correctly handle highlighting, -alignment, events and submenus. - - -As it derives from #GtkBin it can hold any valid child widget, altough -only a few are really useful. - - -GtkMenuItem as GtkBuildable - -The GtkMenuItem implementation of the GtkBuildable interface -supports adding a submenu by specifying "submenu" as the "type" -attribute of a <child> element. - - -A UI definition fragment with submenus - - - - - -]]> - - - - - - - -#GtkBin -for how to handle the child. - - -#GtkItem -is the abstract class for all sorts of items. - - -#GtkMenuShell -is always the parent of #GtkMenuItem. - - - - - - - - - - - - - - - - - - -Emitted when the item is activated. - - -@menuitem: the object which received the signal. - - - -Emitted when the item is activated, but also if the menu item has a -submenu. For normal applications, the relevant signal is "activate". - - -@menuitem: the object which received the signal. - - - - - - -@menuitem: the object which received the signal. - - - - - - -@menuitem: the object which received the signal. - - - - - - -@menuitem: the object which received the signal. -@arg1: - - - - - - -@menuitem: the object which received the signal. -@arg1: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Creates a new #GtkMenuItem. - - -@void: -@Returns: the newly created #GtkMenuItem - - - - -Creates a new #GtkMenuItem whose child is a #GtkLabel. - - -@label: the text for the label -@Returns: the newly created #GtkMenuItem - - - - - - - -@label: -@Returns: - - - - - - - -@menu_item: -@right_justified: - - - - - - - -@menu_item: -@Returns: - - - - - - - -@menu_item: -@Returns: - - - - - - - -@menu_item: -@label: - - - - - - - -@menu_item: -@Returns: - - - - - - - -@menu_item: -@setting: - - - - - - - -@menu_item: -@submenu: - - - - - - - -@menu_item: -@Returns: - - - - - - - -@menu_item: -@accel_path: - - - - - - - -@menu_item: -@Returns: - - - - -Emits the "select" signal on the given item. Behaves exactly like -#gtk_item_select. - - -@menu_item: the menu item - - - - -Emits the "deselect" signal on the given item. Behaves exactly like -#gtk_item_deselect. - - -@menu_item: the menu item - - - - -Emits the "activate" signal on the given item - - -@menu_item: the menu item - - - - -Emits the "toggle_size_request" signal on the given item. - - -@menu_item: the menu item -@requisition: the requisition to use as signal data. - - - - -Emits the "toggle_size_allocate" signal on the given item. - - -@menu_item: the menu item. -@allocation: the allocation to use as signal data. - - - - - - - -@menu_item: -@Returns: - - - - - - - -@menu_item: -@reserve: - - diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c index 72fbe4227b..618ebab8bb 100644 --- a/gtk/gtkmenuitem.c +++ b/gtk/gtkmenuitem.c @@ -44,6 +44,38 @@ #include "gtktypebuiltins.h" +/** + * SECTION:gtkmenuitem + * @Short_description: The widget used for item in menus + * @Title: GtkMenuItem + * @See_also: #GtkBin, #GtkItem, #GtkMenuShell + * + * The #GtkMenuItem widget and the derived widgets are the only valid + * childs for menus. Their function is to correctly handle highlighting, + * alignment, events and submenus. + * + * As it derives from #GtkBin it can hold any valid child widget, altough + * only a few are really useful. + * + * + * GtkMenuItem as GtkBuildable + * The GtkMenuItem implementation of the GtkBuildable interface + * supports adding a submenu by specifying "submenu" as the "type" + * attribute of a <child> element. + * + * A UI definition fragment with submenus + * + * + * + * + * + * ]]> + * + * + */ + + enum { ACTIVATE, ACTIVATE_ITEM, @@ -210,6 +242,12 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass) klass->hide_on_activate = TRUE; + /** + * GtkMenuItem::activate: + * @menuitem: the object which received the signal. + * + * Emitted when the item is activated. + */ menu_item_signals[ACTIVATE] = g_signal_new (I_("activate"), G_OBJECT_CLASS_TYPE (gobject_class), @@ -220,6 +258,14 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass) G_TYPE_NONE, 0); widget_class->activate_signal = menu_item_signals[ACTIVATE]; + /** + * GtkMenuItem::activate-item: + * @menuitem: the object which received the signal. + * + * Emitted when the item is activated, but also if the menu item has a + * submenu. For normal applications, the relevant signal is + * #GtkMenuItem::activate. + */ menu_item_signals[ACTIVATE_ITEM] = g_signal_new (I_("activate-item"), G_OBJECT_CLASS_TYPE (gobject_class), @@ -443,12 +489,27 @@ gtk_menu_item_init (GtkMenuItem *menu_item) gtk_style_context_add_class (context, GTK_STYLE_CLASS_MENUITEM); } +/** + * gtk_menu_item_new: + * + * Creates a new #GtkMenuItem. + * + * Returns: the newly created #GtkMenuItem + */ GtkWidget* gtk_menu_item_new (void) { return g_object_new (GTK_TYPE_MENU_ITEM, NULL); } +/** + * gtk_menu_item_new_with_label: + * @label: the text for the label + * + * Creates a new #GtkMenuItem whose child is a #GtkLabel. + * + * Returns: the newly created #GtkMenuItem + */ GtkWidget* gtk_menu_item_new_with_label (const gchar *label) { @@ -1301,6 +1362,13 @@ gtk_menu_item_select (GtkMenuItem *menu_item) } } +/** + * gtk_menu_item_deselect: + * @menu_item: the menu item + * + * Emits the #GtkMenuItem::deselect signal on the given item. Behaves + * exactly like #gtk_item_deselect. + */ void gtk_menu_item_deselect (GtkMenuItem *menu_item) { @@ -1323,6 +1391,12 @@ gtk_menu_item_deselect (GtkMenuItem *menu_item) } } +/** + * gtk_menu_item_activate: + * @menu_item: the menu item + * + * Emits the #GtkMenuItem::activate signal on the given item + */ void gtk_menu_item_activate (GtkMenuItem *menu_item) { @@ -1331,6 +1405,13 @@ gtk_menu_item_activate (GtkMenuItem *menu_item) g_signal_emit (menu_item, menu_item_signals[ACTIVATE], 0); } +/** + * gtk_menu_item_toggle_size_request: + * @menu_item: the menu item + * @requisition: the requisition to use as signal data. + * + * Emits the #GtkMenuItem::toggle-size-request signal on the given item. + */ void gtk_menu_item_toggle_size_request (GtkMenuItem *menu_item, gint *requisition) @@ -1340,6 +1421,13 @@ gtk_menu_item_toggle_size_request (GtkMenuItem *menu_item, g_signal_emit (menu_item, menu_item_signals[TOGGLE_SIZE_REQUEST], 0, requisition); } +/** + * gtk_menu_item_toggle_size_allocate: + * @menu_item: the menu item. + * @allocation: the allocation to use as signal data. + * + * Emits the #GtkMenuItem::toggle-size-allocate signal on the given item. + */ void gtk_menu_item_toggle_size_allocate (GtkMenuItem *menu_item, gint allocation) @@ -1666,6 +1754,13 @@ gtk_menu_item_draw (GtkWidget *widget, return FALSE; } +/** + * gtk_menu_item_select: + * @menu_item: the menu item + * + * Emits the #GtkMenuItem::select signal on the given item. Behaves + * exactly like #gtk_item_select. + */ static void gtk_real_menu_item_select (GtkMenuItem *menu_item) {