Class ColorButton.Builder<B extends ColorButton.Builder<B>>

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

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

      public B setModal(boolean modal)
      Whether the color chooser dialog should be modal.
      Parameters:
      modal - the value for the modal property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setShowEditor

      public B setShowEditor(boolean showEditor)

      Whether the color chooser should open in editor mode.

      This property should be used in cases where the palette in the editor would be redundant, such as when the color button is already part of a palette.

      Parameters:
      showEditor - the value for the show-editor property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setTitle

      public B setTitle(String title)
      The title of the color chooser dialog
      Parameters:
      title - the value for the title property
      Returns:
      the Builder instance is returned, to allow method chaining
    • onActivate

      public B onActivate(ColorButton.ActivateCallback handler)

      Emitted to when the color button is activated.

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

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

      public B onColorSet(ColorButton.ColorSetCallback handler)

      Emitted when the user selects a color.

      When handling this signal, use ColorChooser.getRgba(RGBA) to find out which color was just selected.

      Note that this signal is only emitted when the user changes the color. If you need to react to programmatic color changes as well, use the notify::rgba signal.

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