- Timestamp:
- Nov 21, 2001, 12:51:39 PM (24 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/button.cpp
r6605 r7409 1 /* $Id: button.cpp,v 1.4 3 2001-08-29 10:37:25 phallerExp $ */1 /* $Id: button.cpp,v 1.44 2001-11-21 11:51:37 sandervl Exp $ */ 2 2 /* File: button.cpp -- Button type widgets 3 3 * … … 336 336 337 337 DefWindowProcA(hwnd,WM_SETTEXT,wParam,lParam); 338 #ifdef __WIN32OS2__ 339 BUTTONINFO* infoPtr = (BUTTONINFO*)GetInfoPtr(hwnd); 340 if ((dwStyle & 0x0f) == BS_GROUPBOX) { 341 RECT rc; 342 TEXTMETRICA tm; 343 HDC hdc = GetDC(hwnd); 344 int fh1 = 0, fh2 = 0; 345 346 // select old font (if exists) 347 if (infoPtr->hFont) { 348 SelectObject (hdc, infoPtr->hFont); 349 GetTextMetricsA (hdc, &tm); 350 fh1 = tm.tmHeight; 351 } 352 // select new font (if exists) 353 if (wParam) { 354 SelectObject (hdc, wParam); 355 GetTextMetricsA (hdc, &tm); 356 fh2 = tm.tmHeight; 357 } 358 // Erases top border line and (old) text background 359 GetClientRect(hwnd, &rc); 360 rc.bottom = rc.top + max( fh1, fh2) + 1; 361 HBRUSH hbr = GetControlBrush( hwnd, hdc, CTLCOLOR_STATIC ); 362 FillRect(hdc, &rc, hbr); 363 ReleaseDC(hwnd,hdc); 364 } 365 #endif 366 338 367 if (dwStyle & WS_VISIBLE) PAINT_BUTTON(hwnd,dwStyle & 0x0f,ODA_DRAWENTIRE); 339 368 -
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 { -
trunk/src/user32/win32wbase.cpp
r7371 r7409 1 /* $Id: win32wbase.cpp,v 1.30 0 2001-11-17 17:49:38 sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.301 2001-11-21 11:51:38 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 3705 3705 3706 3706 case GWL_ID: 3707 dprintf(("GWL_ID old %x, new %x", getWindowId(), value)); 3707 3708 oldval = getWindowId(); 3708 3709 setWindowId(value); -
trunk/src/user32/win32wbase.h
r7338 r7409 1 /* $Id: win32wbase.h,v 1.13 3 2001-11-14 14:36:03 phallerExp $ */1 /* $Id: win32wbase.h,v 1.134 2001-11-21 11:51:38 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 120 120 !(style & (WS_CHILD | WS_POPUP)) 121 121 122 #define HAS_MENU() (!(getStyle() & WS_CHILD) && ( GetMenu() != 0))122 #define HAS_MENU() (!(getStyle() & WS_CHILD) && (getWindowId() != 0)) 123 123 124 124 #define STATE_INIT 0 //initial state … … 239 239 PVOID getExtraPtr() { return pExtra; }; 240 240 241 HMENU GetMenu() { return dwIDMenu; };242 VOID SetMenu(HMENU newMenu) { dwIDMenu = newMenu; };243 241 void SetSysMenu(HMENU hSystemMenu) { hSysMenu = hSystemMenu; }; 244 242 HMENU GetSysMenu() { return hSysMenu; } -
trunk/src/user32/winaccel.cpp
r6762 r7409 1 /* $Id: winaccel.cpp,v 1. 9 2001-09-19 15:39:52sandervl Exp $ */1 /* $Id: winaccel.cpp,v 1.10 2001-11-21 11:51:39 sandervl Exp $ */ 2 2 /* 3 3 * Win32 accelerator key functions for OS/2 … … 91 91 } 92 92 93 hMenu = (window->getStyle() & WS_CHILD) ? 0 : (HMENU)window->GetMenu();93 hMenu = GetMenu(hWnd); 94 94 95 95 iSysStat = (window->GetSysMenu()) ? GetMenuState(GetSubMenu(window->GetSysMenu(), 0),
Note:
See TracChangeset
for help on using the changeset viewer.