GtkPopoverMenuBar

GtkPopoverMenuBar — A menu bar with popovers

Properties

GMenuModel * menu-model Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkPopoverMenuBar

Implemented Interfaces

GtkPopoverMenuBar implements GtkAccessible, GtkBuildable and GtkConstraintTarget.

Includes

#include <gtk/gtk.h>

Description

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.

CSS nodes

1
2
3
4
5
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.


Accessibility

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.

Functions

gtk_popover_menu_bar_new_from_model ()

GtkWidget *
gtk_popover_menu_bar_new_from_model (GMenuModel *model);

Creates a GtkPopoverMenuBar from a GMenuModel.

Parameters

model

a GMenuModel, or NULL.

[allow-none]

Returns

a new GtkPopoverMenuBar


gtk_popover_menu_bar_set_menu_model ()

void
gtk_popover_menu_bar_set_menu_model (GtkPopoverMenuBar *bar,
                                     GMenuModel *model);

Sets a menu model from which bar should take its contents.

Parameters

bar

a GtkPopoverMenuBar

 

model

a GMenuModel, or NULL.

[allow-none]

gtk_popover_menu_bar_get_menu_model ()

GMenuModel *
gtk_popover_menu_bar_get_menu_model (GtkPopoverMenuBar *bar);

Returns the model from which the contents of bar are taken.

Parameters

Returns

a GMenuModel.

[transfer none]


gtk_popover_menu_bar_add_child ()

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 .

Parameters

bar

a GtkPopoverMenuBar

 

child

the GtkWidget to add

 

id

the ID to insert child at

 

Returns

TRUE if id was found and the widget added


gtk_popover_menu_bar_remove_child ()

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().

Parameters

bar

a GtkPopoverMenuBar

 

child

the GtkWidget to remove

 

Returns

TRUE if the widget was removed

Types and Values

GtkPopoverMenuBar

typedef struct _GtkPopoverMenuBar GtkPopoverMenuBar;

Property Details

The “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

See Also

GtkPopover, GtkPopoverMenu, GMenuModel