WebKitWebProcessExtension.ContextMenu¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class WebKitWebProcessExtension.ContextMenu(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Represents the context menu in a #WebKitWebView.
WebKitWebProcessExtension.ContextMenu
represents a context menu containingWebKitWebProcessExtension.ContextMenuItem
s in a #WebKitWebView.When a #WebKitWebView is about to display the context menu, it emits the #WebKitWebView::context-menu signal, which has the
WebKitWebProcessExtension.ContextMenu
as an argument. You can modify it, adding new submenus that you can create withWebKitWebProcessExtension.ContextMenu.new
(), adding newWebKitWebProcessExtension.ContextMenuItem
s withWebKitWebProcessExtension.ContextMenu.prepend
(),WebKitWebProcessExtension.ContextMenu.append
() orWebKitWebProcessExtension.ContextMenu.insert
(), maybe after having removed the existing ones withWebKitWebProcessExtension.ContextMenu.remove_all
().- classmethod new()¶
- Returns:
The newly created
WebKitWebProcessExtension.ContextMenu
object- Return type:
Creates a new
WebKitWebProcessExtension.ContextMenu
object.Creates a new
WebKitWebProcessExtension.ContextMenu
object to be used as a submenu of an existingWebKitWebProcessExtension.ContextMenu
. 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 useWebKitWebProcessExtension.ContextMenu.prepend
(),WebKitWebProcessExtension.ContextMenu.append
() orWebKitWebProcessExtension.ContextMenu.insert
(). See alsoWebKitWebProcessExtension.ContextMenu.new_with_items
() to create aWebKitWebProcessExtension.ContextMenu
with a list of initial items.
- classmethod new_with_items(items)¶
- Parameters:
items ([
WebKitWebProcessExtension.ContextMenuItem
]) – aGLib.List
ofWebKitWebProcessExtension.ContextMenuItem
- Returns:
The newly created
WebKitWebProcessExtension.ContextMenu
object- Return type:
Creates a new
WebKitWebProcessExtension.ContextMenu
object with the given items.Creates a new
WebKitWebProcessExtension.ContextMenu
object to be used as a submenu of an existingWebKitWebProcessExtension.ContextMenu
with the given initial items. See alsoWebKitWebProcessExtension.ContextMenu.new
()
- append(item)¶
- Parameters:
item (
WebKitWebProcessExtension.ContextMenuItem
) – theWebKitWebProcessExtension.ContextMenuItem
to add
Adds item at the end of the self.
- first()¶
- Returns:
the first
WebKitWebProcessExtension.ContextMenuItem
of self, orNone
if theWebKitWebProcessExtension.ContextMenu
is empty.- Return type:
Gets the first item in the self.
- get_event()¶
-
Gets the
Gdk.Event
that triggered the context menu. This function only returns a validGdk.Event
when called for aWebKitWebProcessExtension.ContextMenu
passed to #WebKitWebView::context-menu signal; in all other cases,None
is returned.The returned
Gdk.Event
is expected to be one of the following types:a #GdkEventButton of type
Gdk.EventType.BUTTON_PRESS
when the context menu was triggered with mouse.a #GdkEventKey of type
Gdk.EventType.KEY_PRESS
if the keyboard was used to show the menu.a generic
Gdk.Event
of type %GDK_NOTHING when theGtk.Widget
::popup-menu
signal was used to show the context menu.
New in version 2.40.
- get_item_at_position(position)¶
- Parameters:
position (
int
) – the position of the item, counting from 0- Returns:
the
WebKitWebProcessExtension.ContextMenuItem
at position position in self, orNone
if the position is off the end of the self.- Return type:
Gets the item at the given position in the self.
- get_items()¶
- Returns:
- Return type:
Returns the item list of self.
- get_n_items()¶
- Returns:
the number of
WebKitWebProcessExtension.ContextMenuItem
s in self- Return type:
Gets the length of the self.
- get_user_data()¶
- Returns:
the user data of self, or
None
if self doesn’t have user data- Return type:
Gets the user data of self.
This function can be used from the UI Process to get user data previously set from the Web Process with
WebKitWebProcessExtension.ContextMenu.set_user_data
().New in version 2.8.
- insert(item, position)¶
- Parameters:
item (
WebKitWebProcessExtension.ContextMenuItem
) – theWebKitWebProcessExtension.ContextMenuItem
to addposition (
int
) – the position to insert the item
Inserts item into the self at the given position.
If position is negative, or is larger than the number of items in the
WebKitWebProcessExtension.ContextMenu
, the item is added on to the end of the self. The first position is 0.
- last()¶
- Returns:
the last
WebKitWebProcessExtension.ContextMenuItem
of self, orNone
if theWebKitWebProcessExtension.ContextMenu
is empty.- Return type:
Gets the last item in the self.
- move_item(item, position)¶
- Parameters:
item (
WebKitWebProcessExtension.ContextMenuItem
) – theWebKitWebProcessExtension.ContextMenuItem
to addposition (
int
) – the new position to move the item
Moves item to the given position in the self.
If position is negative, or is larger than the number of items in the
WebKitWebProcessExtension.ContextMenu
, the item is added on to the end of the self. The first position is 0.
- prepend(item)¶
- Parameters:
item (
WebKitWebProcessExtension.ContextMenuItem
) – theWebKitWebProcessExtension.ContextMenuItem
to add
Adds item at the beginning of the self.
- remove(item)¶
- Parameters:
item (
WebKitWebProcessExtension.ContextMenuItem
) – theWebKitWebProcessExtension.ContextMenuItem
to remove
Removes item from the self.
See also
WebKitWebProcessExtension.ContextMenu.remove_all
() to remove all items.
- remove_all()¶
Removes all items of the self.
- set_user_data(user_data)¶
- Parameters:
user_data (
GLib.Variant
) – aGLib.Variant
Sets user data to self.
This function can be used from a Web Process extension to set user data that can be retrieved from the UI Process using
WebKitWebProcessExtension.ContextMenu.get_user_data
(). If the user_dataGLib.Variant
is floating, it is consumed.New in version 2.8.