Package org.webkitgtk
Interface WebView.ScriptDialogCallback
- All Superinterfaces:
FunctionPointer
- Enclosing class:
WebView
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface declaration of the
ScriptDialogCallback callback.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanrun(@Nullable ScriptDialog dialog) Emitted when JavaScript code calls <function>window.alert</function>, <function>window.confirm</function> or <function>window.prompt</function>, or when <function>onbeforeunload</function> event is fired.default MemorySegmenttoCallback(Arena arena) Creates a native function pointer to theupcall(java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment)method.default intupcall(MemorySegment sourceWebView, MemorySegment dialog) Theupcallmethod is called from native code.
-
Method Details
-
run
Emitted when JavaScript code calls <function>window.alert</function>, <function>window.confirm</function> or <function>window.prompt</function>, or when <function>onbeforeunload</function> event is fired. Thedialogparameter should be used to build the dialog. If the signal is not handled a different dialog will be built and shown depending on the dialog type: <itemizedlist> <listitem><para>ScriptDialogType.ALERT: message dialog with a single Close button. </para></listitem> <listitem><para>ScriptDialogType.CONFIRM: message dialog with OK and Cancel buttons. </para></listitem> <listitem><para>ScriptDialogType.PROMPT: message dialog with OK and Cancel buttons and a text entry with the default text. </para></listitem> <listitem><para>ScriptDialogType.BEFORE_UNLOAD_CONFIRM: message dialog with Stay and Leave buttons. </para></listitem> </itemizedlist>It is possible to handle the script dialog request asynchronously, by simply caling webkit_script_dialog_ref() on the
dialogargument and calling webkit_script_dialog_close() when done. If the last reference is removed on aWebKitScriptDialogand the dialog has not been closed, webkit_script_dialog_close() will be called. -
upcall
Theupcallmethod is called from native code. The parameters are marshaled andrun(org.webkitgtk.ScriptDialog)is executed. -
toCallback
Creates a native function pointer to theupcall(java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment)method.- Specified by:
toCallbackin interfaceFunctionPointer- Parameters:
arena- the arena in which the function pointer is allocated- Returns:
- the native function pointer
-