GtkPopoverMenu

GtkPopoverMenu — Popovers to use as menus

Functions

Properties

GMenuModel * menu-model Read / Write
gchar * visible-submenu Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkContainer
                ╰── GtkBin
                    ╰── GtkPopover
                        ╰── GtkPopoverMenu

Implemented Interfaces

GtkPopoverMenu implements AtkImplementorIface, GtkBuildable, GtkConstraintTarget, GtkShortcutManager and GtkNative.

Includes

#include <gtk/gtk.h>

Description

GtkPopoverMenu is a subclass of GtkPopover that treats its children like menus and allows switching between them. It can open submenus as traditional, nested submenus, or in a more touch-friendly sliding fashion.

GtkPopoverMenu is meant to be used primarily with menu models, using gtk_popover_menu_new_from_model(). If you need to put other widgets such as GtkSpinButton or GtkSwitch into a popover, use a GtkPopover.

In addition to all the regular menu model features, this function supports rendering sections in the model in a more compact form, as a row of image buttons instead of menu items.

To use this rendering, set the ”display-hint” attribute of the section to ”horizontal-buttons” and set the icons of your items with the ”verb-icon” attribute.

CSS Nodes

GtkPopoverMenu is just a subclass of GtkPopover that adds custom content to it, therefore it has the same CSS nodes. It is one of the cases that add a .menu style class to the popover's main node.

Functions

gtk_popover_menu_new_from_model ()

GtkWidget *
gtk_popover_menu_new_from_model (GMenuModel *model);

Creates a GtkPopoverMenu and populates it according to model .

The created buttons are connected to actions found in the GtkApplicationWindow to which the popover belongs - typically by means of being attached to a widget that is contained within the GtkApplicationWindows widget hierarchy.

Actions can also be added using gtk_widget_insert_action_group() on the menus attach widget or on any of its parent widgets.

This function creates menus with sliding submenus. See gtk_popover_menu_new_from_model_full() for a way to control this.

Parameters

model

a GMenuModel, or NULL.

[allow-none]

Returns

the new GtkPopoverMenu


gtk_popover_menu_set_menu_model ()

void
gtk_popover_menu_set_menu_model (GtkPopoverMenu *popover,
                                 GMenuModel *model);

gtk_popover_menu_get_menu_model ()

GMenuModel *
gtk_popover_menu_get_menu_model (GtkPopoverMenu *popover);

Returns the menu model used to populate the popover.

Parameters

popover

a GtkPopoverMenu

 

Returns

the menu model of popover .

[transfer none]

Types and Values

GtkPopoverMenu

typedef struct _GtkPopoverMenu GtkPopoverMenu;

Property Details

The “menu-model” property

  “menu-model”               GMenuModel *

The model from which the menu is made.

Owner: GtkPopoverMenu

Flags: Read / Write


The “visible-submenu” property

  “visible-submenu”          gchar *

The name of the visible submenu.

Owner: GtkPopoverMenu

Flags: Read / Write

Default value: NULL