WebKit2.ContextMenuItem¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class WebKit2.ContextMenuItem(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
One item of a
WebKit2.ContextMenu
.The
WebKit2.ContextMenu
is composed ofWebKit2.ContextMenuItem
s. These items can be created from aGtk.Action
, from aWebKit2.ContextMenuAction
or from aWebKit2.ContextMenuAction
and a label. TheseWebKit2.ContextMenuAction
s denote stock actions for the items. You can also create separators and submenus.- classmethod new(action)¶
- Parameters:
action (
Gtk.Action
) – aGtk.Action
- Returns:
the newly created
WebKit2.ContextMenuItem
object.- Return type:
Creates a new
WebKit2.ContextMenuItem
for the given action.Deprecated since version 2.18: Use
WebKit2.ContextMenuItem.new_from_gaction
() instead.
- classmethod new_from_gaction(action, label, target)¶
- Parameters:
action (
Gio.Action
) – aGio.Action
label (
str
) – the menu item label texttarget (
GLib.Variant
orNone
) – aGLib.Variant
to use as the action target
- Returns:
the newly created
WebKit2.ContextMenuItem
object.- Return type:
Creates a new
WebKit2.ContextMenuItem
for the given action and label.On activation target will be passed as parameter to the callback.
New in version 2.18.
- classmethod new_from_stock_action(action)¶
- Parameters:
action (
WebKit2.ContextMenuAction
) – aWebKit2.ContextMenuAction
stock action- Returns:
the newly created
WebKit2.ContextMenuItem
object.- Return type:
Creates a new
WebKit2.ContextMenuItem
for the given stock action.Stock actions are handled automatically by WebKit so that, for example, when a menu item created with a
WebKit2.ContextMenuAction.STOP
is activated the action associated will be handled by WebKit and the current load operation will be stopped. You can get theGio.Action
of aWebKit2.ContextMenuItem
created with aWebKit2.ContextMenuAction
withWebKit2.ContextMenuItem.get_gaction
() and connect to theGio.SimpleAction
::activate
signal to be notified when the item is activated, but you can’t prevent the associated action from being performed.
- classmethod new_from_stock_action_with_label(action, label)¶
- Parameters:
action (
WebKit2.ContextMenuAction
) – aWebKit2.ContextMenuAction
stock actionlabel (
str
) – a custom label text to use instead of the predefined one
- Returns:
the newly created
WebKit2.ContextMenuItem
object.- Return type:
Creates a new
WebKit2.ContextMenuItem
for the given stock action using the given label.Stock actions have a predefined label, this method can be used to create a
WebKit2.ContextMenuItem
for aWebKit2.ContextMenuAction
but using a custom label.
- classmethod new_separator()¶
- Returns:
the newly created
WebKit2.ContextMenuItem
object.- Return type:
Creates a new
WebKit2.ContextMenuItem
representing a separator.
- classmethod new_with_submenu(label, submenu)¶
- Parameters:
label (
str
) – the menu item label textsubmenu (
WebKit2.ContextMenu
) – aWebKit2.ContextMenu
to set
- Returns:
the newly created
WebKit2.ContextMenuItem
object.- Return type:
Creates a new
WebKit2.ContextMenuItem
using the given label with a submenu.
- get_action()¶
- Returns:
the
Gtk.Action
associated to theWebKit2.ContextMenuItem
, orNone
if self is a separator.- Return type:
Gets the action associated to self as a
Gtk.Action
.Deprecated since version 2.18: Use
WebKit2.ContextMenuItem.get_gaction
() instead.
- get_gaction()¶
- Returns:
the
Gio.Action
associated to theWebKit2.ContextMenuItem
, orNone
if self is a separator.- Return type:
Gets the action associated to self as a
Gio.Action
.New in version 2.18.
- get_stock_action()¶
- Returns:
the
WebKit2.ContextMenuAction
of self- Return type:
Gets the
WebKit2.ContextMenuAction
of self.If the
WebKit2.ContextMenuItem
was not created for a stock actionWebKit2.ContextMenuAction.CUSTOM
will be returned. If theWebKit2.ContextMenuItem
is a separatorWebKit2.ContextMenuAction.NO_ACTION
will be returned.
- get_submenu()¶
- Returns:
the
WebKit2.ContextMenu
representing the submenu of self orNone
if self doesn’t have a submenu.- Return type:
Gets the submenu of self.
- is_separator()¶
-
Checks whether self is a separator.
- set_submenu(submenu)¶
- Parameters:
submenu (
WebKit2.ContextMenu
orNone
) – aWebKit2.ContextMenu
Sets or replaces the self submenu.
If submenu is
None
the current submenu of self is removed.