[][src]Struct minifb::MenuItem

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: usizelabel: Stringenabled: boolkey: Keymodifier: usize

Implementations

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

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

pub fn separator(self) -> Self[src]

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

pub fn enabled(self, enabled: bool) -> Self[src]

Sets the menu item disabled/or not

Examples

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

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

Trait Implementations

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

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

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

Auto Trait Implementations

impl<'a> RefUnwindSafe for MenuItem<'a>

impl<'a> Send for MenuItem<'a>

impl<'a> Sync for MenuItem<'a>

impl<'a> Unpin for MenuItem<'a>

impl<'a> !UnwindSafe for MenuItem<'a>

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> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,