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]

fn new(name: &str, id: usize) -> MenuItem

Creates a new menu item

fn shortcut(self, key: Key, modifier: usize) -> Self

Sets a shortcut key and modifer (and returns itself)

Examples

menu.add_item("test", 1).shortcut(Key::A, 0).build()

fn separator(self) -> Self

Sets item to a separator

Examples

menu.add_item("", 0).separator().build()

Notice that it's usually easier to just call menu.add_separator() directly

fn enabled(self, enabled: bool) -> Self

Sets the menu item disabled/or not

Examples

menu.add_item("test", 1).enabled(false).build()

fn build(&mut self) -> MenuItemHandle

Must be called to finialize building of a menu item when started with menu.add_item()

Examples

menu.add_item("test", 1).enabled(false).build()

Trait Implementations

impl<'a> Default for MenuItem<'a>
[src]

fn default() -> Self

Returns the "default value" for a type. Read more

impl<'a> Clone for MenuItem<'a>
[src]

fn clone(&self) -> Self

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more