Trait webkit2gtk::prelude::OptionMenuExt
source · [−]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;
}
v2_18
only.Expand description
Required Methods
sourcefn activate_item(&self, index: u32)
fn activate_item(&self, index: u32)
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
sourcefn close(&self)
fn close(&self)
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.
sourcefn item(&self, index: u32) -> Option<OptionMenuItem>
fn item(&self, index: u32) -> Option<OptionMenuItem>
Returns the OptionMenuItem
at index
in self
.
index
the index of the item
Returns
a OptionMenuItem
of self
.
sourcefn select_item(&self, index: u32)
fn select_item(&self, index: u32)
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
sourcefn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
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.