pub trait OptionMenuExt: 'static {
    fn activate_item(&self, index: u32);
    fn close(&self);
    fn item(&self, index: u32) -> Option<OptionMenuItem>;
    fn n_items(&self) -> u32;
    fn select_item(&self, index: u32);
    fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
Available on crate feature v2_18 only.
Expand description

Trait containing all OptionMenu methods.

Implementors

OptionMenu

Required Methods

Activates the 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 close() after activating an item, calling this function again will have no effect.

index

the index of the item

Request to close a OptionMenu.

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

Returns the OptionMenuItem at index in self.

index

the index of the item

Returns

a OptionMenuItem of self.

Gets the length of the self.

Returns

the number of OptionMenuItems in self

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

index

the index of the item

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

Implementors