Gtk.PopoverMenuBar¶
class — extends Widget, Accessible, Buildable, ConstraintTarget
Presents a horizontal bar of items that pop up menus when clicked.
<picture> <source srcset="menubar-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkPopoverMenuBar" src="menubar.png"> </picture>
The only way to create instances of GtkPopoverMenuBar is
from a GMenuModel.
CSS nodes¶
GtkPopoverMenuBar has a single CSS node with name menubar, below which
each item has its CSS node, and below that the corresponding popover.
The item whose popover is currently open gets the .active style class.
Accessibility¶
GtkPopoverMenuBar uses the AccessibleRole.menu_bar role,
the menu items use the AccessibleRole.menu_item role and
the menus use the AccessibleRole.menu role.
Constructors¶
new_from_model¶
Creates a GtkPopoverMenuBar from a GMenuModel.
Parameters:
model— aGMenuModel
Methods¶
add_child¶
Adds a custom widget to a generated menubar.
For this to work, the menu model of bar must have an
item with a custom attribute that matches id.
Parameters:
child— theGtkWidgetto addid— the ID to insertchildat
get_menu_model¶
Returns the model from which the contents of bar are taken.
remove_child¶
Removes a widget that has previously been added with
PopoverMenuBar.add_child.
Parameters:
child— theGtkWidgetto remove
set_menu_model¶
Sets a menu model from which bar should take
its contents.
Parameters:
model— aGMenuModel
Properties¶
menu_model¶
The GMenuModel from which the menu bar is created.
The model should only contain submenus as toplevel elements.