GtkPopoverMenu
GtkPopoverMenu — Popovers to use as menus
|
|
Implemented Interfaces
GtkPopoverMenu implements
AtkImplementorIface and GtkBuildable.
Includes
#include <gtk/gtk.h>
Description
GtkPopoverMenu is a subclass of GtkPopover that treats its
children like menus and allows switching between them. It is
meant to be used primarily together with GtkModelButton, but
any widget can be used, such as GtkSpinButton or GtkScale.
In this respect, GtkPopoverMenu is more flexible than popovers
that are created from a GMenuModel with gtk_popover_new_from_model().
To add a child as a submenu, set the “submenu”
child property to the name of the submenu. To let the user open
this submenu, add a GtkModelButton 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 GtkModelButton
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
Just like normal popovers created using gtk_popover_new_from_model,
GtkPopoverMenu instances have a single css node called "popover"
and get the .menu style class.
Functions
gtk_popover_menu_new ()
GtkWidget *
gtk_popover_menu_new (void);
Creates a new popover menu.
Since: 3.16
gtk_popover_menu_open_submenu ()
void
gtk_popover_menu_open_submenu (GtkPopoverMenu *popover,
const gchar *name);
Opens a submenu of the popover
. The name
must be one of the names given to the submenus
of popover
with “submenu”, or
"main" to switch back to the main menu.
GtkModelButton will open submenus automatically
when the “menu-name” property is set,
so this function is only needed when you are using
other kinds of widgets to initiate menu changes.
Since: 3.16
Types and Values
GtkPopoverMenu
typedef struct _GtkPopoverMenu GtkPopoverMenu;
Property Details
The “visible-submenu” property
“visible-submenu” gchar *
The name of the visible submenu.
Owner: GtkPopoverMenu
Flags: Read / Write
Default value: NULL
Child Property Details
The “position” child property
“position” gint
The index of the child in the parent.
Owner: GtkPopoverMenu
Flags: Read / Write
Allowed values: >= -1
Default value: 0
The “submenu” child property
“submenu” gchar *
The submenu child property specifies the name of the submenu
If it is NULL or "main", the child is used as the main menu,
which is shown initially when the popover is mapped.
Owner: GtkPopoverMenu
Flags: Read / Write
Default value: NULL
Since: 3.16