WebView.connectContextMenu
gulong connectContextMenu(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == bool)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : webkit.context_menu.ContextMenu)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : webkit.hit_test_result.HitTestResult)))
&& (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : webkit.web_view.WebView)))
&& Parameters!T.length < 4)Connect to ContextMenu signal.
Emitted when a context menu is about to be displayed to give the application a chance to customize the proposed menu, prevent the menu from being displayed, or build its own context menu.
<itemizedlist> <listitem><para>To customize the proposed menu you can use [webkitwebprocessextension.context_menu.ContextMenu.prepend], [webkitwebprocessextension.context_menu.ContextMenu.append] or [webkitwebprocessextension.context_menu.ContextMenu.insert] to add new #WebKitContextMenuItem<!-- -->s to context_menu, [webkitwebprocessextension.context_menu.ContextMenu.moveItem] to reorder existing items, or [webkitwebprocessextension.context_menu.ContextMenu.remove] to remove an existing item. The signal handler should return false, and the menu represented by context_menu will be shown.
</para></listitem> <listitem><para>To prevent the menu from being displayed you can just connect to this signal and return true so that the proposed menu will not be shown.
</para></listitem> <listitem><para>To build your own menu, you can remove all items from the proposed menu with [webkitwebprocessextension.context_menu.ContextMenu.removeAll], add your own items and return false so that the menu will be shown. You can also ignore the proposed #WebKitContextMenu, build your own #GtkMenu and return true to prevent the proposed menu from being shown.
</para></listitem> <listitem><para>If you just want the default menu to be shown always, simply don't connect to this signal because showing the proposed context menu is the default behaviour.
</para></listitem> </itemizedlist>If the signal handler returns false the context menu represented by context_menu will be shown, if it return true the context menu will not be shown.
The proposed #WebKitContextMenu passed in context_menu argument is only valid during the signal emission.
Parameters
callback | signal callback delegate or function to connect bool callback(webkit.context_menu.ContextMenu contextMenu, webkit.hit_test_result.HitTestResult hitTestResult, webkit.web_view.WebView webView) contextMenu the proposed #WebKitContextMenu (optional) hitTestResult a #WebKitHitTestResult (optional) webView the instance the signal is connected to (optional) Returns true to stop other handlers from being invoked for the event. false to propagate the event further. |
after | Yes.After to execute callback after default handler, No.After to execute before (default) |