connectContextMenu

fun connectContextMenu(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (contextMenu: ContextMenu, hitTestResult: HitTestResult) -> Boolean): <Error class: unknown class>

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. To customize the proposed menu you can use webkit_context_menu_prepend(), webkit_context_menu_append() or webkit_context_menu_insert() to add new #WebKitContextMenuItems to @context_menu, webkit_context_menu_move_item() to reorder existing items, or webkit_context_menu_remove() to remove an existing item. The signal handler should return false, and the menu represented by @context_menu will be shown. 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. To build your own menu, you can remove all items from the proposed menu with webkit_context_menu_remove_all(), 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. 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.

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

connectFlags

A combination of ConnectFlags

handler

the Callback to connect. Params: contextMenu the proposed #WebKitContextMenu; hitTestResult a #WebKitHitTestResult. Returns true to stop other handlers from being invoked for the event. false to propagate the event further.