Skip to main content

MenuBar

Trait MenuBar 

Source
pub trait MenuBar {
    // Required methods
    fn set_menus(&self, menus: &[MenuEntry]);
    fn perform_key_equivalent(&self, key: &KeyData) -> bool;
}
Expand description

The app’s menu bar: macOS’s. Where the system has none, the platform answers None and the app draws its own.

Required Methods§

Source

fn set_menus(&self, menus: &[MenuEntry])

Replaces the app’s menu bar whole: its top-level menus, each a MenuEntry::Submenu. A choice reaches the app as EmbedderClient::menu_selected(id).

Source

fn perform_key_equivalent(&self, key: &KeyData) -> bool

Offers the menu bar a key-down the app kept back when it came and has since left unhandled, as Chrome sends on a key its page did not consume; answers whether an item took it, which then reaches the app as EmbedderClient::menu_selected. For an app that answers a key later than the host must, such as one that waits on another thread: the host’s own order, the framework first and the menu bar after, needs no call.

key is the key as the host reported it (EmbedderClient::key_data), which the framework’s key event gives back. The host finds the system’s own event by it, which carries the keyboard layout and the modifiers, and keeps it only a short while: once that event is gone, or the key was offered already, the answer is false.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§