Class ColorChooserRequest

All Implemented Interfaces:
Proxy

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

A request to open a color chooser.

Whenever the user interacts with an HTML element, WebKit will need to show a dialog to choose a color. For that to happen in a general way, instead of just opening a GtkColorChooser (which might be not desirable in some cases, which could prefer to use their own color chooser dialog), WebKit will fire the WebKitWebView::run-color-chooser signal with a WebKitColorChooserRequest object, which will allow the client application to specify the color to be selected, to inspect the details of the request (e.g. to get initial color) and to cancel the request, in case nothing was selected.

In case the client application does not wish to handle this signal, WebKit will provide a default handler which will asynchronously run a regular GtkColorChooserDialog for the user to interact with.

  • Constructor Details

    • ColorChooserRequest

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

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

    • getType

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

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

      protected ColorChooserRequest 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
    • cancel

      public void cancel()

      Cancels this ColorChooserRequest and the input element changes to use the initial color.

      Cancels this ColorChooserRequest and the input element changes to use the initial color it has before the request started. The signal WebKitColorChooserRequest::finished is emitted to notify that the request has finished.

      Since:
      2.8
    • finish

      public void finish()

      Finishes this ColorChooserRequest and the input element keeps the current value of WebKitColorChooserRequest:rgba.

      Finishes this ColorChooserRequest and the input element keeps the current value of WebKitColorChooserRequest:rgba. The signal WebKitColorChooserRequest::finished is emitted to notify that the request has finished.

      Since:
      2.8
    • getElementRectangle

      public void getElementRectangle(Rectangle rect)
      Gets the bounding box of the color input element.
      Parameters:
      rect - a GdkRectangle to fill in with the element area
      Since:
      2.8
    • getRgba

      public void getRgba(RGBA rgba)
      Gets the current GdkRGBA color of this ColorChooserRequest
      Parameters:
      rgba - a GdkRGBA to fill in with the current color.
      Since:
      2.8
    • setRgba

      public void setRgba(RGBA rgba)
      Sets the current GdkRGBA color of this ColorChooserRequest
      Parameters:
      rgba - a pointer GdkRGBA
      Since:
      2.8
    • onFinished

      Emitted when the request finishes. This signal can be emitted because the user completed the request calling webkit_color_chooser_request_finish(), or cancelled it with webkit_color_chooser_request_cancel() or because the color input element is removed from the DOM.
      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      Since:
      2.8
      See Also:
    • emitFinished

      public void emitFinished()
      Emits the "finished" signal. See onFinished(ColorChooserRequest.FinishedCallback).
    • builder

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