pub enum MenuBarItem {
Action {
id: String,
label: String,
shortcut: Option<String>,
enabled: bool,
},
Separator,
Submenu {
label: String,
items: Vec<MenuBarItem>,
enabled: bool,
},
}Expand description
A single item in a menu dropdown.
Variants§
Action
A clickable action item.
Fields
Separator
A visual separator line.
A submenu that opens additional items.
Implementations§
Source§impl MenuBarItem
impl MenuBarItem
Sourcepub fn action(id: impl Into<String>, label: impl Into<String>) -> Self
pub fn action(id: impl Into<String>, label: impl Into<String>) -> Self
Create a new action item.
Create a submenu.
Sourcepub fn shortcut(self, shortcut: impl Into<String>) -> Self
pub fn shortcut(self, shortcut: impl Into<String>) -> Self
Add a shortcut display to this item.
Sourcepub fn is_selectable(&self) -> bool
pub fn is_selectable(&self) -> bool
Check if this item is selectable (not a separator and enabled).
Check if this item has a submenu.
Sourcepub fn get_shortcut(&self) -> Option<&str>
pub fn get_shortcut(&self) -> Option<&str>
Get the shortcut for this item.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if this item is enabled.
Get submenu items if this is a submenu.
Trait Implementations§
Source§impl Clone for MenuBarItem
impl Clone for MenuBarItem
Source§fn clone(&self) -> MenuBarItem
fn clone(&self) -> MenuBarItem
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MenuBarItem
impl RefUnwindSafe for MenuBarItem
impl Send for MenuBarItem
impl Sync for MenuBarItem
impl Unpin for MenuBarItem
impl UnwindSafe for MenuBarItem
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more