PopoverMenu


Object Hierarchy:

Gtk.PopoverMenu Gtk.PopoverMenu Gtk.PopoverMenu Gtk.Popover Gtk.Popover Gtk.Popover->Gtk.PopoverMenu Gtk.Bin Gtk.Bin Gtk.Bin->Gtk.Popover 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.PopoverMenu Atk.Implementor->Gtk.Popover Atk.Implementor->Gtk.Bin Atk.Implementor->Gtk.Container Atk.Implementor->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.PopoverMenu Gtk.Buildable->Gtk.Popover Gtk.Buildable->Gtk.Bin Gtk.Buildable->Gtk.Container Gtk.Buildable->Gtk.Widget

Description:

[ CCode ( type_id = "gtk_popover_menu_get_type ()" ) ]
public class PopoverMenu : Popover, Implementor, Buildable

GtkPopoverMenu is a subclass of Popover that treats its children like menus and allows switching between them.

It is meant to be used primarily together with ModelButton, but any widget can be used, such as SpinButton or Scale. In this respect, GtkPopoverMenu is more flexible than popovers that are created from a MenuModel with Popover.from_model.

To add a child as a submenu, set the GtkPopoverMenu:submenu child property to the name of the submenu. To let the user open this submenu, add a ModelButton whose menu_name property is set to the name you've given to the submenu.

By convention, the first child of a submenu should be a ModelButton to switch back to the parent menu. Such a button should use the inverted and centered properties to achieve a title-like appearance and place the submenu indicator at the opposite side. To switch back to the main menu, use "main" as the menu name.

Example

<object class="GtkPopoverMenu">
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="margin">10</property>
<child>
<object class="GtkModelButton">
<property name="visible">True</property>
<property name="action-name">win.frob</property>
<property name="text" translatable="yes">Frob</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="visible">True</property>
<property name="menu-name">more</property>
<property name="text" translatable="yes">More</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="margin">10</property>
<child>
<object class="GtkModelButton">
<property name="visible">True</property>
<property name="action-name">win.foo</property>
<property name="text" translatable="yes">Foo</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="visible">True</property>
<property name="action-name">win.bar</property>
<property name="text" translatable="yes">Bar</property>
</object>
</child>
</object>
<packing>
<property name="submenu">more</property>
</packing>
</child>
</object>

Just like normal popovers created using gtk_popover_new_from_model, PopoverMenu instances have a single css node called "popover" and get the .menu 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 class GLib.Object
All known members inherited from interface Atk.Implementor



2022 vala-language.org