Sets our main struct and passes it to the parent class
Creates a new GtkMenu
Creates a GtkMenu and populates it with menu items and submenus according to model. The created menu items are connected to actions found in the GtkApplicationWindow to which the menu belongs - typically by means of being attached to a widget (see gtk_menu_attach_to_widget()) that is contained within the GtkApplicationWindows widget hierarchy.
Creates and append a submenu to this menu. This menu item that actualy has the sub menu is also created.
Adds a new GtkMenuItem to a (table) menu. The number of 'cells' that an item will occupy is specified by left_attach, right_attach, top_attach and bottom_attach. These each represent the leftmost, rightmost, uppermost and lower column and row numbers of the table. (Columns and rows are indexed from zero). Note that this function is not related to gtk_menu_detach(). Since 2.4
Attaches the menu to the widget and provides a callback function that will be invoked when the menu calls gtk_menu_detach() during its destruction. If the menu is attached to the widget then it will be destroyed when the widget is destroyed, as if it was a child widget. An attached menu will also move between screens correctly if the widgets moves between screens.
Detaches the menu from the widget to which it had been attached. This function will call the callback function, detacher, provided when the gtk_menu_attach_to_widget() function was called.
Gets the GtkAccelGroup which holds global accelerators for the menu. See gtk_menu_set_accel_group().
Retrieves the accelerator path set on the menu. Since 2.14
Returns the selected menu item from the menu. This is used by the GtkComboBox.
Returns the GtkWidget that the menu is attached to.
Retrieves the number of the monitor on which to show the menu. Since 2.14
Returns whether the menu reserves space for toggles and icons, regardless of their actual presence. Since 2.18
the main Gtk struct as a void*
Warning gtk_menu_get_tearoff_state is deprecated and should not be used in newly-written code. 3.10 Returns whether the menu is torn off. See gtk_menu_set_tearoff_state().
Warning gtk_menu_get_title is deprecated and should not be used in newly-written code. 3.10 Returns the title of the menu. See gtk_menu_set_title().
Removes the menu from the screen.
Popups up this menu
Displays a menu and makes it available for selection. Applications can use this function to display context-sensitive menus, and will typically supply NULL for the parent_menu_shell, parent_menu_item, func and data parameters. The default menu positioning function will position the menu at the current mouse cursor position. The button parameter should be the mouse button pressed to initiate the menu popup. If the menu popup was initiated by something other than a mouse button press, such as a mouse button release or a keypress, button should be 0. The activate_time parameter is used to conflict-resolve initiation of concurrent requests for mouse/keyboard grab requests. To function properly, this needs to be the timestamp of the user event (such as a mouse click or key press) that caused the initiation of the popup. Only if no such event is available, gtk_get_current_event_time() can be used instead.
Displays a menu and makes it available for selection. Applications can use this function to display context-sensitive menus, and will typically supply NULL for the parent_menu_shell, parent_menu_item, func, data and destroy parameters. The default menu positioning function will position the menu at the current position of device (or its corresponding pointer). The button parameter should be the mouse button pressed to initiate the menu popup. If the menu popup was initiated by something other than a mouse button press, such as a mouse button release or a keypress, button should be 0. The activate_time parameter is used to conflict-resolve initiation of concurrent requests for mouse/keyboard grab requests. To function properly, this needs to be the time stamp of the user event (such as a mouse click or key press) that caused the initiation of the popup. Only if no such event is available, gtk_get_current_event_time() can be used instead.
Moves child to a new position in the list of menu children.
Repositions the menu according to its position function.
Set the GtkAccelGroup which holds global accelerators for the menu. This accelerator group needs to also be added to all windows that this menu is being used in with gtk_window_add_accel_group(), in order for those windows to support all the accelerators contained in this group.
Sets an accelerator path for this menu from which accelerator paths for its immediate children, its menu items, can be constructed. The main purpose of this function is to spare the programmer the inconvenience of having to call gtk_menu_item_set_accel_path() on each menu item that should support runtime user changable accelerators. Instead, by just calling gtk_menu_set_accel_path() on their parent, each menu item of this menu, that contains a label describing its purpose, automatically gets an accel path assigned. For example, a menu containing menu items "New" and "Exit", will, after gtk_menu_set_accel_path (menu, "<Gnumeric-Sheet>/File");
Selects the specified menu item within the menu. This is used by the GtkComboBox and should not be used by anyone else.
Informs GTK+ on which monitor a menu should be popped up. See gdk_screen_get_monitor_geometry(). This function should be called from a GtkMenuPositionFunc if the menu should not appear on the same monitor as the pointer. This information can't be reliably inferred from the coordinates returned by a GtkMenuPositionFunc, since, for very long menus, these coordinates may extend beyond the monitor boundaries or even the screen boundaries. Since 2.4
Sets whether the menu should reserve space for drawing toggles or icons, regardless of their actual presence. Since 2.18
Sets the GdkScreen on which the menu will be displayed. Since 2.2
Warning gtk_menu_set_tearoff_state is deprecated and should not be used in newly-written code. 3.10 Changes the tearoff state of the menu. A menu is normally displayed as drop down menu which persists as long as the menu is active. It can also be displayed as a tearoff menu which persists until it is closed or reattached.
Warning gtk_menu_set_title is deprecated and should not be used in newly-written code. 3.10 Sets the title string for the menu. The title is displayed when the menu is shown as a tearoff menu. If title is NULL, the menu will see if it is attached to a parent menu item, and if so it will try to use the same text as that menu item's label.
Returns a list of the menus which are attached to this widget. This list is owned by GTK+ and must not be modified. Since 2.6
the main Gtk struct
the main Gtk struct
the main Gtk struct as a void*
An action signal that activates the current menu item within the menu shell.
An action signal which cancels the selection within the menu shell. Causes the "selection-done" signal to be emitted.
A keybinding signal which moves the focus in the given direction.
This signal is emitted when a menu shell is deactivated.
The ::insert signal is emitted when a new GtkMenuItem is added to a GtkMenuShell. A separate signal is used instead of GtkContainer::add because of the need for an additional position parameter. The inverse of this signal is the GtkContainer::removed signal. Since 3.2
An keybinding signal which moves the current menu item in the direction specified by direction.
The ::move-selected signal is emitted to move the selection to another item. TRUE to stop the signal emission, FALSE to continue Since 2.12
This signal is emitted when a selection has been completed within a menu shell.
Adds a new GtkMenuItem to the end of the menu shell's item list.
Adds a new GtkMenuItem to the beginning of the menu shell's item list.
Adds a new GtkMenuItem to the menu shell's item list at the position indicated by position.
Deactivates the menu shell. Typically this results in the menu shell being erased from the screen.
Selects the menu item from the menu shell.
Select the first visible or selectable child of the menu shell; don't select tearoff items unless the only item is a tearoff item. Since 2.2
Deselects the currently selected item from the menu shell, if any.
Activates the menu item within the menu shell.
Cancels the selection within the menu shell. Since 2.4
If take_focus is TRUE (the default) the menu shell will take the keyboard focus so that it will receive all keyboard events which is needed to enable keyboard navigation in menus. Setting take_focus to FALSE is useful only for special applications like virtual keyboard implementations which should not take keyboard focus. The take_focus state of a menu or menu bar is automatically propagated to submenus whenever a submenu is popped up, so you don't have to worry about recursively setting it for your entire menu hierarchy. Only when programmatically picking a submenu and popping it up manually, the take_focus property of the submenu needs to be set explicitely. Since 2.8
Returns TRUE if the menu shell will take the keyboard focus on popup. Since 2.8
Gets the currently selected item.
Gets the parent menu shell. The parent menu shell of a submenu is the GtkMenu or GtkMenuBar from which it was opened up.
Establishes a binding between a GtkMenuShell and a GMenuModel. The contents of shell are removed and then refilled with menu items according to model. When model changes, shell is updated. Calling this function twice on shell with different model will cause the first binding to be replaced with a binding to the new model. If model is NULL then any previous binding is undone and all children are removed. with_separators determines if toplevel items (eg: sections) have separators inserted between them. This is typically desired for menus but doesn't make sense for menubars. If action_namespace is non-NULL then the effect is as if all actions mentioned in the model have their names prefixed with the namespace, plus a dot. For example, if the action "quit" is mentioned and action_namespace is "app" then the effective action name is "app.quit". This function uses GtkActionable to define the action name and target values on the created menu items. If you want to use an action group other than "app" and "win", or if you want to use a GtkMenuShell outside of a GtkApplicationWindow, then you will need to attach your own action group to the widget hierarchy using gtk_widget_insert_action_group(). As an example, if you created a group with a "quit" action and inserted it with the name "mygroup" then you would use the action name "mygroup.quit" in your GMenuModel. For most cases you are probably better off using gtk_menu_new_from_model() or gtk_menu_bar_new_from_model() or just directly passing the GMenuModel to gtk_application_set_app_menu() or gtk_application_set_menu_bar().
A GtkMenu is a GtkMenuShell that implements a drop down menu consisting of a list of GtkMenuItem objects which can be navigated and activated by the user to perform application functions.
A GtkMenu is most commonly dropped down by activating a GtkMenuItem in a GtkMenuBar or popped up by activating a GtkMenuItem in another GtkMenu.
A GtkMenu can also be popped up by activating a GtkComboBox. Other composite widgets such as the GtkNotebook can pop up a GtkMenu as well.
Applications can display a GtkMenu as a popup menu by calling the gtk_menu_popup() function. The example below shows how an application can pop up a menu when the 3rd mouse button is pressed.