WebKit2.OptionMenu

g GObject.Object GObject.Object WebKit2.OptionMenu WebKit2.OptionMenu GObject.Object->WebKit2.OptionMenu

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

activate_item (index)

close ()

get_event ()

get_item (index)

get_n_items ()

select_item (index)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Name

Short Description

close

Emitted when closing a WebKit2.OptionMenu is requested.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class WebKit2.OptionMenu(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

WebKit2.OptionMenuClass

Represents the dropdown menu of a select element in a WebKit2.WebView.

When a select element in a WebKit2.WebView needs to display a dropdown menu, the signal WebKit2.WebView ::show-option-menu is emitted, providing a WebKit2.OptionMenu with the WebKit2.OptionMenuItem s that should be displayed.

New in version 2.18.

activate_item(index)
Parameters:

index (int) – the index of the item

Activates the WebKit2.OptionMenuItem at index in self.

Activating an item changes the value of the element making the item the active one. You are expected to close the menu with WebKit2.OptionMenu.close() after activating an item, calling this function again will have no effect.

New in version 2.18.

close()

Request to close a WebKit2.OptionMenu.

This emits WebKit2.OptionMenu ::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 WebKit2.OptionMenu.select_item() nor WebKit2.OptionMenu.activate_item() have been called, the element value remains unchanged.

New in version 2.18.

get_event()
Returns:

the menu event or None.

Return type:

Gdk.Event

Gets the Gdk.Event that triggered the dropdown menu. If self was not triggered by a user interaction, like a mouse click, None is returned.

New in version 2.40.

get_item(index)
Parameters:

index (int) – the index of the item

Returns:

a WebKit2.OptionMenuItem of self.

Return type:

WebKit2.OptionMenuItem

Returns the WebKit2.OptionMenuItem at index in self.

New in version 2.18.

get_n_items()
Returns:

the number of WebKit2.OptionMenuItem s in self

Return type:

int

Gets the length of the self.

New in version 2.18.

select_item(index)
Parameters:

index (int) – the index of the item

Selects the WebKit2.OptionMenuItem at index in self.

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 WebKit2.OptionMenu.select_item() or close the menu with WebKit2.OptionMenu.close() in which case the currently selected item will be activated.

New in version 2.18.

Signal Details

WebKit2.OptionMenu.signals.close(option_menu)
Signal Name:

close

Flags:

RUN_LAST

Parameters:

option_menu (WebKit2.OptionMenu) – The object which received the signal

Emitted when closing a WebKit2.OptionMenu is requested. This can happen when the user explicitly calls WebKit2.OptionMenu.close() or when the element is detached from the current page.

New in version 2.18.