pub struct MudaSubmenu { /* private fields */ }Implementations§
Sourcepub fn new<S>(text: S, enabled: bool) -> Submenu
pub fn new<S>(text: S, enabled: bool) -> Submenu
Create a new submenu.
textcould optionally contain an&before a character to assign this character as the mnemonic for this submenu. To display a&without assigning a mnemenonic, use&&.
Sourcepub fn with_id<I, S>(id: I, text: S, enabled: bool) -> Submenu
pub fn with_id<I, S>(id: I, text: S, enabled: bool) -> Submenu
Create a new submenu with the specified id.
textcould optionally contain an&before a character to assign this character as the mnemonic for this submenu. To display a&without assigning a mnemenonic, use&&.
Sourcepub fn with_items<S>(
text: S,
enabled: bool,
items: &[&dyn IsMenuItem],
) -> Result<Submenu, Error>
pub fn with_items<S>( text: S, enabled: bool, items: &[&dyn IsMenuItem], ) -> Result<Submenu, Error>
Creates a new submenu with given items. It calls Submenu::new and Submenu::append_items internally.
Sourcepub fn with_id_and_items<I, S>(
id: I,
text: S,
enabled: bool,
items: &[&dyn IsMenuItem],
) -> Result<Submenu, Error>
pub fn with_id_and_items<I, S>( id: I, text: S, enabled: bool, items: &[&dyn IsMenuItem], ) -> Result<Submenu, Error>
Creates a new submenu with the specified id and given items. It calls Submenu::new and Submenu::append_items internally.
Sourcepub fn append(&self, item: &dyn IsMenuItem) -> Result<(), Error>
pub fn append(&self, item: &dyn IsMenuItem) -> Result<(), Error>
Add a menu item to the end of this menu.
Sourcepub fn append_items(&self, items: &[&dyn IsMenuItem]) -> Result<(), Error>
pub fn append_items(&self, items: &[&dyn IsMenuItem]) -> Result<(), Error>
Add menu items to the end of this submenu. It calls Submenu::append in a loop.
Sourcepub fn prepend(&self, item: &dyn IsMenuItem) -> Result<(), Error>
pub fn prepend(&self, item: &dyn IsMenuItem) -> Result<(), Error>
Add a menu item to the beginning of this submenu.
Sourcepub fn prepend_items(&self, items: &[&dyn IsMenuItem]) -> Result<(), Error>
pub fn prepend_items(&self, items: &[&dyn IsMenuItem]) -> Result<(), Error>
Add menu items to the beginning of this submenu.
It calls Menu::prepend on the first element and
passes the rest to Menu::insert_items with position of 1.
Sourcepub fn insert(
&self,
item: &dyn IsMenuItem,
position: usize,
) -> Result<(), Error>
pub fn insert( &self, item: &dyn IsMenuItem, position: usize, ) -> Result<(), Error>
Insert a menu item at the specified postion in the submenu.
Sourcepub fn insert_items(
&self,
items: &[&dyn IsMenuItem],
position: usize,
) -> Result<(), Error>
pub fn insert_items( &self, items: &[&dyn IsMenuItem], position: usize, ) -> Result<(), Error>
Insert menu items at the specified postion in the submenu.
Sourcepub fn remove(&self, item: &dyn IsMenuItem) -> Result<(), Error>
pub fn remove(&self, item: &dyn IsMenuItem) -> Result<(), Error>
Remove a menu item from this submenu.
Sourcepub fn remove_at(&self, position: usize) -> Option<MenuItemKind>
pub fn remove_at(&self, position: usize) -> Option<MenuItemKind>
Remove the menu item at the specified position from this submenu and returns it.
Sourcepub fn items(&self) -> Vec<MenuItemKind>
pub fn items(&self) -> Vec<MenuItemKind>
Returns a list of menu items that has been added to this submenu.
Sourcepub fn set_text<S>(&self, text: S)
pub fn set_text<S>(&self, text: S)
Set the text for this submenu. text could optionally contain
an & before a character to assign this character as the mnemonic
for this submenu. To display a & without assigning a mnemenonic, use &&.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Get whether this submenu is enabled or not.
Sourcepub fn set_enabled(&self, enabled: bool)
pub fn set_enabled(&self, enabled: bool)
Enable or disable this submenu.
Set this submenu as the Window menu for the application on macOS.
This will cause macOS to automatically add window-switching items and certain other items to the menu.
Set this submenu as the Help menu for the application on macOS.
This will cause macOS to automatically add a search box to the menu.
If no menu is set as the Help menu, macOS will automatically use any menu which has a title matching the localized word “Help”.
Sourcepub fn set_native_icon(&self, _icon: Option<NativeIcon>)
pub fn set_native_icon(&self, _icon: Option<NativeIcon>)
Change this menu item icon to a native image or remove it.
§Platform-specific:
- Windows / Linux: Unsupported.
Trait Implementations§
NSView. Read moreSubmenu, and returns None if it wasn’t.Menu, and returns None if it wasn’t.Menu, and panics if it wasn’t.Submenu, and panics if it wasn’t.Auto Trait Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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