Class PopoverMenuBar

All Implemented Interfaces:
PointerInterface

public class PopoverMenuBar extends Widget
`GtkPopoverMenuBar` presents a horizontal bar of items that pop
up popover menus when clicked.

![An example GtkPopoverMenuBar](menubar.png)

The only way to create instances of `GtkPopoverMenuBar` is
from a `GMenuModel`.

# CSS nodes

```
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.

https://docs.gtk.org/gtk4/class.PopoverMenuBar.html

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • newFromModelPopoverMenuBar

      public static PopoverMenuBar newFromModelPopoverMenuBar(@Nullable MenuModel model)
      Creates a `GtkPopoverMenuBar` from a `GMenuModel`.
      Parameters:
      model - a `GMenuModel`
      Returns:
      a new `GtkPopoverMenuBar`
    • addChild

      public boolean addChild(@Nonnull Widget child, @Nonnull Str 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:
      child - the `GtkWidget` to add
      id - the ID to insert @child at
      Returns:
      %TRUE if @id was found and the widget added
    • addChild

      public boolean addChild(@Nonnull Widget child, String 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:
      child - the `GtkWidget` to add
      id - the ID to insert @child at
      Returns:
      %TRUE if @id was found and the widget added
    • getMenuModel

      public MenuModel getMenuModel()
      Returns the model from which the contents of @bar are taken.
      Returns:
      a `GMenuModel`
    • removeChild

      public boolean removeChild(@Nonnull Widget child)
      Removes a widget that has previously been added with
      gtk_popover_menu_bar_add_child().
      Parameters:
      child - the `GtkWidget` to remove
      Returns:
      %TRUE if the widget was removed
    • setMenuModel

      public void setMenuModel(@Nullable MenuModel model)
      Sets a menu model from which @bar should take
      its contents.
      Parameters:
      model - a `GMenuModel`
    • asAccessible

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Overrides:
      asAccessible in class Widget
      Returns:
      Accessible
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Overrides:
      asBuildable in class Widget
      Returns:
      Buildable
    • asConstraintTarget

      public ConstraintTarget asConstraintTarget()
      Implements interface ConstraintTarget. Call this to get access to interface functions.
      Overrides:
      asConstraintTarget in class Widget
      Returns:
      ConstraintTarget
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()