pub struct IconMenuItem<R: Runtime>(/* private fields */);Available on
desktop only.Implementations§
Source§impl<R: Runtime> IconMenuItem<R>
impl<R: Runtime> IconMenuItem<R>
Sourcepub fn new<M, T, A>(
manager: &M,
text: T,
enabled: bool,
icon: Option<Image<'_>>,
accelerator: Option<A>,
) -> Result<Self>
pub fn new<M, T, A>( manager: &M, text: T, enabled: bool, icon: Option<Image<'_>>, accelerator: Option<A>, ) -> Result<Self>
Create a new menu item.
textcould 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,
icon: Option<Image<'_>>,
accelerator: Option<A>,
) -> Result<Self>
pub fn with_id<M, I, T, A>( manager: &M, id: I, text: T, enabled: bool, icon: Option<Image<'_>>, accelerator: Option<A>, ) -> Result<Self>
Create a new menu item with the specified id.
textcould 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_native_icon<M, T, A>(
manager: &M,
text: T,
enabled: bool,
native_icon: Option<NativeIcon>,
accelerator: Option<A>,
) -> Result<Self>
pub fn with_native_icon<M, T, A>( manager: &M, text: T, enabled: bool, native_icon: Option<NativeIcon>, accelerator: Option<A>, ) -> Result<Self>
Create a new icon menu item but with a native icon.
See IconMenuItem::new for more info.
§Platform-specific:
- Windows / Linux: Unsupported.
Sourcepub fn with_id_and_native_icon<M, I, T, A>(
manager: &M,
id: I,
text: T,
enabled: bool,
native_icon: Option<NativeIcon>,
accelerator: Option<A>,
) -> Result<Self>
pub fn with_id_and_native_icon<M, I, T, A>( manager: &M, id: I, text: T, enabled: bool, native_icon: Option<NativeIcon>, accelerator: Option<A>, ) -> Result<Self>
Create a new icon menu item with the specified id but with a native icon.
See IconMenuItem::new for more info.
§Platform-specific:
- Windows / Linux: Unsupported.
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.
Sourcepub fn set_accelerator<S: AsRef<str>>(
&self,
accelerator: Option<S>,
) -> Result<()>
pub fn set_accelerator<S: AsRef<str>>( &self, accelerator: Option<S>, ) -> Result<()>
Set this menu item accelerator.
Sourcepub fn set_icon(&self, icon: Option<Image<'_>>) -> Result<()>
pub fn set_icon(&self, icon: Option<Image<'_>>) -> Result<()>
Change this menu item icon or remove it.
Sourcepub fn set_native_icon(&self, _icon: Option<NativeIcon>) -> Result<()>
pub fn set_native_icon(&self, _icon: Option<NativeIcon>) -> Result<()>
Change this menu item icon to a native image or remove it.
§Platform-specific:
- Windows / Linux: Unsupported.
Trait Implementations§
Source§impl<R: Runtime> Clone for IconMenuItem<R>
impl<R: Runtime> Clone for IconMenuItem<R>
Source§impl<R: Runtime> IsMenuItem<R> for IconMenuItem<R>
impl<R: Runtime> IsMenuItem<R> for IconMenuItem<R>
Auto Trait Implementations§
impl<R> Freeze for IconMenuItem<R>
impl<R> !RefUnwindSafe for IconMenuItem<R>
impl<R> Send for IconMenuItem<R>
impl<R> Sync for IconMenuItem<R>
impl<R> Unpin for IconMenuItem<R>
impl<R> !UnwindSafe for IconMenuItem<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