Gtk.PopoverMenuBar

g GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.PopoverMenuBar Gtk.PopoverMenuBar Gtk.Widget->Gtk.PopoverMenuBar

Subclasses:

None

Methods

Inherited:

Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new_from_model (model)

add_child (child, id)

get_menu_model ()

remove_child (child)

set_menu_model (model)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)

Properties

Inherited:

Gtk.Widget (34), Gtk.Accessible (1)

Name

Type

Flags

Short Description

menu-model

Gio.MenuModel

r/w

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1)

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1)

Class Details

class Gtk.PopoverMenuBar(**kwargs)
Bases:

Gtk.Widget

Abstract:

No

GtkPopoverMenuBar presents a horizontal bar of items that pop up popover menus when clicked.

An example Gtk.PopoverMenuBar

The only way to create instances of GtkPopoverMenuBar is from a GMenuModel.

CSS nodes

`` menubar ├── item[.active] ┊ ╰── popover ╰── item

╰── popover

``

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 Gtk.AccessibleRole.MENU_BAR role, the menu items use the Gtk.AccessibleRole.MENU_ITEM role and the menus use the Gtk.AccessibleRole.MENU role.

classmethod new_from_model(model)[source]
Parameters:

model (Gio.MenuModel or None) – a GMenuModel

Returns:

a new GtkPopoverMenuBar

Return type:

Gtk.Widget

Creates a GtkPopoverMenuBar from a GMenuModel.

add_child(child, id)[source]
Parameters:
  • child (Gtk.Widget) – the GtkWidget to add

  • id (str) – the ID to insert child at

Returns:

True if id was found and the widget added

Return type:

bool

Adds a custom widget to a generated menubar.

For this to work, the menu model of self must have an item with a custom attribute that matches id.

get_menu_model()[source]
Returns:

a GMenuModel

Return type:

Gio.MenuModel or None

Returns the model from which the contents of self are taken.

remove_child(child)[source]
Parameters:

child (Gtk.Widget) – the GtkWidget to remove

Returns:

True if the widget was removed

Return type:

bool

Removes a widget that has previously been added with Gtk.PopoverMenuBar.add_child().

set_menu_model(model)[source]
Parameters:

model (Gio.MenuModel or None) – a GMenuModel

Sets a menu model from which self should take its contents.

Property Details

Gtk.PopoverMenuBar.props.menu_model
Name:

menu-model

Type:

Gio.MenuModel

Default Value:

None

Flags:

READABLE, WRITABLE

The GMenuModel from which the menu bar is created.

The model should only contain submenus as toplevel elements.