[−][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.
Implementations
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 IntoKey) -> Self
[src]
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>
[src]
impl<T> !Send for MenuItem<T>
[src]
impl<T> !Sync for MenuItem<T>
[src]
impl<T> Unpin for MenuItem<T>
[src]
impl<T> !UnwindSafe for MenuItem<T>
[src]
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,
pub 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
pub fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
pub fn round_into(self) -> U
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,