pub struct MenuItemBuilder {
pub options: Options,
pub callback: Option<Callback<CallbackClosure<JsValue>>>,
}
Expand description
MenuItem Builder
For usage example please refer to Examples
Fields§
§options: Options
§callback: Option<Callback<CallbackClosure<JsValue>>>
Implementations§
Source§impl MenuItemBuilder
impl MenuItemBuilder
pub fn new() -> Self
Sourcepub fn set_type(self, t: MenuItemType) -> Self
pub fn set_type(self, t: MenuItemType) -> Self
Type of MenuItem
Sourcepub fn callback<F>(self, callback: F) -> Self
pub fn callback<F>(self, callback: F) -> Self
The callback function when item is triggered by mouse click or keyboard shortcut
Sourcepub fn enabled(self, enabled: bool) -> Self
pub fn enabled(self, enabled: bool) -> Self
Whether the item is enabled or disabled. It’s set to true by default.
Sourcepub fn checked(self, checked: bool) -> Self
pub fn checked(self, checked: bool) -> Self
Whether the checkbox is checked or not. It’s set to false by default.
A submenu
Create submenu from menu items
pub fn build(self) -> Result<MenuItem>
pub fn finalize( self, ) -> Result<(MenuItem, Option<Callback<CallbackClosure<JsValue>>>)>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MenuItemBuilder
impl RefUnwindSafe for MenuItemBuilder
impl !Send for MenuItemBuilder
impl !Sync for MenuItemBuilder
impl Unpin for MenuItemBuilder
impl UnwindSafe for MenuItemBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more