Class MenuButton.Builder<B extends MenuButton.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
Accessible.Builder<B>, BuilderInterface
Enclosing class:
MenuButton

public static class MenuButton.Builder<B extends MenuButton.Builder<B>> extends Widget.Builder<B> implements Accessible.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public MenuButton build()
      Finish building the MenuButton object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to MenuButton.
      Overrides:
      build in class Widget.Builder<B extends MenuButton.Builder<B>>
      Returns:
      a new instance of MenuButton with the properties that were set in the Builder object.
    • setActive

      public B setActive(boolean active)
      Whether the menu button is active.
      Parameters:
      active - the value for the active property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.10
    • setAlwaysShowArrow

      public B setAlwaysShowArrow(boolean alwaysShowArrow)
      Whether to show a dropdown arrow even when using an icon or a custom child.
      Parameters:
      alwaysShowArrow - the value for the always-show-arrow property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.4
    • setCanShrink

      public B setCanShrink(boolean canShrink)
      Whether the size of the button can be made smaller than the natural size of its contents.
      Parameters:
      canShrink - the value for the can-shrink property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.12
    • setChild

      public B setChild(Widget child)
      The child widget.
      Parameters:
      child - the value for the child property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.6
    • setDirection

      public B setDirection(ArrowType direction)
      The GtkArrowType representing the direction in which the menu or popover will be popped out.
      Parameters:
      direction - the value for the direction property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setHasFrame

      public B setHasFrame(boolean hasFrame)
      Whether the button has a frame.
      Parameters:
      hasFrame - the value for the has-frame property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setIconName

      public B setIconName(String iconName)
      The name of the icon used to automatically populate the button.
      Parameters:
      iconName - the value for the icon-name property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setLabel

      public B setLabel(String label)
      The label for the button.
      Parameters:
      label - the value for the label property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setMenuModel

      public B setMenuModel(MenuModel menuModel)

      The GMenuModel from which the popup will be created.

      See MenuButton.setMenuModel(MenuModel) for the interaction with the Gtk.MenuButton:popover property.

      Parameters:
      menuModel - the value for the menu-model property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setPopover

      public B setPopover(Popover popover)
      The GtkPopover that will be popped up when the button is clicked.
      Parameters:
      popover - the value for the popover property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setPrimary

      public B setPrimary(boolean primary)

      Whether the menu button acts as a primary menu.

      Primary menus can be opened using the F10 key

      Parameters:
      primary - the value for the primary property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.4
    • setUseUnderline

      public B setUseUnderline(boolean useUnderline)
      If set an underscore in the text indicates a mnemonic.
      Parameters:
      useUnderline - the value for the use-underline property
      Returns:
      the Builder instance is returned, to allow method chaining
    • onActivate

      public B onActivate(MenuButton.ActivateCallback handler)

      Emitted to when the menu button is activated.

      The ::activate signal on GtkMenuButton is an action signal and emitting it causes the button to pop up its menu.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.4
      See Also: