[−][src]Struct druid_shell::Menu
A menu object.
This may be a window menu, an application menu (macOS) or a context (right-click) menu.
Configuring menus
Currently, a menu and its items cannot be changed once created. If you need to change anything about a menu (for instance, disabling or selecting items) you need to create a new menu with the desired properties.
Methods
impl Menu[src]
pub fn new() -> Menu[src]
Create a new empty window or application menu.
pub fn new_for_popup() -> Menu[src]
Create a new empty context menu.
Some platforms distinguish between these types of menus, and some do not.
pub fn add_dropdown(&mut self, menu: Menu, text: &str, enabled: bool)[src]
Add the provided Menu as a submenu of self, with the provided title.
pub fn add_item(
&mut self,
id: u32,
text: &str,
key: Option<&HotKey>,
enabled: bool,
selected: bool
)[src]
&mut self,
id: u32,
text: &str,
key: Option<&HotKey>,
enabled: bool,
selected: bool
)
Add an item to this menu.
The id should uniquely identify this item. If the user selects this
item, the responsible WindowHandler's command() method will
be called with this id. If the enabled argument is false, the menu
item will be grayed out; the hotkey will also be disabled.
If the selected argument is true, the menu will have a checkmark
or platform appropriate equivalent indicating that it is currently selected.
The key argument is an optional HotKey that will be registered
with the system.
pub fn add_separator(&mut self)[src]
Add a seperator to the menu.
Auto Trait Implementations
impl RefUnwindSafe for Menu
impl !Send for Menu
impl !Sync for Menu
impl Unpin for Menu
impl UnwindSafe for Menu
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, 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>,