Class SplitButton.Builder<B extends SplitButton.Builder<B>>

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

public static class SplitButton.Builder<B extends SplitButton.Builder<B>> extends Widget.Builder<B> implements Accessible.Builder<B>, Actionable.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 SplitButton build()
      Finish building the SplitButton object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to SplitButton.
      Overrides:
      build in class Widget.Builder<B extends SplitButton.Builder<B>>
      Returns:
      a new instance of SplitButton with the properties that were set in the Builder object.
    • setCanShrink

      public B setCanShrink(boolean canShrink)

      Whether the button can be smaller than the natural size of its contents.

      If set to TRUE, the label will ellipsize.

      See Gtk.Button:can-shrink and Gtk.MenuButton:can-shrink.

      Parameters:
      canShrink - the value for the can-shrink property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.4
    • setChild

      public B setChild(Widget child)

      The child widget.

      Setting the child widget will set SplitButton:label and SplitButton:icon-name to NULL.

      Parameters:
      child - the value for the child property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setDirection

      public B setDirection(ArrowType direction)

      The direction in which the popup will be popped up.

      The dropdown arrow icon will point at the same direction.

      If the does not fit in the available space in the given direction, GTK will try its best to keep it inside the screen and fully visible.

      Gtk.ArrowType.none behaves same as Gtk.ArrowType.down.

      Parameters:
      direction - the value for the direction property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setDropdownTooltip

      public B setDropdownTooltip(String dropdownTooltip)

      The tooltip of the dropdown button.

      The tooltip can be marked up with the Pango text markup language.

      Parameters:
      dropdownTooltip - the value for the dropdown-tooltip property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      1.2
    • setIconName

      public B setIconName(String iconName)

      The name of the icon used to automatically populate the button.

      Setting the icon name will set SplitButton:label and SplitButton:child to NULL.

      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.

      Setting the label will set SplitButton:icon-name and SplitButton:child to NULL.

      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.

      If the menu model is NULL, the dropdown is disabled.

      A Popover will be created from the menu model with PopoverMenu#fromModel. Actions will be connected as documented for this function.

      If SplitButton:popover is already set, it will be dissociated from the button, and the property is set to NULL.

      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 dropdown is clicked.

      If the popover is NULL, the dropdown is disabled.

      If SplitButton:menu-model is set, the menu model is dissociated from the button, and the property is set to NULL.

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

      public B setUseUnderline(boolean useUnderline)

      Whether an underline in the text indicates a mnemonic.

      See SplitButton:label.

      Parameters:
      useUnderline - the value for the use-underline property
      Returns:
      the Builder instance is returned, to allow method chaining
    • onActivate

      public B onActivate(SplitButton.ActivateCallback handler)

      Emitted to animate press then release.

      This is an action signal. Applications should never connect to this signal, but use the SplitButton::clicked signal.

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

      public B onClicked(SplitButton.ClickedCallback handler)
      Emitted when the button has been activated (pressed and released).
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also: