Adds a custom widget to a generated menu.
Returns the flags that popover uses to create/display a menu from its model.
Returns the menu model used to populate the popover.
Removes a widget that has previously been added with gtk.popover_menu.PopoverMenu.addChild
Sets the flags that popover uses to create/display a menu from its model.
Sets a new menu model on popover.
Creates a gtk.popover_menu.PopoverMenu and populates it according to model.
Creates a gtk.popover_menu.PopoverMenu and populates it according to model.
Returns whether the popover is modal.
Returns whether the popover will close after a modal child is closed.
Gets the child widget of popover.
Gets whether this popover is showing an arrow pointing at the widget that it is relative to.
Gets whether mnemonics are visible.
Gets the offset previous set with gtk.popover.Popover.setOffset.
Gets the rectangle that the popover points to.
Returns the preferred position of popover.
Pops popover down.
Pops popover up.
Allocate a size for the gtk.popover.Popover.
Sets whether popover is modal.
If cascade_popdown is true, the popover will be closed when a child modal popover is closed.
Sets the child widget of popover.
Sets the default widget of a gtk.popover.Popover.
Sets whether this popover should draw an arrow pointing at the widget it is relative to.
Sets whether mnemonics should be visible.
Sets the offset to use when calculating the position of the popover.
Sets the rectangle that popover points to.
Sets the preferred position for popover to appear.
Connect to ActivateDefault signal.
Connect to Closed signal.
gtk.popover_menu.PopoverMenu is a subclass of gtk.popover.Popover that implements menu behavior.
gtk.popover_menu.PopoverMenu treats its children like menus and allows switching between them. It can open submenus as traditional, nested submenus, or in a more touch-friendly sliding fashion. The property gtk.popover_menu.PopoverMenu.PopoverMenuFlags controls this appearance.
gtk.popover_menu.PopoverMenu is meant to be used primarily with menu models, using gtk.popover_menu.PopoverMenu.newFromModel. If you need to put other widgets such as a gtk.spin_button.SpinButton or a gtk.switch_.Switch into a popover, you can use gtk.popover_menu.PopoverMenu.addChild.
For more dialog-like behavior, use a plain gtk.popover.Popover.
Menu models
The XML format understood by gtk.builder.Builder for gio.menu_model.MenuModel consists of a toplevel <menu> element, which contains one or more <item> elements. Each <item> element contains <attribute> and <link> elements with a mandatory name attribute. <link> elements have the same content model as <menu>. Instead of <link name="submenu"> or <link name="section">, you can use <submenu> or <section> elements.
Attribute values can be translated using gettext, like other gtk.builder.Builder content. <attribute> elements can be marked for translation with a translatable="yes" attribute. It is also possible to specify message context and translator comments, using the context and comments attributes. To make use of this, the gtk.builder.Builder must have been given the gettext domain to use.
The following attributes are used when constructing menu items:
The following attributes are used when constructing sections:
The following attributes are used when constructing submenus:
Menu items will also show accelerators, which are usually associated with actions via gtk.application.Application.setAccelsForAction, gtk.widget_class.WidgetClass.addBindingAction or gtk.shortcut_controller.ShortcutController.addShortcut.
CSS Nodes
gtk.popover_menu.PopoverMenu is just a subclass of gtk.popover.Popover that adds custom content to it, therefore it has the same CSS nodes. It is one of the cases that add a .menu style class to the main popover node.
Menu items have nodes with name button and class .model. If a section display-hint is set, the section gets a node box with class horizontal plus a class with the same text as the display hint. Note that said box may not be the direct ancestor of the item buttons. Thus, for example, to style items in an inline-buttons section, select .inline-buttons button.model. Other things that may be of interest to style in menus include label nodes.
Accessibility
gtk.popover_menu.PopoverMenu uses the gtk.types.AccessibleRole.Menu role, and its items use the gtk.types.AccessibleRole.MenuItem, gtk.types.AccessibleRole.MenuItemCheckbox or gtk.types.AccessibleRole.MenuItemRadio roles, depending on the action they are connected to.