Struct minifb::MenuItem
[−]
[src]
pub struct MenuItem<'a> { pub id: usize, pub label: String, pub enabled: bool, pub key: Key, pub modifier: usize, // some fields omitted }
Holds info about each item in a menu
Fields
id: usize
label: String
enabled: bool
key: Key
modifier: usize
Methods
impl<'a> MenuItem<'a>
[src]
pub fn new(name: &str, id: usize) -> MenuItem
[src]
Creates a new menu item
pub fn shortcut(self, key: Key, modifier: usize) -> Self
[src]
Sets a shortcut key and modifer (and returns itself)
Examples
ⓘThis example is not tested
menu.add_item("test", 1).shortcut(Key::A, 0).build()
pub fn separator(self) -> Self
[src]
Sets item to a separator
Examples
ⓘThis example is not tested
menu.add_item("", 0).separator().build()
Notice that it's usually easier to just call menu.add_separator()
directly
pub fn enabled(self, enabled: bool) -> Self
[src]
Sets the menu item disabled/or not
Examples
ⓘThis example is not tested
menu.add_item("test", 1).enabled(false).build()
pub fn build(&mut self) -> MenuItemHandle
[src]
Must be called to finalize building of a menu item when started with menu.add_item()
Examples
ⓘThis example is not tested
menu.add_item("test", 1).enabled(false).build()