Class ColorDialog

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class ColorDialog extends GObject

Asynchronous API to present a color chooser dialog.

GtkColorDialog collects the arguments that are needed to present the dialog to the user, such as a title for the dialog and whether it should be modal.

The dialog is shown with the chooseRgba(Window, RGBA, Cancellable, AsyncReadyCallback) function.

See ColorDialogButton for a convenient control that uses GtkColorDialog and presents the results.

Since:
4.10
  • Constructor Details

    • ColorDialog

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

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

    • getType

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

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

      protected ColorDialog 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 GObject
      Returns:
      the instance as if it were its parent type
    • chooseRgba

      public void chooseRgba(@Nullable Window parent, @Nullable RGBA initialColor, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback)
      Presents a color chooser dialog to the user.
      Parameters:
      parent - the parent window
      initialColor - the color to select initially
      cancellable - a cancellable to cancel the operation
      callback - a callback to call when the operation is complete
      Since:
      4.10
    • chooseRgbaFinish

      public RGBA chooseRgbaFinish(AsyncResult result) throws GErrorException

      Finishes the chooseRgba(Window, RGBA, Cancellable, AsyncReadyCallback) call

      Note that this function returns a Gtk.DialogError.DISMISSED error if the user cancels the dialog.

      Parameters:
      result - the result
      Returns:
      the selected color
      Throws:
      GErrorException - see GError
      Since:
      4.10
    • getModal

      public boolean getModal()
      Returns whether the color chooser dialog blocks interaction with the parent window while it is presented.
      Returns:
      true if the color chooser dialog is modal
      Since:
      4.10
    • getTitle

      public String getTitle()
      Returns the title that will be shown on the color chooser dialog.
      Returns:
      the title
      Since:
      4.10
    • getWithAlpha

      public boolean getWithAlpha()
      Returns whether colors may have alpha.
      Returns:
      true if colors may have alpha
      Since:
      4.10
    • setModal

      public void setModal(boolean modal)
      Sets whether the color chooser dialog blocks interaction with the parent window while it is presented.
      Parameters:
      modal - the new value
      Since:
      4.10
    • setTitle

      public void setTitle(String title)
      Sets the title that will be shown on the color chooser dialog.
      Parameters:
      title - the new title
      Since:
      4.10
    • setWithAlpha

      public void setWithAlpha(boolean withAlpha)
      Sets whether colors may have alpha.
      Parameters:
      withAlpha - the new value
      Since:
      4.10
    • builder

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