WebKitOptionMenu: WebKit2GTK+ Reference Manual

## WebKitOptionMenu WebKitOptionMenu |

## Functions

guint | webkit_option_menu_get_n_items ()
WebKitOptionMenuItem * | webkit_option_menu_get_item ()
void | webkit_option_menu_select_item ()
void | webkit_option_menu_activate_item ()
void | webkit_option_menu_close ()

## Signals

void | close | Run Last

## Types and Values

struct | WebKitOptionMenu

## Object Hierarchy

        GObject
        ╰── WebKitOptionMenu

## Description

WebKitOptionMenu represents the dropdown menu of a select element in a WebKitWebView.

When a select element in a WebKitWebView needs to display a dropdown menu, the signal “show-option-menu” is emitted, providing a WebKitOptionMenu with the WebKitOptionMenuItems that should be displayed.

## Functions

### webkit_option_menu_get_n_items ()

    guint
    webkit_option_menu_get_n_items (WebKitOptionMenu *menu);

Gets the length of the `menu` .

#### Parameters

menu | a WebKitOptionMenu |

#### Returns

the number of WebKitOptionMenuItems in `menu`

Since: 2.18

### webkit_option_menu_get_item ()

    WebKitOptionMenuItem *
    webkit_option_menu_get_item (WebKitOptionMenu *menu,
                                 guint index);

Returns the WebKitOptionMenuItem at `index` in `menu` .

#### Parameters

menu | a WebKitOptionMenu |
index | the index of the item |

#### Returns

a WebKitOptionMenuItem of `menu` .

[transfer none]

Since: 2.18

### webkit_option_menu_select_item ()

    void
    webkit_option_menu_select_item (WebKitOptionMenu *menu,
                                    guint index);

Selects the WebKitOptionMenuItem at `index` in `menu` . Selecting an item changes the text shown by the combo button, but it doesn't change the value of the element. You need to explicitly activate the item with `webkit_option_menu_select_item()` or close the menu with `webkit_option_menu_close()` in which case the currently selected item will be activated.

#### Parameters

menu | a WebKitOptionMenu |
index | the index of the item |

Since: 2.18

### webkit_option_menu_activate_item ()

    void
    webkit_option_menu_activate_item (WebKitOptionMenu *menu,
                                      guint index);

Activates the WebKitOptionMenuItem at `index` in `menu` . Activating an item changes the value of the element making the item the active one. You are expected to close the menu with `webkit_option_menu_close()` after activating an item, calling this function again will have no effect.

#### Parameters

menu | a WebKitOptionMenu |
index | the index of the item |

Since: 2.18

### webkit_option_menu_close ()

    void
    webkit_option_menu_close (WebKitOptionMenu *menu);

Request to close a WebKitOptionMenu. This emits WebKitOptionMenu::close signal. This function should always be called to notify WebKit that the associated menu has been closed. If the menu is closed and neither `webkit_option_menu_select_item()` nor `webkit_option_menu_activate_item()` have been called, the element value remains unchanged.

#### Parameters

menu | a WebKitOptionMenu |

Since: 2.18

## Types and Values

### struct WebKitOptionMenu

    struct WebKitOptionMenu;

## Signal Details

### The `“close”` signal

    void
    user_function (WebKitOptionMenu *menu,
                   gpointer          user_data)

Emitted when closing a WebKitOptionMenu is requested. This can happen when the user explicitly calls `webkit_option_menu_close()` or when the element is detached from the current page.

#### Parameters

menu | the WebKitOptionMenu on which the signal is emitted |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 2.18