pub fn add_item(
        &mut self,
        id: u32,
        text: &str,
        key: Option<&HotKey>,
        enabled: bool,
        selected: bool,
    ) {
        let mut anno_text = text.to_string();
        if let Some(key) = key {
            anno_text.push('\t');
            format_hotkey(key, &mut anno_text);
        }
        unsafe {
            let mut flags = MF_STRING;
            if !enabled {
                flags |= MF_GRAYED;
            }
            if selected {
                flags |= MF_CHECKED;
            }
            AppendMenuW(
                self.hmenu,
                flags,
                id as UINT_PTR,
                anno_text.to_wide().as_ptr(),
            );
        }

        if let Some(key) = key {
            if let Some(accel) = convert_hotkey(id, key) {
                self.accels.insert(id, accel);
            }
        }
    }
/// Add an item to the menu.
Add an item to the menu.
Add an item to the menu .
pub fn add_item(
        &mut self,
        id: u32,
        text: &str,
        key: Option<&HotKey>,
        enabled: bool,
        selected: bool,
    ) {
        let mut anno_text = text.to_string();
        if let Some(key) = key {
            anno_text.push('\t');
            format_hotkey(key, &mut anno_text);
        }
        unsafe {
            let mut flags = MF_STRING;
            if !enabled {
                flags |= MF_GRAYED;
            }
            if selected {
                flags |= MF_CHECKED;
            }
            AppendMenuW(
                self.hmenu,
                flags,
                id as UINT_PTR,
                anno_text.to_wide().as_ptr(),
            );
        }
        if let Some(key) = key {
            if let Some(accel) = convert_hotkey(id, key) {
                self.accels.insert(id, accel);
            }
        }
    }
pub fn add_item ( & mut self , id : u32 , text : & str , key : Option < & HotKey > , enabled : bool , selected : bool , ) { let mut anno_text = text . to_string ( ) ; if let Some ( key ) = key { anno_text . push ( '\t' ) ; format_hotkey ( key , & mut anno_text ) ; } unsafe { let mut flags = MF_STRING ; if ! enabled { flags |= MF_GRAYED ; } if selected { flags |= MF_CHECKED ; } AppendMenuW ( self . hmenu , flags , id as UINT_PTR , anno_text . to_wide ( ) . as_ptr ( ) , ) ; } if let Some ( key ) = key { if let Some ( accel ) = convert_hotkey ( id , key ) { self . accels . insert ( id , accel ) ; } } }
Add an item to the menu.
Add an item to the menu .
&mut self
id
u32
text
&str
key
Option<&HotKey>
enabled
bool
selected
bool
&mut self
id
u32
text
&str
key
Option<&HotKey>
enabled
bool
selected
bool