[−][src]Struct druid::MenuItem
A normal menu item.
A MenuItem
always has a title (a LocalizedString
) as well a Command
,
that is sent to the application when the item is selected.
In addition, other properties can be set during construction, such as whether the item is selected (checked), or enabled, or if it has a hotkey.
Methods
impl<T> MenuItem<T>
[src]
pub fn new(title: LocalizedString<T>, command: impl Into<Command>) -> Self
[src]
Create a new MenuItem
.
pub fn hotkey(
self,
mods: impl Into<Option<RawMods>>,
key: impl Into<KeyCompare>
) -> Self
[src]
self,
mods: impl Into<Option<RawMods>>,
key: impl Into<KeyCompare>
) -> Self
A builder method that adds a hotkey for this item.
Example
let item = MenuItem::new(LocalizedString::new("My Menu Item"), Selector::new("My Selector")) .hotkey(SysMods::Cmd, "m");
pub fn disabled(self) -> Self
[src]
Disable this menu item.
pub fn disabled_if(self, p: impl FnMut() -> bool) -> Self
[src]
Disable this menu item if the provided predicate is true.
pub fn selected(self) -> Self
[src]
Mark this menu item as selected. This will usually be indicated by a checkmark.
pub fn selected_if(self, p: impl FnMut() -> bool) -> Self
[src]
Mark this item as selected, if the provided predicate is true.
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for MenuItem<T>
impl<T> !Send for MenuItem<T>
impl<T> !Sync for MenuItem<T>
impl<T> Unpin for MenuItem<T>
impl<T> !UnwindSafe for MenuItem<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> RoundFrom<T> for T
fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
fn round_into(self) -> U
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,