It derives from <GtkWidget>.
Displays a popup when clicked.
This popup can be provided either as a
<GtkPopover> or as an abstract
<GMenuModel>.
The <GtkMenuButton> widget can show either an
icon (set with the menu-button:icon-name property) or a label (set with the
menu-button:label property). If
neither is explicitly set, a <GtkImage> is
automatically created, using an arrow image oriented according to
menu-button:direction or the
generic “open-menu-symbolic” icon if the direction is not set.
The positioning of the popup is determined by the menu-button:direction property of the menu button.
For menus, the widget:halign and
widget: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”.
| | start | center | end | | - | — | — | — | | down |  |  |  | | up |  |  |  | | left |  |  |  | | right |  |  |  |
menubutton
╰── button.toggle
╰── <content>
╰── [arrow]
<GtkMenuButton> has a single CSS node with name
menubutton which contains a button node with a
.toggle style class.
If the button contains an icon, it will have the .image-button
style class, if it contains text, it will have .text-button style
class. If an arrow is visible in addition to an icon, text or a custom
child, it will also have .arrow-button style class.
Inside the toggle button content, there is an arrow node for the
indicator, which will carry one of the .none, .up,
.down, .left or .right style classes to indicate
the direction that the menu will appear in. The CSS is expected to
provide a suitable image for each of these cases using the
-gtk-icon-source property.
Optionally, the menubutton node can carry the .circular
style class to request a round appearance.
<GtkMenuButton> uses the
Gtk.AccessibleRole.button role.
Whether the menu button is active.
Its value is a boolean.
Set it with (set! (menu-button:active self) value).
Whether to show a dropdown arrow even when using an icon or a custom child.
Its value is a boolean.
Set it with (set! (menu-button:always-show-arrow self) value).
Whether the size of the button can be made smaller than the natural size of its contents.
Its value is a boolean.
Set it with (set! (menu-button:can-shrink self) value).
The child widget.
Its value is a <GtkWidget>, or #f.
Set it with (set! (menu-button:child self) value).
The <GtkArrowType> representing the direction in
which the menu or popover will be popped out.
Its value is a <GtkArrowType> (or, to set it,
one of its symbols).
Set it with (set! (menu-button:direction self) value).
Whether the button has a frame.
Its value is a boolean.
Set it with (set! (menu-button:has-frame self) value).
The name of the icon used to automatically populate the button.
Its value is a string, or #f.
Set it with (set! (menu-button:icon-name self) value).
The label for the button.
Its value is a string, or #f.
Set it with (set! (menu-button:label self) value).
The <GMenuModel> from which the popup will
be created.
See menu-button:set-menu-model
for the interaction with the menu-button:popover property.
Its value is a <GMenuModel>, or #f.
Set it with (set! (menu-button:menu-model self) value).
The <GtkPopover> that will be popped up when the
button is clicked.
Its value is a <GtkPopover>, or #f.
Set it with (set! (menu-button:popover self) value).
Whether the menu button acts as a primary menu.
Primary menus can be opened using the F10 key
Its value is a boolean.
Set it with (set! (menu-button:primary self) value).
If set an underscore in the text indicates a mnemonic.
Its value is a boolean.
Set it with (set! (menu-button:use-underline self) value).
Returns whether the menu button is active.
Passed: a <GtkMenuButton>.
Returned: a boolean.
TRUE if the button is active
Gets whether to show a dropdown arrow even when using an icon or a custom child.
Passed: a <GtkMenuButton>.
Returned: a boolean.
whether to show a dropdown arrow even when using an icon or a custom child.
Retrieves whether the button can be smaller than the natural size of its contents.
Passed: a <GtkMenuButton>.
a button
Returned: a boolean.
true if the button can shrink, and false otherwise
Gets the child widget of self.
Passed: a <GtkMenuButton>.
Returned: a <GtkWidget>, or #f.
the child widget of self
Returns the direction the popup will be pointing at when popped up.
Passed: a <GtkMenuButton>.
Returned: a <GtkArrowType>.
a <GtkArrowType> value
Returns whether the button has a frame.
Passed: a <GtkMenuButton>.
Returned: a boolean.
#t if the button has a frame
Gets the name of the icon shown in the button.
Passed: a <GtkMenuButton>.
Returned: a string, or #f.
the name of the icon shown in the button
Gets the label shown in the button
Passed: a <GtkMenuButton>.
Returned: a string, or #f.
the label shown in the button
Returns the <GMenuModel> used to generate
the popup.
Passed: a <GtkMenuButton>.
Returned: a <GMenuModel>, or #f.
Returns the <GtkPopover> that pops out of the
button.
If the button is not using a <GtkPopover>, this
function returns #f.
Passed: a <GtkMenuButton>.
Returned: a <GtkPopover>, or #f.
a <GtkPopover> or #f
Returns whether the menu button acts as a primary menu.
Passed: a <GtkMenuButton>.
Returned: a boolean.
#t if the button is a primary menu
Returns whether an embedded underline in the text indicates a mnemonic.
Passed: a <GtkMenuButton>.
Returned: a boolean.
#t whether an embedded underline in the text indicates the
mnemonic accelerator keys.
Creates a new <GtkMenuButton> widget with
downwards-pointing arrow as the only child.
You can replace the child widget with another
<GtkWidget> should you wish to.
Returned: a <GtkWidget>.
The newly created <GtkMenuButton>
Dismiss the menu.
Passed: a <GtkMenuButton>.
Pop up the menu.
Passed: a <GtkMenuButton>.
Sets whether the menu button is active.
Passed: a <GtkMenuButton>.
Passed: a boolean.
whether the menu button is active
Sets whether to show a dropdown arrow even when using an icon or a custom child.
Passed: a <GtkMenuButton>.
Passed: a boolean.
whether to show a dropdown arrow even when using an icon or a custom child
Sets whether the button size can be smaller than the natural size of its contents.
For text buttons, setting can-shrink to true will ellipsize the label.
For icon buttons, this function has no effect.
Passed: a <GtkMenuButton>.
a menu button
Passed: a boolean.
whether the button can shrink
Sets the child widget of self.
Setting a child resets menu-button:label and menu-button:icon-name.
If menu-button:always-show-arrow is set to TRUE
and menu-button:direction is
not none, a dropdown arrow will be shown next to
the child.
Passed: a <GtkMenuButton>.
Passed, or left out: a <GtkWidget>, or #f.
the child widget
Sets func to be called when a popup is about to be shown.
func should use one of
to set a popup for self. If func is non-#f,
self will always be sensitive.
Using this function will not reset the menu widget attached to self. Instead, this can be done manually in func.
Passed: a <GtkMenuButton>.
Passed, or left out: a procedure, or #f.
function to call when a popup is about to be shown, but none has been
provided via other means, or #f to reset to default behavior
See GtkMenuButtonCreatePopupFunc
for how it is called.
Not passed: guile-gi supplies it.
user data to pass to func
Not passed: guile-gi supplies it.
destroy notify for user-data
See GDestroyNotify for how it is
called.
Sets the direction in which the popup will be popped up.
If the button is automatically populated with an arrow icon, its direction will be changed to match.
If the does not fit in the available space in the given direction, GTK will its best to keep it inside the screen and fully visible.
If you pass none for a direction, the
popup will behave as if you passed down
(although you won’t see any arrows).
Passed: a <GtkMenuButton>.
Passed: a <GtkArrowType>, or one of its symbols.
Sets the style of the button.
Passed: a <GtkMenuButton>.
Passed: a boolean.
whether the button should have a visible frame
Sets the name of an icon to show inside the menu button.
Setting icon name resets menu-button:label and menu-button:child.
If menu-button:always-show-arrow is set to TRUE
and menu-button:direction is
not none, a dropdown arrow will be shown next to
the icon.
Passed: a <GtkMenuButton>.
Passed: a string.
the icon name
Sets the label to show inside the menu button.
Setting a label resets menu-button:icon-name and menu-button:child.
If menu-button:direction is
not none, a dropdown arrow will be shown next to
the label.
Passed: a <GtkMenuButton>.
Passed: a string.
the label
Sets the <GMenuModel> from which the popup
will be constructed.
If menu-model is #f, the button is disabled.
A <GtkPopover> will be created from the menu model
with popover-menu:new-from-model. Actions will be
connected as documented for this function.
If menu-button:popover is
already set, it will be dissociated from the self, and the
property is set to #f.
Passed: a <GtkMenuButton>.
Passed, or left out: a <GMenuModel>, or
#f.
a <GMenuModel>, or #f to unset and
disable the button
Sets the <GtkPopover> that will be popped up when
the self is clicked.
If popover is #f, the button is disabled.
If menu-button:menu-model
is set, the menu model is dissociated from the self, and the
property is set to #f.
Passed: a <GtkMenuButton>.
Passed, or left out: a <GtkPopover>, or #f.
a <GtkPopover>, or #f to unset and disable
the button
Sets whether menu button acts as a primary menu.
Primary menus can be opened with the F10 key.
Passed: a <GtkMenuButton>.
Passed: a boolean.
whether the menubutton should act as a primary menu
If true, an underline in the text indicates a mnemonic.
Passed: a <GtkMenuButton>.
Passed: a boolean.
#t if underlines in the text indicate mnemonics
Connect a handler with (connect object menu-button:activate
handler). It is called as (handler self).
Emitted to when the menu button is activated.
The ::activate signal on <GtkMenuButton>
is an action signal and emitting it causes the button to pop up its
menu.
Passed: a <GtkMenuButton>.