Changeset 7409 for trunk/src/user32/menu.cpp
- Timestamp:
- Nov 21, 2001, 12:51:39 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/menu.cpp
r7195 r7409 1 /* $Id: menu.cpp,v 1. 39 2001-10-24 15:41:53sandervl Exp $*/1 /* $Id: menu.cpp,v 1.40 2001-11-21 11:51:37 sandervl Exp $*/ 2 2 /* 3 3 * Menu functions … … 302 302 //#define USER_HEAP_FREE(handle) HeapFree(GetProcessHeap(),0,(LPVOID)handle) 303 303 304 HMENU getMenu(HWND hwnd)305 {306 Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);307 308 if(win32wnd) {309 HMENU hmenu = win32wnd->GetMenu();310 RELEASE_WNDOBJ(win32wnd);311 return hmenu;312 }313 return (HMENU)0;314 }315 316 VOID setMenu(HWND hwnd,HMENU hMenu)317 {318 Win32BaseWindow *win32wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);319 320 if (win32wnd) {321 win32wnd->SetMenu(hMenu);322 RELEASE_WNDOBJ(win32wnd);323 }324 }325 326 304 327 305 /*********************************************************************** … … 1468 1446 HFONT hfontOld = 0; 1469 1447 1470 lppop = MENU_GetMenu( getMenu(hwnd));1448 lppop = MENU_GetMenu(GetMenu(hwnd)); 1471 1449 if (lppop == NULL || lprect == NULL) 1472 1450 { … … 1518 1496 { 1519 1497 OffsetRect(&lppop->items[i].rect,-lprect->left,-lprect->top); 1520 MENU_DrawMenuItem( hwnd, getMenu(hwnd), GetWindow(hwnd,GW_OWNER),1498 MENU_DrawMenuItem( hwnd,GetMenu(hwnd), GetWindow(hwnd,GW_OWNER), 1521 1499 memDC, &lppop->items[i], lppop->Height, TRUE, ODA_DRAWENTIRE ); 1522 1500 OffsetRect(&lppop->items[i].rect,lprect->left,lprect->top); … … 2266 2244 { 2267 2245 ht = ((ht == HTSYSMENU) && !inMenuBar) ? (UINT)(getSysMenu(menu->hWnd)) 2268 : ((ht == HTMENU) && inMenuBar) ? (UINT)( getMenu(menu->hWnd)) : 0;2246 : ((ht == HTMENU) && inMenuBar) ? (UINT)(GetMenu(menu->hWnd)) : 0; 2269 2247 } 2270 2248 } … … 2561 2539 /* switch to the menu bar */ 2562 2540 2563 if( (GetWindowLongA(pmt->hOwnerWnd,GWL_STYLE) & WS_CHILD) || ! getMenu(pmt->hOwnerWnd) )2541 if( (GetWindowLongA(pmt->hOwnerWnd,GWL_STYLE) & WS_CHILD) || !GetMenu(pmt->hOwnerWnd) ) 2564 2542 { 2565 2543 return FALSE; 2566 2544 } 2567 2545 2568 hNewMenu = getMenu(pmt->hOwnerWnd);2546 hNewMenu = GetMenu(pmt->hOwnerWnd); 2569 2547 if( vk == VK_LEFT ) 2570 2548 { … … 2596 2574 hNewMenu = getSysMenu(hNewWnd); 2597 2575 } 2598 else if( (GetWindowLongA(hNewWnd,GWL_STYLE) & WS_CHILD) || ( getMenu(hNewWnd) != hNewMenu) )2576 else if( (GetWindowLongA(hNewWnd,GWL_STYLE) & WS_CHILD) || (GetMenu(hNewWnd) != hNewMenu) ) 2599 2577 { 2600 2578 /* FIXME: Not sure what to do here, perhaps, … … 3163 3141 void MENU_TrackMouseMenuBar( HWND hWnd, INT ht, POINT pt ) 3164 3142 { 3165 HMENU hMenu = (ht == 0) ? getMenu(hWnd):getSysMenu(hWnd);3143 HMENU hMenu = (ht == 0) ? GetMenu(hWnd):getSysMenu(hWnd); 3166 3144 UINT wFlags = TPM_ENTERIDLEEX | TPM_BUTTONDOWN | TPM_LEFTALIGN | TPM_LEFTBUTTON; 3167 3145 … … 3185 3163 void MENU_TrackMouseMenuBar_MouseMove(HWND hwnd,POINT pt,BOOL OnMenu) 3186 3164 { 3187 HMENU hMenu = getMenu(hwnd);3165 HMENU hMenu = GetMenu(hwnd); 3188 3166 MENUITEM *item = NULL; 3189 3167 RECT rect; … … 3262 3240 3263 3241 if( (GetWindowLongA(hWnd,GWL_STYLE) & (WS_CHILD | WS_MINIMIZE)) || 3264 ! getMenu(hWnd) || vkey == VK_SPACE )3242 !GetMenu(hWnd) || vkey == VK_SPACE ) 3265 3243 { 3266 3244 if( !(GetWindowLongA(hWnd,GWL_STYLE) & WS_SYSMENU) ) return; … … 3270 3248 } 3271 3249 else 3272 hTrackMenu = getMenu(hWnd);3250 hTrackMenu = GetMenu(hWnd); 3273 3251 3274 3252 if (IsMenu( hTrackMenu )) … … 3456 3434 // hwnd, menubarWidth, orgX, orgY ); 3457 3435 3458 if (!(lppop = MENU_GetMenu( getMenu(hwnd))))3436 if (!(lppop = MENU_GetMenu(GetMenu(hwnd)))) 3459 3437 { 3460 3438 return 0; … … 4143 4121 HMENU retvalue; 4144 4122 4145 dprintf(("USER32: GetMenu %x", hWnd)); 4146 4147 if (GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) return 0; 4148 else return getMenu(hWnd); 4123 dprintf(("USER32: GetMenu %x %x", hWnd, GetWindowLongA( hWnd, GWL_ID ))); 4124 4125 if (GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) { 4126 dprintf(("WARNING: window is child; no menu")); 4127 return 0; 4128 } 4129 retvalue = (HMENU)GetWindowLongA( hWnd, GWL_ID ); 4130 if(MENU_GetMenu(retvalue) != NULL) { 4131 return retvalue; 4132 } 4133 return 0; 4149 4134 } 4150 4135 … … 4169 4154 if (GetCapture() == hWnd) ReleaseCapture(); 4170 4155 4171 setMenu(hWnd,hMenu);4172 4156 if (hMenu != 0) 4173 4157 { … … 4182 4166 lpmenu->Height = 0; /* Make sure we recalculate the size */ 4183 4167 } 4168 SetWindowLongA( hWnd, GWL_ID, hMenu ); 4169 4170 #ifdef __WIN32OS2__ 4184 4171 //SvL: This fixes the menu in standard mine sweeper (window isn't visible 4185 4172 // when SetMenu is called) 4186 4173 // if (IsWindowVisible(hWnd)) 4174 #endif 4187 4175 SetWindowPos( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | 4188 4176 SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED ); … … 4202 4190 dprintf(("USER32: GetSubMenu %x %d", hMenu, nPos)); 4203 4191 4192 #ifdef __WIN32OS2__ 4193 if (!(lpmi = MENU_FindItem(&hMenu,(UINT*)&nPos,MF_BYPOSITION))) { 4194 SetLastError(ERROR_INVALID_HANDLE); 4195 return 0; 4196 } 4197 #else 4204 4198 if (!(lpmi = MENU_FindItem(&hMenu,(UINT*)&nPos,MF_BYPOSITION))) return 0; 4199 #endif 4200 4205 4201 if (!(lpmi->fType & MF_POPUP)) return 0; 4206 4202 return lpmi->hSubMenu; … … 4217 4213 dprintf(("USER32: DrawMenuBar %x", hWnd)); 4218 4214 4219 if (!(GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) && getMenu(hWnd))4220 { 4221 lppop = MENU_GetMenu( getMenu(hWnd));4215 if (!(GetWindowLongA(hWnd,GWL_STYLE) & WS_CHILD) && GetMenu(hWnd)) 4216 { 4217 lppop = MENU_GetMenu(GetMenu(hWnd)); 4222 4218 if (lppop == NULL) 4223 4219 {
Note:
See TracChangeset
for help on using the changeset viewer.