wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item) { if (m_menuWidget) { // this is a dynamic Append #ifndef XmNpositionIndex wxCHECK_MSG( pos == GetMenuItemCount(), -1, wxT("insert not implemented")); #endif item->CreateItem(m_menuWidget, GetMenuBar(), m_topLevelMenu, pos); } if ( item->IsSubMenu() ) { item->GetSubMenu()->m_topLevelMenu = m_topLevelMenu; } return pos == GetMenuItemCount() ? wxMenuBase::DoAppend(item) : wxMenuBase::DoInsert(pos, item); }
int RecursiveDeleteMenu(HMENU hMenu) { int cnt = GetMenuItemCount(hMenu); for (int i = 0; i < cnt; i++) { HMENU submenu = GetSubMenu(hMenu, 0); if (submenu) DestroyMenu(submenu); DeleteMenu(hMenu, 0, MF_BYPOSITION); } return 0; }
static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *lpmii) { TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)lpmii->dwItemData), *p; if (pimi == NULL) return; // check for separator before if (uItem) { UINT fType = GetMenuItemTypeData(hMenu, uItem - 1, p); if (p != NULL && fType != MFT_SEPARATOR) { if ((p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL)) { // but might be supposed to be after the next one instead if (!(uItem < GetMenuItemCount(hMenu) && GetMenuItemType(hMenu, uItem) == MFT_SEPARATOR)) InsertSeparator(hMenu, uItem); uItem++; } } } // check for separator after if (uItem < GetMenuItemCount(hMenu)) { UINT fType = GetMenuItemTypeData(hMenu, uItem, p); if (p != NULL && fType != MFT_SEPARATOR) if ((p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL)) InsertSeparator(hMenu, uItem); } // create local copy *lpmii so we can change some flags MENUITEMINFO mii = *lpmii; int count = GetMenuItemCount(hMenu); if (count != 0 && (count % 33) == 0 && pimi->mi.root != NULL) { if (!(mii.fMask & MIIM_FTYPE)) mii.fType = 0; mii.fMask |= MIIM_FTYPE; mii.fType |= MFT_MENUBARBREAK; } if (!pimi->CustomName) mii.dwTypeData = GetMenuItemText(pimi); InsertMenuItem(hMenu, uItem, TRUE, &mii); }
HMENU GetSubMenuByChildID(HMENU menu, UINT id) { int i, j, items, subitems, cur_id; HMENU m; items = GetMenuItemCount(menu); for (i=0; i<items; i++) { if (m = GetSubMenu(menu, i)) { subitems = GetMenuItemCount(m); for (j=0; j<subitems; j++) { cur_id = GetMenuItemID(m, j); if (cur_id == id) { return m; } } } } return NULL; }
// function appends a new item or submenu to the menu // append a new item or submenu to the menu bool wxMenu::DoInsertOrAppend(wxMenuItem *item, size_t pos) { wxASSERT_MSG( item != NULL, wxT("can't append NULL item to the menu") ); GetPeer()->InsertOrAppend( item, pos ); wxMenu *pSubMenu = item->GetSubMenu() ; if ( pSubMenu != NULL ) { wxASSERT_MSG( pSubMenu->GetHMenu() != NULL , wxT("invalid submenu added")); pSubMenu->m_menuParent = this ; pSubMenu->DoRearrange(); } else if ( item->GetId() == idMenuTitle ) { item->GetMenu()->Enable( idMenuTitle, false ); } if ( pos == (size_t)-1 ) { pos = GetMenuItemCount() - 1; } // Update radio groups if we're inserting a new menu item. // Inserting radio and non-radio item has a different impact // on radio groups, so we have to handle each case separately. // (Inserting a radio item in the middle of existing groups extends this group, // but inserting a non-radio item breaks it into two subgroups.) bool check = false; if ( item->IsRadio() ) { if ( !m_radioData ) m_radioData = new wxMenuRadioItemsData; if ( m_radioData->UpdateOnInsertRadio(pos) ) check = true; // ensure that we have a checked item in the radio group } else if ( m_radioData ) { if ( m_radioData->UpdateOnInsertNonRadio(pos) ) { // One of the existing groups has been split into two subgroups. wxFAIL_MSG(wxS("Inserting non-radio item inside a radio group?")); } } // if we're already attached to the menubar, we must update it if ( IsAttached() && GetMenuBar()->IsAttached() ) GetMenuBar()->Refresh(); if ( check ) item->Check(true); return true ; }
static void add_user_menu_items(HMENU menu) { MENUITEMINFO mii; memset(&mii, 0, sizeof(MENUITEMINFO)); mii.type = MFT_SEPARATOR; InsertMenuItem(menu, GetMenuItemCount(menu), TRUE, &mii); #if 1 memset(&mii, 0, sizeof(MENUITEMINFO)); mii.type = MFT_STRING; mii.hsubmenu = 0; mii.id = IDM_POP_NEW_TAB; mii.state = MFS_ENABLED; mii.cch = strlen("New Tab"); mii.typedata = (DWORD)"New Tab"; InsertMenuItem(menu, GetMenuItemCount(menu), TRUE, &mii); #endif memset(&mii, 0, sizeof(MENUITEMINFO)); mii.type = MFT_STRING; mii.hsubmenu = 0; mii.id = IDM_POP_SAVE_AS; mii.state = MFS_ENABLED; mii.cch = strlen("Save As..."); mii.typedata = (DWORD)"Save As..."; InsertMenuItem(menu, GetMenuItemCount(menu), TRUE, &mii); memset(&mii, 0, sizeof(MENUITEMINFO)); mii.type = MFT_STRING; mii.hsubmenu = 0; mii.id = IDM_POP_CLOSE_TAB; int count = SendMessage(propsheet_hwnd, PSM_GETPAGECOUNT, 0, 0); if (count >1) { mii.state &= ~MFS_DISABLED; mii.state |= MFS_ENABLED; } else { mii.state &= ~MFS_ENABLED; mii.state |= MFS_DISABLED; } mii.cch = strlen("Close Tab"); mii.typedata = (DWORD)"Close Tab"; InsertMenuItem(menu, GetMenuItemCount(menu), TRUE, &mii); }
//********************************************************************************************************* void CBCGPBaseFilterPopupMenu::RecalcLayout(BOOL bNotify /* = TRUE */) { CBCGPPopupMenu::RecalcLayout(bNotify); if (m_wndMenuBar.GetSafeHwnd() != NULL) { m_wndMenuBar.m_arColumns.RemoveAll(); m_wndMenuBar.AdjustLayout(); } if (m_wndList.GetSafeHwnd() == NULL) { return; } const int nShadowSize = CBCGPToolBar::IsCustomizeMode () ? 0 : m_iShadowSize; const int nBorderSize = GetBorderSize(); CRect rectClient; GetClientRect(rectClient); rectClient.DeflateRect (nBorderSize, nBorderSize); if (GetExStyle() & WS_EX_LAYOUTRTL) { rectClient.left += nShadowSize; } else { rectClient.right -= nShadowSize; } rectClient.top += m_nMenuBarHeight; rectClient.bottom -= nShadowSize; #ifndef _BCGSUITE_ rectClient.left += m_wndMenuBar.GetGutterWidth(); #endif if (!m_rectResize.IsRectEmpty()) { if (m_bIsResizeBarOnTop) { rectClient.top += m_rectResize.Height(); } else { rectClient.bottom -= m_rectResize.Height(); } } m_wndList.SetWindowPos(NULL, rectClient.left, rectClient.top, rectClient.Width(), rectClient.Height(), SWP_NOZORDER | SWP_NOACTIVATE); m_wndList.m_bIsEmptyMenu = GetMenuItemCount() == 0; }
void SWELL_Menu_AddMenuItem(HMENU hMenu, const char *name, int idx, int flags) { MENUITEMINFO mi={sizeof(mi),MIIM_ID|MIIM_STATE|MIIM_TYPE,MFT_STRING, (flags)?MFS_GRAYED:0,idx,NULL,NULL,NULL,0,(char *)name}; if (!name) { mi.fType = MFT_SEPARATOR; mi.fMask&=~(MIIM_STATE|MIIM_ID); } InsertMenuItem(hMenu,GetMenuItemCount(hMenu),TRUE,&mi); }
// _flags: &1=marker, &2=region void FillMarkerRegionMenu(ReaProject* _proj, HMENU _menu, int _msgStart, int _flags, UINT _uiState) { int x=0, lastx=0; char desc[SNM_MAX_MARKER_NAME_LEN]=""; while ((x = EnumMarkerRegionDesc(_proj, x, desc, SNM_MAX_MARKER_NAME_LEN, _flags, true, true, true))) { if (*desc) AddToMenu(_menu, desc, _msgStart+lastx, -1, false, _uiState); lastx=x; } if (!GetMenuItemCount(_menu)) AddToMenu(_menu, __LOCALIZE("(No region!)","sws_menu"), 0, -1, false, MF_GRAYED); }
void MainWnd::OnContextMenu(CWnd* pWnd, CPoint point) { winMouseOn(); if(theApp.skin) { if(theApp.popup == NULL) { theApp.winAccelMgr.UpdateMenu(theApp.menu); theApp.popup = CreatePopupMenu(); if(theApp.menu != NULL) { int count = GetMenuItemCount(theApp.menu); OSVERSIONINFO info; info.dwOSVersionInfoSize = sizeof(info); GetVersionEx(&info); if(info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { for(int i = 0; i < count; i++) { char buffer[256]; MENUITEMINFO info; ZeroMemory(&info, sizeof(info)); info.cbSize = sizeof(info) - sizeof(HBITMAP); info.fMask = MIIM_STRING | MIIM_SUBMENU; info.dwTypeData = buffer; info.cch = 256; if(!GetMenuItemInfo(theApp.menu, i, MF_BYPOSITION, &info)) { } if(!AppendMenu(theApp.popup, MF_POPUP|MF_STRING, (UINT)info.hSubMenu, buffer)) { } } } else { for(int i = 0; i < count; i++) { wchar_t buffer[256]; MENUITEMINFOW info; ZeroMemory(&info, sizeof(info)); info.cbSize = sizeof(info) - sizeof(HBITMAP); info.fMask = MIIM_STRING | MIIM_SUBMENU; info.dwTypeData = buffer; info.cch = 256; if(!GetMenuItemInfoW(theApp.menu, i, MF_BYPOSITION, &info)) { } if(!AppendMenuW(theApp.popup, MF_POPUP|MF_STRING, (UINT)info.hSubMenu, buffer)) { } } } } } int x = point.x; int y = point.y; if(x == -1 && y == -1) { x = (theApp.dest.left + theApp.dest.right) / 2; y = (theApp.dest.top + theApp.dest.bottom) / 2; } if(!TrackPopupMenu(theApp.popup, 0, x, y, 0, m_hWnd, NULL)) { } } }
/* find index in menu bar; returns -1 if not installed */ static int get_menu_position(HMENU addr) { int n, i; if (addr == NULL) return -1; n = GetMenuItemCount(hMainMenu); for (i = 0; i < n; i++) if (addr == GetSubMenu(hMainMenu, i)) return(i); return(-1); }
static int mh_additem (lua_State* l) { menu* m = lua_touserdata(l,1); if (!m->sub) return 0; int k = 2, pos = 0; if (lua_isnumber(l,k)) pos = lua_tointeger(l,k++); if (pos==0) pos = -1; else if (pos>0) pos--; else if (pos<-1) pos += GetMenuItemCount(m->menu); const char* str = luaL_checkstring(l,k++); const char* sShortcut = NULL; if (lua_isstring(l,k)) sShortcut = lua_tostring(l,k++); else if (lua_isnoneornil(l,k)) k++; if (!lua_isfunction(l,k)) luaL_typerror(l, k, "function"); void* p = lua_topointer(l,k++); if (!p) return 0; const wchar_t* wstr = strcvt(str, CP_UTF8, CP_UTF16, NULL); int command = addCustomCommand(p) + IDM_CUSTOMCOMMAND; int kFlags = 0, key=0; if (parseKeyName(sShortcut, &kFlags, &key)) { addAccelerator(kFlags, key, command); const wchar_t* z = mh_buildLabel(wstr, kFlags, key); if (z!=wstr) { free(wstr); wstr = z; }} menu it; it.sub = FALSE; it.parent = m->menu; it.origin = m->origin; it.position = (pos==-1? GetMenuItemCount(m->menu) -1 : pos); it.command = command; InsertMenu(m->menu, pos, MF_STRING | MF_BYPOSITION, command, wstr); DrawMenuBar(win); free(wstr); lua_pushlightuserdata(l, command); lua_pushluafunction(l, p); lua_rawset(l, LUA_REGISTRYINDEX); lua_settop(l,0); lua_pushfulluserdata(l, &it, sizeof(it), "menuhandle"); return 1; }
unsigned int Win32Popup::findInsertionPoint( unsigned int pos ) const { // For this simple algorithm, we rely on the fact that in the final state // of the menu, the ID of each item is equal to its position in the menu int i = 0; while( i < GetMenuItemCount( m_hMenu ) && GetMenuItemID( m_hMenu, i ) < pos ) { i++; } return i; }
int SWSGetMenuPosFromID(HMENU hMenu, UINT id) { // Replacement for deprecated windows func GetMenuPosFromID MENUITEMINFO mi={sizeof(MENUITEMINFO),}; mi.fMask = MIIM_ID; for (int i = 0; i < GetMenuItemCount(hMenu); i++) { GetMenuItemInfo(hMenu, i, true, &mi); if (mi.wID == id) return i; } return -1; }
static int EventArea_DrawWorker(HWND hWnd, HDC hDC) { RECT rc; HFONT hOldFont; GetClientRect(hWnd, &rc); if (g_CluiData.fDisableSkinEngine) sttDrawEventAreaBackground(hWnd, hDC, &rc); else SkinDrawGlyph(hDC, &rc, &rc, "Main,ID=EventArea"); hOldFont = g_clcPainter.ChangeToFont(hDC, NULL, FONTID_EVENTAREA, NULL); SetBkMode(hDC, TRANSPARENT); int iCount = GetMenuItemCount(g_CluiData.hMenuNotify); rc.left += 26; if (g_CluiData.hUpdateContact != 0) { TCHAR *szName = pcli->pfnGetContactDisplayName(g_CluiData.hUpdateContact, 0); int iIcon = cli_GetContactIcon(g_CluiData.hUpdateContact); ske_ImageList_DrawEx(g_himlCListClc, iIcon, hDC, rc.left, (rc.bottom + rc.top - GetSystemMetrics(SM_CYSMICON)) / 2, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), CLR_NONE, CLR_NONE, ILD_NORMAL); rc.left += 18; ske_DrawText(hDC, szName, -1, &rc, DT_VCENTER | DT_SINGLELINE); ske_ImageList_DrawEx(g_himlCListClc, (int)g_CluiData.iIconNotify, hDC, 4, (rc.bottom + rc.top - 16) / 2, 16, 16, CLR_NONE, CLR_NONE, ILD_NORMAL); } else if (iCount > 0) { MENUITEMINFO mii = { 0 }; struct NotifyMenuItemExData *nmi; TCHAR *szName; int iIcon; mii.cbSize = sizeof(mii); mii.fMask = MIIM_DATA; GetMenuItemInfo(g_CluiData.hMenuNotify, iCount - 1, TRUE, &mii); nmi = (struct NotifyMenuItemExData *) mii.dwItemData; szName = pcli->pfnGetContactDisplayName(nmi->hContact, 0); iIcon = cli_GetContactIcon(nmi->hContact); ske_ImageList_DrawEx(g_himlCListClc, iIcon, hDC, rc.left, (rc.bottom + rc.top - GetSystemMetrics(SM_CYSMICON)) / 2, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), CLR_NONE, CLR_NONE, ILD_NORMAL); rc.left += 18; ske_ImageList_DrawEx(g_himlCListClc, nmi->iIcon, hDC, 4, (rc.bottom + rc.top) / 2 - 8, 16, 16, CLR_NONE, CLR_NONE, ILD_NORMAL); ske_DrawText(hDC, szName, -1, &rc, DT_VCENTER | DT_SINGLELINE); } else { HICON hIcon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 16, 16, 0); TCHAR *ptszEvents = TranslateT("No events"); ske_DrawText(hDC, ptszEvents, (int)mir_tstrlen(ptszEvents), &rc, DT_VCENTER | DT_SINGLELINE); ske_DrawIconEx(hDC, 4, (rc.bottom + rc.top - 16) / 2, hIcon, 16, 16, 0, 0, DI_NORMAL | DI_COMPAT); DestroyIcon(hIcon); } ske_ResetTextEffect(hDC); SelectObject(hDC, hOldFont); return 0; }
OMenu::~OMenu() { if (::IsMenu(m_hMenu)) { for (int i = 0; i < GetMenuItemCount(); ++i) CheckOwnerDrawn(i, TRUE); } else { // How can we end up here??? it sure happens sometimes.. for (OMenuItem::Iter i = items.begin(); i != items.end(); ++i) { delete *i; } } //pUnMap(); }
/*static*/ VOID CreateVdmMenu(HANDLE ConOutHandle) { hConsoleMenu = ConsoleMenuControl(ConOutHandle, ID_SHOWHIDE_MOUSE, ID_VDM_QUIT); if (hConsoleMenu == NULL) return; VdmMenuPos = GetMenuItemCount(hConsoleMenu); AppendMenuItems(hConsoleMenu, VdmMainMenuItems); DrawMenuBar(GetConsoleWindow()); }
int CCustomMenu::GetTopMenuWidth() { int Count = GetMenuItemCount(); int width = 0; CRect rc; for (int i=0; i<Count; i++) { ::GetMenuItemRect(AfxGetMainWnd()->m_hWnd,m_hMenu,i,rc); width += rc.Width(); } return width; }
OMenu::~OMenu() { if (::IsMenu(m_hMenu)) { while(GetMenuItemCount() != 0) RemoveMenu(0, MF_BYPOSITION); } else { // How can we end up here??? it sure happens sometimes.. for (OMenuItem::Iter i = items.begin(); i != items.end(); ++i) { delete *i; } } //pUnMap(); }
void DestroyTrayMenu(HMENU hMenu) { int i, cnt; cnt = GetMenuItemCount(hMenu); for (i = 0; i < cnt; ++i) { HMENU hSubMenu = GetSubMenu(hMenu, i); if (hSubMenu == hMainStatusMenu || hSubMenu == hMainMenu) RemoveMenu(hMenu, i--, MF_BYPOSITION); } DestroyMenu(hMenu); }
INT GetIndexOfItem(HMENU menu, UINT id) { for (int i = GetMenuItemCount(menu) - 1; i >= 0; i--) { int x = GetMenuItemID(menu, i); if (id == x) { return i; } } return -1; }
BOOL Show(HINSTANCE hInstance, int nCmdShow) { hInst = hInstance; // Store instance handle in our global variable int zoom = g_Config.iWindowZoom; if (zoom < 1) zoom = 1; if (zoom > 4) zoom = 4; RECT rc,rcOrig; GetWindowRectAtZoom(zoom, rcOrig, rc); u32 style = WS_OVERLAPPEDWINDOW; hwndMain = CreateWindowEx(0,szWindowClass, "", style, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, NULL, NULL, hInstance, NULL); SetTimer(hwndMain, TIMER_CURSORUPDATE, CURSORUPDATE_INTERVAL_MS, 0); SetPlaying(0); if (!hwndMain) return FALSE; menu = GetMenu(hwndMain); #ifdef FINAL RemoveMenu(menu,2,MF_BYPOSITION); RemoveMenu(menu,2,MF_BYPOSITION); #endif MENUINFO info; ZeroMemory(&info,sizeof(MENUINFO)); info.cbSize = sizeof(MENUINFO); info.cyMax = 0; info.dwStyle = MNS_CHECKORBMP; info.fMask = MIM_STYLE; for (int i = 0; i < GetMenuItemCount(menu); i++) { SetMenuInfo(GetSubMenu(menu,i),&info); } hwndDisplay = CreateWindowEx(0,szDisplayClass,TEXT(""), WS_CHILD|WS_VISIBLE, 0,0,/*rcOrig.left,rcOrig.top,*/rcOrig.right-rcOrig.left,rcOrig.bottom-rcOrig.top,hwndMain,0,hInstance,0); ShowWindow(hwndMain, nCmdShow); //accept dragged files DragAcceptFiles(hwndMain, TRUE); #if ENABLE_TOUCH RegisterTouchWindow(hwndDisplay, TWF_WANTPALM); #endif SetFocus(hwndMain); SetFocus(hwndDisplay); return TRUE; }
HMENU CUserMeetingDlg::FindMenuGroup(HMENU hParent, LPCTSTR lpszMenu) { for ( int nItem = GetMenuItemCount( hParent ); nItem > 0; nItem-- ) { TCHAR strItem[64]; GetMenuString( hParent, nItem - 1, strItem, 64, MF_BYPOSITION ); if ( ! _tcsicmp( strItem, lpszMenu ) ) return GetSubMenu( hParent, nItem - 1 ); } return NULL; }
int GetMenuItemPosition(HMENU menu, UINT id) { for (int i = 0; i < GetMenuItemCount(menu); i++) { MENUITEMINFO info = { 0 }; info.cbSize = sizeof(info); info.fMask = MIIM_ID; GetMenuItemInfo(menu, i, TRUE, &info); if (info.wID == id) return i; } ATLASSERT(FALSE); return -1; }
wxMenuItem* wxMenu::DoAppend(wxMenuItem *item) { wxCHECK_MSG( item, NULL, wxT("NULL item in wxMenu::DoAppend") ); bool check = false; if ( item->GetKind() == wxITEM_RADIO ) { int count = GetMenuItemCount(); if ( m_startRadioGroup == -1 ) { // start a new radio group m_startRadioGroup = count; // for now it has just one element item->SetAsRadioGroupStart(); item->SetRadioGroupEnd(m_startRadioGroup); // ensure that we have a checked item in the radio group check = true; } else // extend the current radio group { // we need to update its end item item->SetRadioGroupStart(m_startRadioGroup); wxMenuItemList::compatibility_iterator node = GetMenuItems().Item(m_startRadioGroup); if ( node ) { node->GetData()->SetRadioGroupEnd(count); } else { wxFAIL_MSG( wxT("where is the radio group start item?") ); } } } else // not a radio item { EndRadioGroup(); } if ( !wxMenuBase::DoAppend(item) || !DoInsertOrAppend(item) ) return NULL; if ( check ) // check the item initially item->Check(true); return item; }
BOOL Show(HINSTANCE hInstance) { hInst = hInstance; // Store instance handle in our global variable. RECT rc = DetermineWindowRectangle(); u32 style = WS_OVERLAPPEDWINDOW; hwndMain = CreateWindowEx(0,szWindowClass, L"", style, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, hInstance, NULL); if (!hwndMain) return FALSE; SetWindowLong(hwndMain, GWL_EXSTYLE, WS_EX_APPWINDOW); RECT rcClient; GetClientRect(hwndMain, &rcClient); hwndDisplay = CreateWindowEx(0, szDisplayClass, L"", WS_CHILD | WS_VISIBLE, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, hwndMain, 0, hInstance, 0); if (!hwndDisplay) return FALSE; menu = GetMenu(hwndMain); MENUINFO info; ZeroMemory(&info,sizeof(MENUINFO)); info.cbSize = sizeof(MENUINFO); info.cyMax = 0; info.dwStyle = MNS_CHECKORBMP; info.fMask = MIM_STYLE; for (int i = 0; i < GetMenuItemCount(menu); i++) { SetMenuInfo(GetSubMenu(menu,i), &info); } UpdateMenus(); // Accept dragged files. DragAcceptFiles(hwndMain, TRUE); hideCursor = true; SetTimer(hwndMain, TIMER_CURSORUPDATE, CURSORUPDATE_INTERVAL_MS, 0); ToggleFullscreen(hwndMain, g_Config.bFullScreen); W32Util::MakeTopMost(hwndMain, g_Config.bTopMost); touchHandler.registerTouchWindow(hwndDisplay); WindowsRawInput::Init(); SetFocus(hwndMain); return TRUE; }
/*-------------------------------------------------- HMENU is start menu ? ----------------------------------------------------*/ BOOL IsStartMenu(HMENU hmenu) { int i, count, id; count = GetMenuItemCount(hmenu); for(i = 0; i < count; i++) { id = GetMenuItemID(hmenu, i); // "Help" item if(id == 503) return TRUE; } return FALSE; }
static int AddBookMark(char *Path) { HMENU hMenu; int MarkID; int Sts; Sts = FAIL; hMenu = GetSubMenu(GetMenu(GetMainHwnd()), BMARK_SUB_MENU); MarkID = (GetMenuItemCount(hMenu) - DEFAULT_BMARK_ITEM) + MENU_BMARK_TOP; if(AppendMenu(hMenu, MF_STRING, MarkID, Path) == TRUE) Sts = SUCCESS; return(Sts); }
static void WdeEnableAllMenuItems( HMENU menu, Bool enable ) { int count; count = GetMenuItemCount( menu ); for( count--; count >= 0; count-- ) { if( enable ) { EnableMenuItem( menu, count, MF_ENABLED | MF_BYPOSITION ); } else { EnableMenuItem( menu, count, MF_GRAYED | MF_BYPOSITION ); } } }
/*static*/ int Win32MenuItem::GetNativeMenuItemPosition(NativeItemBits* bits) { int count = GetMenuItemCount(bits->parentMenu); for (int i = 0; i < count; i++) { if ((bits->submenu && GetSubMenu(bits->parentMenu, i) == bits->submenu) || (bits->id == GetMenuItemID(bits->parentMenu, i))) return i; } throw ValueException::FromString("Could not find native item index in native menu."); }