Package: gtk

Class gtk-menu-button

Superclasses

Documented Subclasses

None

Direct Slots

align-widget
The align-widget property of type gtk-container (Read / Write)
The widget to use to align the menu with.
direction
The direction property of type gtk-arrow-type (Read / Write)
The arrow type representing the direction in which the menu or popover will be popped out.
Default value: :down
menu-model
The menu-model property of type g-menu-model (Read / Write)
The menu model from which the popup will be created. Depending on the use-popover property, that may be a menu or a popover. See the gtk-menu-button-menu-model function for the interaction with the popup property.
popover
The popover property of type gtk-popover (Read / Write)
The popover that will be popped up when the button is clicked.
popup
The popup property of type gtk-menu (Read / Write)
The menu that will be popped up when the button is clicked.
use-popover
The use-popover property of type :boolean (Read / Write)
Whether to construct a gtk-popover widget from the menu model, or a gtk-menu widget.
Default value: true

Details

The gtk-menu-button widget is used to display a popup when clicked on. This popup can be provided either as a gtk-menu widget, a gtk-popover widget or an abstract g-menu-model object.



The gtk-menu-button widget can hold any valid child widget. That is, it can hold almost any other standard gtk-widget object. The most commonly used child is the gtk-image widget. If no widget is explicitely added to the gtk-menu-button widget, a gtk-image widget is automatically created, using an arrow image oriented according to "direction" or the generic "open-menu-symbolic" icon if the direction is not set.

The positioning of the popup is determined by the direction property of the menu button.

For menus, the halign and valign properties of the menu are also taken into account. For example, when the direction is :down and the horizontal alignment is :start, the menu will be positioned below the button, with the starting edge, depending on the text direction, of the menu aligned with the starting edge of the button. If there is not enough space below the button, the menu is popped up above the button instead. If the alignment would move part of the menu offscreen, it is "pushed in".

CSS nodes

The gtk-menu-button implementation has a single CSS node with name button. To differentiate it from a plain gtk-button widget, it gets the .popup style class.
 

Slot Access Functions

Inherited Slot Access Functions

See also

2021-12-23