[][src]Struct druid_shell::Menu

pub struct 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]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> RoundFrom<T> for T

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.