Class PopoverMenuBar

All Implemented Interfaces:
Accessible, Buildable, ConstraintTarget, Proxy

@Generated("org.javagi.JavaGI") public class PopoverMenuBar extends Widget implements Accessible, Buildable, ConstraintTarget

Presents a horizontal bar of items that pop up menus when clicked.

An example GtkPopoverMenuBar

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.AccessibleRole.menu_bar role, the menu items use the Gtk.AccessibleRole.menu_item role and the menus use the Gtk.AccessibleRole.menu role.

  • Constructor Details

    • PopoverMenuBar

      public PopoverMenuBar(MemorySegment address)
      Create a PopoverMenuBar instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • PopoverMenuBar

      public PopoverMenuBar()
      Create a new PopoverMenuBar.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the PopoverMenuBar class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected PopoverMenuBar asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Widget
      Returns:
      the instance as if it were its parent type
    • fromModel

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

      public boolean addChild(Widget child, String id)

      Adds a custom widget to a generated menubar.

      For this to work, the menu model of this PopoverMenuBar 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 @Nullable MenuModel getMenuModel()
      Returns the model from which the contents of this PopoverMenuBar are taken.
      Returns:
      a GMenuModel
    • removeChild

      public boolean removeChild(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 this PopoverMenuBar should take its contents.
      Parameters:
      model - a GMenuModel
    • builder

      public static PopoverMenuBar.Builder<? extends PopoverMenuBar.Builder> builder()
      A PopoverMenuBar.Builder object constructs a PopoverMenuBar with the specified properties. Use the various set...() methods to set properties, and finish construction with PopoverMenuBar.Builder.build().
      Returns:
      the builder object