1.151 <GtkPopoverMenuBar>

Class: <GtkPopoverMenuBar>

It derives from <GtkWidget>.

Presents a horizontal bar of items that pop up menus when clicked.

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.

Properties

Property: popover-menu-bar:menu-model self

The <GMenuModel> from which the menu bar is created.

The model should only contain submenus as toplevel elements.

Its value is a <GMenuModel>, or #f.

Set it with (set! (popover-menu-bar:menu-model self) value).

Procedures

Method: popover-menu-bar:add-child? self child id ⇒ %return
Method: add-child? self child id ⇒ %return

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.

self

Passed: a <GtkPopoverMenuBar>.

a <GtkPopoverMenuBar>

child

Passed: a <GtkWidget>.

the <GtkWidget> to add

id

Passed: a string.

the ID to insert child at

%return

Returned: a boolean.

#t if id was found and the widget added

Method: popover-menu-bar:get-menu-model self ⇒ %return
Method: get-menu-model self ⇒ %return

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

self

Passed: a <GtkPopoverMenuBar>.

a <GtkPopoverMenuBar>

%return

Returned: a <GMenuModel>, or #f.

a <GMenuModel>

Procedure: popover-menu-bar:new-from-model [model] ⇒ %return

Creates a <GtkPopoverMenuBar> from a <GMenuModel>.

model

Passed, or left out: a <GMenuModel>, or #f.

a <GMenuModel>

%return

Returned: a <GtkWidget>.

a new <GtkPopoverMenuBar>

Method: popover-menu-bar:remove-child? self child ⇒ %return
Method: remove-child? self child ⇒ %return

Removes a widget that has previously been added with popover-menu-bar:add-child?.

self

Passed: a <GtkPopoverMenuBar>.

a <GtkPopoverMenuBar>

child

Passed: a <GtkWidget>.

the <GtkWidget> to remove

%return

Returned: a boolean.

#t if the widget was removed

Method: popover-menu-bar:set-menu-model self [model]
Method: set-menu-model self [model]

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

self

Passed: a <GtkPopoverMenuBar>.

a <GtkPopoverMenuBar>

model

Passed, or left out: a <GMenuModel>, or #f.

a <GMenuModel>