1.8 <WebKitContextMenuItem>

Class: <WebKitContextMenuItem>

It derives from <GInitiallyUnowned>.

One item of a <WebKitContextMenu>.

The <WebKitContextMenu> is composed of <WebKitContextMenuItem><!– –>s. These items can be created from a GtkAction, from a <WebKitContextMenuAction> or from a <WebKitContextMenuAction> and a label. These <WebKitContextMenuAction><!– –>s denote stock actions for the items. You can also create separators and submenus.

Procedures

Method: context-menu-item:get-gaction self ⇒ %return
Method: get-gaction self ⇒ %return

Gets the action associated to self as a <GAction>.

self

Passed: a <WebKitContextMenuItem>.

a <WebKitContextMenuItem>

%return

Returned: a <GAction>.

the <GAction> associated to the <WebKitContextMenuItem>, or #f if self is a separator.

Method: context-menu-item:get-gaction-target self ⇒ %return
Method: get-gaction-target self ⇒ %return

Gets the target <GVariant> associated with self.

self

Passed: a <WebKitContextMenuItem>.

a <WebKitContextMenuItem>

%return

Returned: a <GVariant>, or #f.

the target <GVariant> of the <WebKitContextMenuItem>, or #f if self was not created with context-menu-item:new-from-gaction or if no target was specified.

Method: context-menu-item:get-stock-action self ⇒ %return
Method: get-stock-action self ⇒ %return

Gets the <WebKitContextMenuAction> of self.

If the <WebKitContextMenuItem> was not created for a stock action custom will be returned. If the <WebKitContextMenuItem> is a separator no-action will be returned.

self

Passed: a <WebKitContextMenuItem>.

a <WebKitContextMenuItem>

%return

Returned: a <WebKitContextMenuAction>.

the <WebKitContextMenuAction> of self

Method: context-menu-item:get-submenu self ⇒ %return
Method: get-submenu self ⇒ %return

Gets the submenu of self.

self

Passed: a <WebKitContextMenuItem>.

a <WebKitContextMenuItem>

%return

Returned: a <WebKitContextMenu>.

the <WebKitContextMenu> representing the submenu of self or #f if self doesn’t have a submenu.

Method: context-menu-item:get-title self ⇒ %return
Method: get-title self ⇒ %return

Gets the title of self.

self

Passed: a <WebKitContextMenuItem>.

a <WebKitContextMenuItem>

%return

Returned: a string.

the title of self, or #f if self is a separator.

Method: context-menu-item:is-separator? self ⇒ %return
Method: is-separator? self ⇒ %return

Checks whether self is a separator.

self

Passed: a <WebKitContextMenuItem>.

a <WebKitContextMenuItem>

%return

Returned: a boolean.

#t is self is a separator or #f otherwise

Procedure: context-menu-item:new-from-gaction action label [target] ⇒ %return

Creates a new <WebKitContextMenuItem> for the given action and label.

On activation target will be passed as parameter to the callback.

action

Passed: a <GAction>.

a <GAction>

label

Passed: a string.

the menu item label text

target

Passed, or left out: a <GVariant>, or #f.

a <GVariant> to use as the action target

%return

Returned: a <WebKitContextMenuItem>.

the newly created <WebKitContextMenuItem> object.

Procedure: context-menu-item:new-from-stock-action action ⇒ %return

Creates a new <WebKitContextMenuItem> for the given stock action.

Stock actions are handled automatically by WebKit so that, for example, when a menu item created with a stop is activated the action associated will be handled by WebKit and the current load operation will be stopped. You can get the <GAction> of a <WebKitContextMenuItem> created with a <WebKitContextMenuAction> with context-menu-item:get-gaction and connect to the simple-action:activate signal to be notified when the item is activated, but you can’t prevent the associated action from being performed.

action

Passed: a <WebKitContextMenuAction>, or one of its symbols.

a <WebKitContextMenuAction> stock action

%return

Returned: a <WebKitContextMenuItem>.

the newly created <WebKitContextMenuItem> object.

Procedure: context-menu-item:new-from-stock-action-with-label action label ⇒ %return

Creates a new <WebKitContextMenuItem> for the given stock action using the given label.

Stock actions have a predefined label, this method can be used to create a <WebKitContextMenuItem> for a <WebKitContextMenuAction> but using a custom label.

action

Passed: a <WebKitContextMenuAction>, or one of its symbols.

a <WebKitContextMenuAction> stock action

label

Passed: a string.

a custom label text to use instead of the predefined one

%return

Returned: a <WebKitContextMenuItem>.

the newly created <WebKitContextMenuItem> object.

Procedure: context-menu-item:new-separator ⇒ %return

Creates a new <WebKitContextMenuItem> representing a separator.

%return

Returned: a <WebKitContextMenuItem>.

the newly created <WebKitContextMenuItem> object.

Procedure: context-menu-item:new-with-submenu label submenu ⇒ %return

Creates a new <WebKitContextMenuItem> using the given label with a submenu.

label

Passed: a string.

the menu item label text

submenu

Passed: a <WebKitContextMenu>.

a <WebKitContextMenu> to set

%return

Returned: a <WebKitContextMenuItem>.

the newly created <WebKitContextMenuItem> object.

Method: context-menu-item:set-submenu self [submenu]
Method: set-submenu self [submenu]

Sets or replaces the self submenu.

If submenu is #f the current submenu of self is removed.

self

Passed: a <WebKitContextMenuItem>.

a <WebKitContextMenuItem>

submenu

Passed, or left out: a <WebKitContextMenu>, or #f.

a <WebKitContextMenu>