pub struct MenuItem<R: Runtime>(/* private fields */);
Available on
desktop
only.Implementations§
Source§impl<R: Runtime> MenuItem<R>
impl<R: Runtime> MenuItem<R>
Sourcepub fn new<M, T, A>(
manager: &M,
text: T,
enabled: bool,
accelerator: Option<A>,
) -> Result<Self>
pub fn new<M, T, A>( manager: &M, text: T, enabled: bool, accelerator: Option<A>, ) -> Result<Self>
Create a new menu item.
text
could optionally contain an&
before a character to assign this character as the mnemonic for this menu item. To display a&
without assigning a mnemenonic, use&&
.
Sourcepub fn with_id<M, I, T, A>(
manager: &M,
id: I,
text: T,
enabled: bool,
accelerator: Option<A>,
) -> Result<Self>
pub fn with_id<M, I, T, A>( manager: &M, id: I, text: T, enabled: bool, accelerator: Option<A>, ) -> Result<Self>
Create a new menu item with the specified id.
text
could optionally contain an&
before a character to assign this character as the mnemonic for this menu item. To display a&
without assigning a mnemenonic, use&&
.
Sourcepub fn app_handle(&self) -> &AppHandle<R>
pub fn app_handle(&self) -> &AppHandle<R>
The application handle associated with this type.
Sourcepub fn set_text<S: AsRef<str>>(&self, text: S) -> Result<()>
pub fn set_text<S: AsRef<str>>(&self, text: S) -> Result<()>
Set the text for this menu item. text
could optionally contain
an &
before a character to assign this character as the mnemonic
for this menu item. To display a &
without assigning a mnemenonic, use &&
.
Sourcepub fn is_enabled(&self) -> Result<bool>
pub fn is_enabled(&self) -> Result<bool>
Get whether this menu item is enabled or not.
Sourcepub fn set_enabled(&self, enabled: bool) -> Result<()>
pub fn set_enabled(&self, enabled: bool) -> Result<()>
Enable or disable this menu item.
Trait Implementations§
Source§impl<R: Runtime> IsMenuItem<R> for MenuItem<R>
impl<R: Runtime> IsMenuItem<R> for MenuItem<R>
Auto Trait Implementations§
impl<R> Freeze for MenuItem<R>
impl<R> !RefUnwindSafe for MenuItem<R>
impl<R> Send for MenuItem<R>
impl<R> Sync for MenuItem<R>
impl<R> Unpin for MenuItem<R>
impl<R> !UnwindSafe for MenuItem<R>
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