Class ScriptDialog

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class ScriptDialog extends ProxyInstance
Carries details to be shown in user-facing dialogs.
  • Constructor Details

    • ScriptDialog

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

    • getType

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

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

      public void close()

      Close dialog.

      When handling a WebKitScriptDialog asynchronously (webkit_script_dialog_ref() was called in WebKitWebView::script-dialog callback), this function needs to be called to notify that we are done with the script dialog. The dialog will be closed on destruction if this function hasn't been called before.

      Since:
      2.24
    • confirmSetConfirmed

      public void confirmSetConfirmed(boolean confirmed)

      Set whether the user confirmed the dialog.

      This method is used for ScriptDialogType.CONFIRM and ScriptDialogType.BEFORE_UNLOAD_CONFIRM dialogs when WebKitWebView::script-dialog signal is emitted to set whether the user confirmed the dialog or not. The default implementation of WebKitWebView::script-dialog signal sets true when the OK or Stay buttons are clicked and false otherwise. It's an error to use this method with a WebKitScriptDialog that is not of type ScriptDialogType.CONFIRM or ScriptDialogType.BEFORE_UNLOAD_CONFIRM

      Parameters:
      confirmed - whether user confirmed the dialog
    • getDialogType

      public ScriptDialogType getDialogType()
      Get the dialog type of a WebKitScriptDialog.
      Returns:
      the WebKitScriptDialogType of this ScriptDialog
    • getMessage

      public String getMessage()
      Get the message of a WebKitScriptDialog.
      Returns:
      the message of dialog.
    • promptGetDefaultText

      public String promptGetDefaultText()

      Get the default text of a WebKitScriptDialog of type ScriptDialogType.PROMPT.

      It's an error to use this method with a WebKitScriptDialog that is not of type ScriptDialogType.PROMPT.

      Returns:
      the default text of this ScriptDialog
    • promptSetText

      public void promptSetText(String text)

      Set the text entered by the user in the dialog.

      This method is used for ScriptDialogType.PROMPT dialogs when WebKitWebView::script-dialog signal is emitted to set the text entered by the user. The default implementation of WebKitWebView::script-dialog signal sets the text of the entry form when OK button is clicked, otherwise null is set. It's an error to use this method with a WebKitScriptDialog that is not of type ScriptDialogType.PROMPT.

      Parameters:
      text - the text to set
    • ref

      public ScriptDialog ref()

      Atomically increments the reference count of this ScriptDialog by one.

      This function is MT-safe and may be called from any thread.

      Returns:
      The passed in WebKitScriptDialog
      Since:
      2.24
    • unref

      public void unref()

      Atomically decrements the reference count of this ScriptDialog by one.

      If the reference count drops to 0, all memory allocated by the WebKitScriptdialog is released. This function is MT-safe and may be called from any thread.

      Since:
      2.24