pub enum MenuItem {
Action(ActionItem),
Separator(SeparatorItem),
SubMenu(SubMenuItem),
}Variants§
Implementations§
Source§impl MenuItem
impl MenuItem
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Checks if the menu item is enabled.
Sourcepub fn is_selectable(&self) -> bool
pub fn is_selectable(&self) -> bool
Returns whether this menu item is selectable.
Source§impl MenuItem
impl MenuItem
Sourcepub fn new_action<S: Into<String>, C: Into<Command>>(
label: S,
command: C,
) -> Self
pub fn new_action<S: Into<String>, C: Into<Command>>( label: S, command: C, ) -> Self
Creates a new action menu item.
Sourcepub fn action_with_hotkey<S: Into<String>, C: Into<Command>>(
label: S,
command: C,
hotkey: char,
) -> Self
pub fn action_with_hotkey<S: Into<String>, C: Into<Command>>( label: S, command: C, hotkey: char, ) -> Self
Creates a new action menu item with hotkey.
Sourcepub fn action_with_all<S: Into<String>, C: Into<Command>>(
label: S,
command: C,
hotkey: Option<char>,
shortcut: Option<S>,
) -> Self
pub fn action_with_all<S: Into<String>, C: Into<Command>>( label: S, command: C, hotkey: Option<char>, shortcut: Option<S>, ) -> Self
Creates a new action menu item with all properties.
Creates a new submenu item.
Creates a new submenu item with hotkey.
Creates a new submenu item with all properties.
Sourcepub fn action<S: Into<String>, C: Into<Command>>(text: S, command: C) -> Self
pub fn action<S: Into<String>, C: Into<Command>>(text: S, command: C) -> Self
Creates a new action menu item (legacy).
Creates a new submenu (legacy).
Sourcepub fn with_hotkey(self, hotkey: char) -> Self
pub fn with_hotkey(self, hotkey: char) -> Self
Sets the hotkey for this menu item (legacy builder pattern).
Sourcepub fn with_shortcut<S: Into<String>>(self, shortcut: S) -> Self
pub fn with_shortcut<S: Into<String>>(self, shortcut: S) -> Self
Sets the shortcut display for this menu item (legacy builder pattern).
Sourcepub fn with_help_context<S: Into<String>>(self, help_context: S) -> Self
pub fn with_help_context<S: Into<String>>(self, help_context: S) -> Self
Sets the help context for the menu item (legacy builder pattern).
Sourcepub fn with_enabled(self, enabled: bool) -> Self
pub fn with_enabled(self, enabled: bool) -> Self
Sets the enabled state of the menu item (legacy builder pattern).
Trait Implementations§
impl Eq for MenuItem
impl StructuralPartialEq for MenuItem
Auto Trait Implementations§
impl Freeze for MenuItem
impl RefUnwindSafe for MenuItem
impl Send for MenuItem
impl Sync for MenuItem
impl Unpin for MenuItem
impl UnwindSafe for MenuItem
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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