WebKit2GTK+ Reference Manual: WebKitContextMenuItem

## WebKitContextMenuItem WebKitContextMenuItem — One item of the WebKitContextMenu |

## Functions

WebKitContextMenuItem * | webkit_context_menu_item_new ()
WebKitContextMenuItem * | webkit_context_menu_item_new_from_stock_action ()
WebKitContextMenuItem * | webkit_context_menu_item_new_from_stock_action_with_label ()
WebKitContextMenuItem * | webkit_context_menu_item_new_with_submenu ()
WebKitContextMenuItem * | webkit_context_menu_item_new_separator ()
GtkAction * | webkit_context_menu_item_get_action ()
WebKitContextMenuAction | webkit_context_menu_item_get_stock_action ()
gboolean | webkit_context_menu_item_is_separator ()
void | webkit_context_menu_item_set_submenu ()
WebKitContextMenu * | webkit_context_menu_item_get_submenu ()

## Types and Values

| WebKitContextMenuItem
enum | WebKitContextMenuAction

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── WebKitContextMenuItem

## Description

The WebKitContextMenu is composed of WebKitContextMenuItems. These items can be created from a GtkAction, from a WebKitContextMenuAction or from a WebKitContextMenuAction and a label. These WebKitContextMenuActions denote stock actions for the items. You can also create separators and submenus.

## Functions

### webkit_context_menu_item_new ()

    WebKitContextMenuItem *
    webkit_context_menu_item_new (GtkAction *action);

Creates a new WebKitContextMenuItem for the given `action` .

#### Parameters

action | a GtkAction |

#### Returns

the newly created WebKitContextMenuItem object.

### webkit_context_menu_item_new_from_stock_action ()

    WebKitContextMenuItem *
    webkit_context_menu_item_new_from_stock_action
                                   (WebKitContextMenuAction action);

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 `WEBKIT_CONTEXT_MENU_ACTION_STOP` is activated the action associated will be handled by WebKit and the current load operation will be stopped. You can get the GtkAction of a WebKitContextMenuItem created with a WebKitContextMenuAction with `webkit_context_menu_item_get_action()` and connect to “activate” signal to be notified when the item is activated. But you can't prevent the asociated action from being performed.

#### Parameters

action | a WebKitContextMenuAction stock action |

#### Returns

the newly created WebKitContextMenuItem object.

### webkit_context_menu_item_new_from_stock_action_with_label ()

    WebKitContextMenuItem *
    webkit_context_menu_item_new_from_stock_action_with_label
                                   (WebKitContextMenuAction action,
                                    const gchar *label);

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.

#### Parameters

action | a WebKitContextMenuAction stock action |
label | a custom label text to use instead of the predefined one |

#### Returns

the newly created WebKitContextMenuItem object.

### webkit_context_menu_item_new_with_submenu ()

    WebKitContextMenuItem *
    webkit_context_menu_item_new_with_submenu
                                   (const gchar *label,
                                    WebKitContextMenu *submenu);

Creates a new WebKitContextMenuItem using the given `label` with a submenu.

#### Parameters

label | the menu item label text |
submenu | a WebKitContextMenu to set |

#### Returns

the newly created WebKitContextMenuItem object.

### webkit_context_menu_item_new_separator ()

    WebKitContextMenuItem *
    webkit_context_menu_item_new_separator
                                   (void);

Creates a new WebKitContextMenuItem representing a separator.

#### Returns

the newly created WebKitContextMenuItem object.

### webkit_context_menu_item_get_action ()

    GtkAction *
    webkit_context_menu_item_get_action (WebKitContextMenuItem *item);

Gets the action associated to `item` .

#### Parameters

item | a WebKitContextMenuItem |

#### Returns

the GtkAction associated to the WebKitContextMenuItem, or `NULL` if `item` is a separator.

[transfer none]

### webkit_context_menu_item_get_stock_action ()

    WebKitContextMenuAction
    webkit_context_menu_item_get_stock_action
                                   (WebKitContextMenuItem *item);

Gets the WebKitContextMenuAction of `item` . If the WebKitContextMenuItem was not created for a stock action `WEBKIT_CONTEXT_MENU_ACTION_CUSTOM` will be returned. If the WebKitContextMenuItem is a separator `WEBKIT_CONTEXT_MENU_ACTION_NO_ACTION` will be returned.

#### Parameters

item | a WebKitContextMenuItem |

#### Returns

the WebKitContextMenuAction of `item`

### webkit_context_menu_item_is_separator ()

    gboolean
    webkit_context_menu_item_is_separator (WebKitContextMenuItem *item);

Checks whether `item` is a separator.

#### Parameters

item | a WebKitContextMenuItem |

#### Returns

`TRUE` is `item` is a separator or `FALSE` otherwise

### webkit_context_menu_item_set_submenu ()

    void
    webkit_context_menu_item_set_submenu (WebKitContextMenuItem *item,
                                          WebKitContextMenu *submenu);

Sets or replaces the `item` submenu. If `submenu` is `NULL` the current submenu of `item` is removed.

#### Parameters

item | a WebKitContextMenuItem |
submenu | a WebKitContextMenu. | [allow-none]

### webkit_context_menu_item_get_submenu ()

    WebKitContextMenu *
    webkit_context_menu_item_get_submenu (WebKitContextMenuItem *item);

Gets the submenu of `item` .

#### Parameters

item | a WebKitContextMenuItem |

#### Returns

the WebKitContextMenu representing the submenu of `item` or `NULL` if `item` doesn't have a submenu.

[transfer none]

## Types and Values

### WebKitContextMenuItem

    typedef struct _WebKitContextMenuItem WebKitContextMenuItem;

### enum WebKitContextMenuAction

Enum values used to denote the stock actions for WebKitContextMenuItems

#### Members

WEBKIT_CONTEXT_MENU_ACTION_NO_ACTION | No action, used by separator menu items. |
WEBKIT_CONTEXT_MENU_ACTION_OPEN_LINK | Open current link. |
WEBKIT_CONTEXT_MENU_ACTION_OPEN_LINK_IN_NEW_WINDOW | Open current link in a new window. |
WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_LINK_TO_DISK | Download link destination. |
WEBKIT_CONTEXT_MENU_ACTION_COPY_LINK_TO_CLIPBOARD | Copy link location to the clipboard. |
WEBKIT_CONTEXT_MENU_ACTION_OPEN_IMAGE_IN_NEW_WINDOW | Open current image in a new window. |
WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_IMAGE_TO_DISK | Download current image. |
WEBKIT_CONTEXT_MENU_ACTION_COPY_IMAGE_TO_CLIPBOARD | Copy current image to the clipboard. |
WEBKIT_CONTEXT_MENU_ACTION_COPY_IMAGE_URL_TO_CLIPBOARD | Copy curent image location to the clipboard. |
WEBKIT_CONTEXT_MENU_ACTION_OPEN_FRAME_IN_NEW_WINDOW | Open current frame in a new window. |
WEBKIT_CONTEXT_MENU_ACTION_GO_BACK | Load the previous history item. |
WEBKIT_CONTEXT_MENU_ACTION_GO_FORWARD | Load the next history item. |
WEBKIT_CONTEXT_MENU_ACTION_STOP | Stop any ongoing loading operation. |
WEBKIT_CONTEXT_MENU_ACTION_RELOAD | Reload the conents of current view. |
WEBKIT_CONTEXT_MENU_ACTION_COPY | Copy current selection the clipboard. |
WEBKIT_CONTEXT_MENU_ACTION_CUT | Cut current selection to the clipboard. |
WEBKIT_CONTEXT_MENU_ACTION_PASTE | Paste clipboard contents. |
WEBKIT_CONTEXT_MENU_ACTION_DELETE | Delete current selection. |
WEBKIT_CONTEXT_MENU_ACTION_SELECT_ALL | Select all text. |
WEBKIT_CONTEXT_MENU_ACTION_INPUT_METHODS | Input methods menu. |
WEBKIT_CONTEXT_MENU_ACTION_UNICODE | Unicode menu. |
WEBKIT_CONTEXT_MENU_ACTION_SPELLING_GUESS | A proposed replacement for a misspelled word. |
WEBKIT_CONTEXT_MENU_ACTION_NO_GUESSES_FOUND | An indicator that spellchecking found no proposed replacements. |
WEBKIT_CONTEXT_MENU_ACTION_IGNORE_SPELLING | Causes the spellchecker to ignore the word for this session. |
WEBKIT_CONTEXT_MENU_ACTION_LEARN_SPELLING | Causes the spellchecker to add the word to the dictionary. |
WEBKIT_CONTEXT_MENU_ACTION_IGNORE_GRAMMAR | Ignore grammar. |
WEBKIT_CONTEXT_MENU_ACTION_FONT_MENU | Font options menu. |
WEBKIT_CONTEXT_MENU_ACTION_BOLD | Bold. |
WEBKIT_CONTEXT_MENU_ACTION_ITALIC | Italic. |
WEBKIT_CONTEXT_MENU_ACTION_UNDERLINE | Underline. |
WEBKIT_CONTEXT_MENU_ACTION_OUTLINE | Outline. |
WEBKIT_CONTEXT_MENU_ACTION_INSPECT_ELEMENT | Open current element in the inspector. |
WEBKIT_CONTEXT_MENU_ACTION_OPEN_VIDEO_IN_NEW_WINDOW | Open current video element in a new window. |
WEBKIT_CONTEXT_MENU_ACTION_OPEN_AUDIO_IN_NEW_WINDOW | Open current audio element in a new window. |
WEBKIT_CONTEXT_MENU_ACTION_COPY_VIDEO_LINK_TO_CLIPBOARD | Copy video link location in to the clipboard. |
WEBKIT_CONTEXT_MENU_ACTION_COPY_AUDIO_LINK_TO_CLIPBOARD | Copy audio link location in to the clipboard. |
WEBKIT_CONTEXT_MENU_ACTION_TOGGLE_MEDIA_CONTROLS | Enable or disable media controls. |
WEBKIT_CONTEXT_MENU_ACTION_TOGGLE_MEDIA_LOOP | Enable or disable media loop. |
WEBKIT_CONTEXT_MENU_ACTION_ENTER_VIDEO_FULLSCREEN | Show current video element in fullscreen mode. |
WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PLAY | Play current media element. |
WEBKIT_CONTEXT_MENU_ACTION_MEDIA_PAUSE | Pause current media element. |
WEBKIT_CONTEXT_MENU_ACTION_MEDIA_MUTE | Mute current media element. |
WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_VIDEO_TO_DISK | Download video to disk. Since 2.2 |
WEBKIT_CONTEXT_MENU_ACTION_DOWNLOAD_AUDIO_TO_DISK | Download audio to disk. Since 2.2 |
WEBKIT_CONTEXT_MENU_ACTION_CUSTOM | Custom action defined by applications. |