Class ColorButton

All Implemented Interfaces:
PointerInterface

public class ColorButton extends Widget
The `GtkColorButton` allows to open a color chooser dialog to change
the color.

![An example GtkColorButton](color-button.png)

It is suitable widget for selecting a color in a preference dialog.

# CSS nodes

```
colorbutton
╰── button.color
╰── [content]
```

`GtkColorButton` has a single CSS node with name colorbutton which
contains a button node. To differentiate it from a plain `GtkButton`,
it gets the .color style class.

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

  • Field Details

  • Constructor Details

    • ColorButton

      public ColorButton(PointerContainer pointer)
    • ColorButton

      public ColorButton()
      Creates a new color button.

      This returns a widget in the form of a small button containing
      a swatch representing the current selected color. When the button
      is clicked, a color chooser dialog will open, allowing the user
      to select a color. The swatch will be updated to reflect the new
      color when the user finishes.
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • newWithRgbaColorButton

      public static ColorButton newWithRgbaColorButton(@Nonnull RGBA rgba)
      Creates a new color button showing the given color.
      Parameters:
      rgba - A `GdkRGBA` to set the current color with
      Returns:
      a new color button
    • getModal

      public boolean getModal()
      Gets whether the dialog is modal.
      Returns:
      %TRUE if the dialog is modal
    • getTitle

      public Str getTitle()
      Gets the title of the color chooser dialog.
      Returns:
      An internal string, do not free the return value
    • setModal

      public void setModal(boolean modal)
      Sets whether the dialog should be modal.
      Parameters:
      modal - %TRUE to make the dialog modal
    • setTitle

      public void setTitle(@Nonnull Str title)
      Sets the title for the color chooser dialog.
      Parameters:
      title - String containing new window title
    • setTitle

      public void setTitle(String title)
      Sets the title for the color chooser dialog.
      Parameters:
      title - String containing new window title
    • onActivate

      public SignalHandler onActivate(ColorButton.OnActivate signal)
      Connect to signal "activate".
      See ColorButton.OnActivate.onActivate() for signal description.
      Field SIGNAL_ON_ACTIVATE contains original signal name and can be used as resource reference.
      Parameters:
      signal - callback function (lambda).
      Returns:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • onColorSet

      public SignalHandler onColorSet(ColorButton.OnColorSet signal)
      Connect to signal "color-set".
      See ColorButton.OnColorSet.onColorSet() for signal description.
      Field SIGNAL_ON_COLOR_SET contains original signal name and can be used as resource reference.
      Parameters:
      signal - callback function (lambda).
      Returns:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • 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
    • asColorChooser

      public ColorChooser asColorChooser()
      Implements interface ColorChooser. Call this to get access to interface functions.
      Returns:
      ColorChooser
    • 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()