Class ColorDialogButton

All Implemented Interfaces:
Accessible, Buildable, ConstraintTarget, Proxy

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

Opens a color chooser dialog to select a color.

An example GtkColorDialogButton

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

CSS nodes

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

GtkColorDialogButton 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.

Since:
4.10
  • Constructor Details

    • ColorDialogButton

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

      public ColorDialogButton(@Nullable ColorDialog dialog)

      Creates a new GtkColorDialogButton with the given GtkColorDialog.

      You can pass NULL to this function and set a GtkColorDialog later. The button will be insensitive until that happens.

      Parameters:
      dialog - the GtkColorDialog to use
      Since:
      4.10
    • ColorDialogButton

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

    • getType

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

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

      protected ColorDialogButton 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
    • getDialog

      public @Nullable ColorDialog getDialog()
      Returns the GtkColorDialog of self.
      Returns:
      the GtkColorDialog
      Since:
      4.10
    • getRgba

      public RGBA getRgba()

      Returns the color of the button.

      This function is what should be used to obtain the color that was chosen by the user. To get informed about changes, listen to "notify::rgba".

      Returns:
      the color
      Since:
      4.10
    • setDialog

      public void setDialog(ColorDialog dialog)
      Sets a GtkColorDialog object to use for creating the color chooser dialog that is presented when the user clicks the button.
      Parameters:
      dialog - the new GtkColorDialog
      Since:
      4.10
    • setRgba

      public void setRgba(RGBA color)
      Sets the color of the button.
      Parameters:
      color - the new color
      Since:
      4.10
    • onActivate

      Emitted when the color dialog button is activated.

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

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      Since:
      4.14
      See Also:
    • emitActivate

      public void emitActivate()
      Emits the "activate" signal. See onActivate(ColorDialogButton.ActivateCallback).
    • builder

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