void QMenuData::removePopup( QPopupMenu *popup ) { int index = 0; QMenuItem *mi = findPopup( popup, &index ); if ( mi ) removeItemAt( index ); }
void rlc_menu_action(rlc_console c, menu_data *data) { RlcData b = rlc_get_data(c); if ( !data || data->magic != MEN_MAGIC ) return; if ( data->menu ) /* rlc_insert_menu_item() */ { HMENU popup; if ( (popup = findPopup(b, data->menu, NULL)) ) data->rc = insertMenu(popup, data->label, data->before); else data->rc = FALSE; } else /* insert_menu() */ { HMENU mb; HWND hwnd = rlc_hwnd(c); if ( !(mb = GetMenu(hwnd)) ) { data->rc = FALSE; return; } if ( !findPopup(b, data->label, NULL) ) /* already there */ { MENUITEMINFO info; int bid = -1; if ( data->before ) findPopup(b, data->before, &bid); memset(&info, 0, sizeof(info)); info.cbSize = sizeof(info); info.fMask = MIIM_TYPE|MIIM_SUBMENU; info.fType = MFT_STRING; info.hSubMenu = CreatePopupMenu(); info.dwTypeData = (TCHAR *)data->label; info.cch = (int)_tcslen(data->label); InsertMenuItem(mb, bid, TRUE, &info); /* force redraw; not automatic! */ DrawMenuBar(hwnd); } data->rc = TRUE; } }