GtkPopoverMenuBar — A menu bar with popovers
GtkWidget * | gtk_popover_menu_bar_new_from_model () |
void | gtk_popover_menu_bar_set_menu_model () |
GMenuModel * | gtk_popover_menu_bar_get_menu_model () |
gboolean | gtk_popover_menu_bar_add_child () |
gboolean | gtk_popover_menu_bar_remove_child () |
GMenuModel * | menu-model | Read / Write |
GObject ╰── GInitiallyUnowned ╰── GtkWidget ╰── GtkPopoverMenuBar
GtkPopoverMenuBar implements GtkAccessible, GtkBuildable and GtkConstraintTarget.
#include <gtk/gtk.h>
GtkPopoverMenuBar presents a horizontal bar of items that pop up popover menus when clicked.
The only way to create instances of GtkPopoverMenuBar is from a GMenuModel.
menubar ├── item[.active] ┊ ╰── popover ╰── item ╰── popover
GtkPopoverMenuBar has a single CSS node with name menubar, below which each item has its CSS node, and below that the corresponding popover.
The item whose popover is currently open gets the .active style class.
GtkPopoverMenuBar uses the GTK_ACCESSIBLE_ROLE_MENU_BAR role, the menu items use the GTK_ACCESSIBLE_ROLE_MENU_ITEM role and the menus use the GTK_ACCESSIBLE_ROLE_MENU role.
GtkWidget *
gtk_popover_menu_bar_new_from_model (GMenuModel *model
);
Creates a GtkPopoverMenuBar from a GMenuModel.
model | a GMenuModel, or | [allow-none] |
a new GtkPopoverMenuBar
void gtk_popover_menu_bar_set_menu_model (GtkPopoverMenuBar *bar
,GMenuModel *model
);
Sets a menu model from which bar
should take its contents.
bar | ||
model | a GMenuModel, or | [allow-none] |
GMenuModel *
gtk_popover_menu_bar_get_menu_model (GtkPopoverMenuBar *bar
);
Returns the model from which the contents of bar
are taken.
bar |
a GMenuModel.
[transfer none]
gboolean gtk_popover_menu_bar_add_child (GtkPopoverMenuBar *bar
,GtkWidget *child
,const char *id
);
Adds a custom widget to a generated menubar.
For this to work, the menu model of bar
must have an item with a custom
attribute that matches id
.
bar | ||
child | the GtkWidget to add | |
id | the ID to insert |
TRUE
if id
was found and the widget added
gboolean gtk_popover_menu_bar_remove_child (GtkPopoverMenuBar *bar
,GtkWidget *child
);
Removes a widget that has previously been added with gtk_popover_menu_bar_add_child()
.
bar | ||
child | the GtkWidget to remove |
TRUE
if the widget was removed
typedef struct _GtkPopoverMenuBar GtkPopoverMenuBar;
“menu-model”
property“menu-model” GMenuModel *
The GMenuModel from which the menu bar is created.
The model should only contain submenus as toplevel elements.
Owner: GtkPopoverMenuBar
Flags: Read / Write
GtkPopover, GtkPopoverMenu, GMenuModel
© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk4/4.0/GtkPopoverMenuBar.html