MenuButton


Object Hierarchy:

Gtk.MenuButton Gtk.MenuButton Gtk.MenuButton Gtk.ToggleButton Gtk.ToggleButton Gtk.ToggleButton->Gtk.MenuButton Gtk.Button Gtk.Button Gtk.Button->Gtk.ToggleButton Gtk.Bin Gtk.Bin Gtk.Bin->Gtk.Button Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.Widget Gtk.Widget Gtk.Widget->Gtk.Container GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Atk.Implementor Atk.Implementor Atk.Implementor->Gtk.MenuButton Atk.Implementor->Gtk.ToggleButton Atk.Implementor->Gtk.Button Atk.Implementor->Gtk.Bin Atk.Implementor->Gtk.Container Atk.Implementor->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.MenuButton Gtk.Buildable->Gtk.ToggleButton Gtk.Buildable->Gtk.Button Gtk.Buildable->Gtk.Bin Gtk.Buildable->Gtk.Container Gtk.Buildable->Gtk.Widget Gtk.Actionable Gtk.Actionable Gtk.Actionable->Gtk.MenuButton Gtk.Actionable->Gtk.ToggleButton Gtk.Actionable->Gtk.Button Gtk.Activatable Gtk.Activatable Gtk.Activatable->Gtk.MenuButton Gtk.Activatable->Gtk.ToggleButton Gtk.Activatable->Gtk.Button

Description:

[ CCode ( type_id = "gtk_menu_button_get_type ()" ) ]
public class MenuButton : ToggleButton, Implementor, Actionable, Activatable, Buildable

The MenuButton widget is used to display a popup when clicked on.

This popup can be provided either as a Menu, a Popover or an abstract MenuModel.

The MenuButton widget can hold any valid child widget. That is, it can hold almost any other standard Widget. The most commonly used child is Image. If no widget is explicitely added to the MenuButton, a Image 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 gtk_arrow_down and the horizontal alignment is gtk_align_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”.

Direction = Down

  • halign = start

    ![](down-start.png)

  • halign = center

    ![](down-center.png)

  • halign = end

    ![](down-end.png)

Direction = Up

  • halign = start

    ![](up-start.png)

  • halign = center

    ![](up-center.png)

  • halign = end

    ![](up-end.png)

Direction = Left

  • valign = start

    ![](left-start.png)

  • valign = center

    ![](left-center.png)

  • valign = end

    ![](left-end.png)

Direction = Right

  • valign = start

    ![](right-start.png)

  • valign = center

    ![](right-center.png)

  • valign = end

    ![](right-end.png)

CSS nodes

GtkMenuButton has a single CSS node with name button. To differentiate it from a plain Button , it gets the .popup style class.


Namespace: Gtk
Package: gtk+-3.0

Content:

Properties:

Creation methods:

Methods:

Inherited Members:

All known members inherited from class Gtk.Bin
All known members inherited from class Gtk.Widget
All known members inherited from interface Atk.Implementor