ContextMenu

#WebKitContextMenu represents a context menu containing #WebKitContextMenuItem<!-- -->s in a #WebKitWebView.

When a #WebKitWebView is about to display the context menu, it emits the #WebKitWebView::context-menu signal, which has the #WebKitContextMenu as an argument. You can modify it, adding new submenus that you can create with webkit_context_menu_new(), adding new #WebKitContextMenuItem<!-- -->s with webkit_context_menu_prepend(), webkit_context_menu_append() or webkit_context_menu_insert(), maybe after having removed the existing ones with webkit_context_menu_remove_all().

Constructors

this
this(WebKitContextMenu* webKitContextMenu, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this()

Creates a new #WebKitContextMenu object to be used as a submenu of an existing #WebKitContextMenu. The context menu of a #WebKitWebView is created by the view and passed as an argument of #WebKitWebView::context-menu signal. To add items to the menu use webkit_context_menu_prepend(), webkit_context_menu_append() or webkit_context_menu_insert(). See also webkit_context_menu_new_with_items() to create a #WebKitContextMenu with a list of initial items.

this
this(ListG items)

Creates a new #WebKitContextMenu object to be used as a submenu of an existing #WebKitContextMenu with the given initial items. See also webkit_context_menu_new()

Members

Functions

append
void append(ContextMenuItem item)

Adds @item at the end of the @menu.

first
ContextMenuItem first()

Gets the first item in the @menu.

getContextMenuStruct
WebKitContextMenu* getContextMenuStruct(bool transferOwnership)

Get the main Gtk struct

getItemAtPosition
ContextMenuItem getItemAtPosition(uint position)

Gets the item at the given position in the @menu.

getItems
ListG getItems()

Returns the item list of @menu.

getNItems
uint getNItems()

Gets the length of the @menu.

getStruct
void* getStruct()

the main Gtk struct as a void*

getUserData
Variant getUserData()

Gets the user data of @menu. This function can be used from the UI Process to get user data previously set from the Web Process with webkit_context_menu_set_user_data().

insert
void insert(ContextMenuItem item, int position)

Inserts @item into the @menu at the given position. If @position is negative, or is larger than the number of items in the #WebKitContextMenu, the item is added on to the end of the @menu. The first position is 0.

last
ContextMenuItem last()

Gets the last item in the @menu.

moveItem
void moveItem(ContextMenuItem item, int position)

Moves @item to the given position in the @menu. If @position is negative, or is larger than the number of items in the #WebKitContextMenu, the item is added on to the end of the @menu. The first position is 0.

prepend
void prepend(ContextMenuItem item)

Adds @item at the beginning of the @menu.

remove
void remove(ContextMenuItem item)

Removes @item from the @menu. See also webkit_context_menu_remove_all() to remove all items.

removeAll
void removeAll()

Removes all items of the @menu.

setUserData
void setUserData(Variant userData)

Sets user data to @menu. This function can be used from a Web Process extension to set user data that can be retrieved from the UI Process using webkit_context_menu_get_user_data(). If the @user_data #GVariant is floating, it is consumed.

Static functions

getType
GType getType()

Variables

webKitContextMenu
WebKitContextMenu* webKitContextMenu;

the main Gtk struct

Meta