- Timestamp:
- Jan 2, 2000, 8:30:47 PM (26 years ago)
- Location:
- trunk/src/user32/new
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/controls.cpp
r2290 r2292 1 /* $Id: controls.cpp,v 1.1 3 2000-01-01 14:57:10cbratschi Exp $ */1 /* $Id: controls.cpp,v 1.14 2000-01-02 19:30:42 cbratschi Exp $ */ 2 2 /* File: controls.cpp -- Win32 common controls 3 3 * … … 116 116 117 117 118 BOOL WIDGETS_IsControl(Win32BaseWindow *window, int control)118 BOOL CONTROLS_IsControl(Win32BaseWindow *window, int control) 119 119 { 120 120 if(control >= MAX_CONTROLS || window == NULL || window->getClass() == NULL) -
trunk/src/user32/new/controls.h
r2290 r2292 1 /* $Id: controls.h,v 1. 1 2000-01-01 14:54:51cbratschi Exp $ */1 /* $Id: controls.h,v 1.2 2000-01-02 19:30:42 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 common controls … … 33 33 #define MAX_CONTROLS 12 34 34 35 BOOL WIDGETS_IsControl(Win32BaseWindow *window, int control);35 BOOL CONTROLS_IsControl(Win32BaseWindow *window, int control); 36 36 37 37 -
trunk/src/user32/new/dc.cpp
r2290 r2292 1 /* $Id: dc.cpp,v 1. 6 2000-01-01 14:57:10cbratschi Exp $ */1 /* $Id: dc.cpp,v 1.7 2000-01-02 19:30:42 cbratschi Exp $ */ 2 2 3 3 /* … … 1243 1243 } 1244 1244 dprintf(("ScrollWindow %x %d %d %x %x", hwnd, dx, dy, pScroll, pClip)); 1245 mapWin32ToOS2Rect(window,window->getClientRect (),(PRECTLOS2)&clientRect);1245 mapWin32ToOS2Rect(window,window->getClientRectPtr(),(PRECTLOS2)&clientRect); 1246 1246 //Rectangle could be relative to parent window, so fix this 1247 1247 if(clientRect.yBottom != 0) { -
trunk/src/user32/new/oslibmsgtranslate.cpp
r2291 r2292 1 /* $Id: oslibmsgtranslate.cpp,v 1. 2 2000-01-01 17:07:41cbratschi Exp $ */1 /* $Id: oslibmsgtranslate.cpp,v 1.3 2000-01-02 19:30:43 cbratschi Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 113 113 win32wnd = Win32BaseWindow::GetWindowFromOS2Handle(os2Msg->hwnd); 114 114 //PostThreadMessage posts WIN32APP_POSTMSG msg without window handle 115 if((win32wnd == 0 && os2Msg->msg != WM_CREATE &&os2Msg->msg != WIN32APP_POSTMSG))115 if((win32wnd == 0) && (os2Msg->msg != WM_CREATE) && (os2Msg->msg != WIN32APP_POSTMSG)) 116 116 { 117 117 goto dummymessage; //not a win32 client window … … 298 298 299 299 if (!win32wnd->CanReceiveSizeMsgs()) goto dummymessage; 300 300 //CB: todo: send WM_NCCALCSIZE 301 #if 0 //CB: ignore it 301 302 dprintf(("Set client rectangle to (%d,%d)(%d,%d)", swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy)); 302 303 win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy); … … 321 322 goto dummymessage; 322 323 } 324 #else 325 goto dummymessage; 326 #endif 323 327 } 324 328 -
trunk/src/user32/new/oslibwin.cpp
r2291 r2292 1 /* $Id: oslibwin.cpp,v 1.3 0 2000-01-01 17:07:41cbratschi Exp $ */1 /* $Id: oslibwin.cpp,v 1.31 2000-01-02 19:30:43 cbratschi Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 52 52 //****************************************************************************** 53 53 //****************************************************************************** 54 HWND OSLibWinCreateWindow(HWND hwndParent, ULONG dwWinStyle, ULONG dwFrameStyle,54 HWND OSLibWinCreateWindow(HWND hwndParent,ULONG dwWinStyle, 55 55 char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame, 56 56 ULONG id, BOOL fTaskList) … … 58 58 HWND hwndClient; 59 59 60 dprintf(("WinCreateWindow %x %x %x %s", hwndParent, dwWinStyle, dwFrameStyle,pszName));60 dprintf(("WinCreateWindow %x %x %x %s", hwndParent, pszName)); 61 61 62 62 if(pszName && *pszName == 0) { … … 69 69 Owner = HWND_DESKTOP; 70 70 } 71 ULONG dwClientStyle; 71 ULONG dwClientStyle = 0; 72 ULONG dwFrameStyle = 0; 72 73 #if 1 73 74 74 75 BOOL TopLevel = hwndParent == HWND_DESKTOP; 75 // if(dwFrameStyle & FCF_TITLEBAR)76 // TopLevel = TRUE;77 76 78 77 FRAMECDATA FCData = {sizeof (FRAMECDATA), 0, 0, 0}; … … 94 93 hwndParent, HWND_TOP, 95 94 id, &FCData, NULL); 95 96 96 if (*hwndFrame) { 97 97 hwndClient = WinCreateWindow (*hwndFrame, WIN32_STDCLASS, 98 98 NULL, dwClientStyle, 0, 0, 0, 0, 99 99 *hwndFrame, HWND_TOP, FID_CLIENT, NULL, NULL); 100 if (hwndClient != NULLHANDLE)101 WinSendMsg (*hwndFrame, WM_UPDATEFRAME, 0, 0);102 103 100 return hwndClient; 104 101 } -
trunk/src/user32/new/oslibwin.h
r2290 r2292 1 /* $Id: oslibwin.h,v 1.2 7 2000-01-01 14:54:53 cbratschi Exp $ */1 /* $Id: oslibwin.h,v 1.28 2000-01-02 19:30:43 cbratschi Exp $ */ 2 2 /* 3 3 * Window API wrappers for OS/2 … … 37 37 38 38 39 HWND OSLibWinCreateWindow(HWND hwndParent, ULONG dwWinStyle, ULONG dwFrameStyle,39 HWND OSLibWinCreateWindow(HWND hwndParent,ULONG dwWinStyle, 40 40 char *pszName, HWND Owner, ULONG fBottom, 41 41 HWND *hwndFrame, ULONG id, BOOL fTaskList); -
trunk/src/user32/new/pmframe.cpp
r2291 r2292 1 /* $Id: pmframe.cpp,v 1. 2 2000-01-01 17:07:42cbratschi Exp $ */1 /* $Id: pmframe.cpp,v 1.3 2000-01-02 19:30:43 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Frame Managment Code for OS/2 … … 16 16 #include <os2wrap.h> 17 17 #include <stdlib.h> 18 #include <string.h> 18 19 #include "win32type.h" 19 20 #include <misc.h> … … 24 25 #include "oslibwin.h" 25 26 #include "caret.h" 27 #include "oslibmsg.h" 26 28 27 29 #define PMFRAMELOG … … 216 218 MRESULT rc; 217 219 THDB *thdb; 218 MSG *pWinMsg ;220 MSG *pWinMsg,winMsg; 219 221 220 222 SetWin32TIB(); … … 228 230 goto RunDefWndProc; 229 231 } 230 pWinMsg = &thdb->msg; 232 233 if((thdb->msgstate & 1) == 0) 234 {//message that was sent directly to our window proc handler; translate it here 235 QMSG qmsg; 236 237 qmsg.msg = msg; 238 qmsg.hwnd = hwnd; 239 qmsg.mp1 = mp1; 240 qmsg.mp2 = mp2; 241 qmsg.time = WinQueryMsgTime(thdb->hab); 242 WinQueryMsgPos(thdb->hab, &qmsg.ptl); 243 qmsg.reserved = 0; 244 245 if(OS2ToWinMsgTranslate((PVOID)thdb, &qmsg, &winMsg, FALSE, MSG_REMOVE) == FALSE) 246 {//message was not translated 247 memset(&winMsg, 0, sizeof(MSG)); 248 } 249 pWinMsg = &winMsg; 250 } 251 else { 252 pWinMsg = &thdb->msg; 253 thdb->msgstate++; 254 } 231 255 232 256 OldFrameProc = (PFNWP)win32wnd->getOldFrameProc(); … … 236 260 case WM_FORMATFRAME: 237 261 { 238 RECTL *client; 239 262 PSWP pswp = (PSWP)mp1,swpClient; 263 RECTL *client = (PRECTL)mp2,rect; 264 INT ccount; 265 266 if (!win32wnd->IsWindowCreated()) goto RunDefFrameProc; 240 267 dprintf(("PMFRAME: WM_FORMATFRAME %x",hwnd)); 241 client = (PRECTL)mp2; 242 #if 0 243 //CB: todo: client rect is wrong/not set with WM_NCCALCSIZE 244 mapWin32ToOS2Rect(hwnd,win32wnd->getClientRectPtr(),(PRECTLOS2)client); 245 246 RestorOS2TIB(); 247 return (MRESULT)1; 248 #else 249 goto RunDefFrameProc; 250 #endif 268 RestoreOS2TIB(); 269 ccount = (INT)OldFrameProc(hwnd,msg,mp1,mp2); 270 SetWin32TIB(); 271 mapWin32ToOS2Rect(WinQueryWindow(hwnd,QW_PARENT),win32wnd->getClientRectPtr(),(PRECTLOS2)&rect); 272 WinMapWindowPoints(WinQueryWindow(hwnd,QW_PARENT),hwnd,(PPOINTL)&rect,2); 273 swpClient = &pswp[ccount-1]; 274 swpClient->x = rect.xLeft; 275 swpClient->y = rect.yBottom; 276 swpClient->cx = rect.xRight-rect.xLeft; 277 swpClient->cy = rect.yTop-rect.yBottom; 278 RestoreOS2TIB(); 279 return (MRESULT)ccount; 251 280 } 252 281 … … 268 297 case WM_BUTTON3UP: 269 298 case WM_BUTTON3DBLCLK: 270 win32wnd->MsgButton(pWinMsg); 271 RestoreOS2TIB(); 299 if (win32wnd->IsWindowCreated()) 300 { 301 win32wnd->MsgButton(pWinMsg); 302 RestoreOS2TIB(); 303 } 272 304 return (MRESULT)TRUE; 273 305 … … 287 319 { 288 320 //OS/2 Window coordinates -> Win32 Window coordinates 289 win32wnd->MsgMouseMove(pWinMsg); 321 if (win32wnd->IsWindowCreated()) 322 win32wnd->MsgMouseMove(pWinMsg); 290 323 RestoreOS2TIB(); 291 324 return (MRESULT)TRUE; … … 297 330 298 331 // Only send this message if the window is enabled 299 if (!WinIsWindowEnabled(hwnd)) 332 if (!win32wnd->IsWindowCreated()) 333 res = HT_NORMAL; 334 else if (!WinIsWindowEnabled(hwnd)) 300 335 res = HT_ERROR; 301 336 else if (win32wnd->getIgnoreHitTest()) … … 315 350 316 351 case WM_PAINT: 317 win32wnd->DispatchMsgA(pWinMsg); 352 dprintf(("PMFRAME: WM_PAINT")); 353 if (win32wnd->IsWindowCreated()) 354 win32wnd->MsgNCPaint(); 318 355 goto RunDefWndProc; 319 356 … … 430 467 UINT res = CVR_ALIGNLEFT | CVR_ALIGNTOP; 431 468 432 //CB: only used if CS_SIZEDRAW isn't set 433 // PM moves children -> fast, no flickering (if redraw flags not set) 469 //CB: todo: use WM_NCCALCSIZE 434 470 if (win32wnd->getWindowClass()) 435 471 { … … 456 492 USHORT flags = WinQueryWindowUShort(hwnd,QWS_FLAGS); 457 493 458 //CB: emulate WM_ACTIVATE -> no flickering 459 hwndTitle = WinWindowFromID(hwnd,FID_TITLEBAR); 460 if (hwndTitle) WinSendMsg(hwndTitle,TBM_SETHILITE,mp1,MPVOID); 461 462 WinSendMsg(WinWindowFromID(hwnd,FID_CLIENT),WM_ACTIVATE,mp1,mp2); 463 WinSetWindowUShort(hwnd,QWS_FLAGS,mp1 ? (flags | FF_ACTIVE):(flags & ~FF_ACTIVE)); 464 465 //CB: show owner behind the dialog 466 if (win32wnd->IsModalDialog()) 494 if (win32wnd->IsWindowCreated()) 467 495 { 468 Win32BaseWindow *topOwner = win32wnd->getOwner()->GetTopParent(); 469 470 if (topOwner) WinSetWindowPos(topOwner->getOS2FrameWindowHandle(),hwnd,0,0,0,0,SWP_ZORDER); 496 WinSendMsg(WinWindowFromID(hwnd,FID_CLIENT),WM_ACTIVATE,mp1,mp2); 497 WinSetWindowUShort(hwnd,QWS_FLAGS,mp1 ? (flags | FF_ACTIVE):(flags & ~FF_ACTIVE)); 498 499 //CB: show owner behind the dialog 500 if (win32wnd->IsModalDialog()) 501 { 502 Win32BaseWindow *topOwner = win32wnd->getOwner()->GetTopParent(); 503 504 if (topOwner) WinSetWindowPos(topOwner->getOS2FrameWindowHandle(),hwnd,0,0,0,0,SWP_ZORDER); 505 } 506 } else 507 { 508 WinSetWindowUShort(hwnd,QWS_FLAGS,mp1 ? (flags | FF_ACTIVE):(flags & ~FF_ACTIVE)); 471 509 } 472 510 -
trunk/src/user32/new/win32dlg.cpp
r2290 r2292 1 /* $Id: win32dlg.cpp,v 1. 9 2000-01-01 14:57:27cbratschi Exp $ */1 /* $Id: win32dlg.cpp,v 1.10 2000-01-02 19:30:43 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Dialog Code for OS/2 … … 791 791 { 792 792 /* always make combo box hide its listbox control */ 793 if( WIDGETS_IsControl( wndFocus, COMBOBOX_CONTROL ) )793 if( CONTROLS_IsControl( wndFocus, COMBOBOX_CONTROL ) ) 794 794 wndFocus->SendMessageA(CB_SHOWDROPDOWN, FALSE, 0 ); 795 795 else 796 if( WIDGETS_IsControl( wndFocus, EDIT_CONTROL ) &&797 WIDGETS_IsControl( wndFocus->getParent(), COMBOBOX_CONTROL ))796 if( CONTROLS_IsControl( wndFocus, EDIT_CONTROL ) && 797 CONTROLS_IsControl( wndFocus->getParent(), COMBOBOX_CONTROL )) 798 798 wndFocus->SendMessageA(CB_SHOWDROPDOWN, FALSE, 0 ); 799 799 } -
trunk/src/user32/new/win32wbase.cpp
r2290 r2292 1 /* $Id: win32wbase.cpp,v 1.1 8 2000-01-01 14:57:28cbratschi Exp $ */1 /* $Id: win32wbase.cpp,v 1.19 2000-01-02 19:30:44 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 76 76 !(style & (WS_CHILD | WS_POPUP)) 77 77 78 #define HAS_MENU(w) (!((w)->getStyle() & WS_CHILD) && ((w)->getWindowId() != 0)) 79 78 80 /* bits in the dwKeyData */ 79 81 #define KEYDATA_ALT 0x2000 … … 85 87 //For quick lookup of current process id 86 88 static ULONG currentProcessId = -1; 89 90 static HBITMAP hbitmapClose = 0; 91 static HBITMAP hbitmapCloseD = 0; 92 static HBITMAP hbitmapMinimize = 0; 93 static HBITMAP hbitmapMinimizeD = 0; 94 static HBITMAP hbitmapMaximize = 0; 95 static HBITMAP hbitmapMaximizeD = 0; 96 static HBITMAP hbitmapRestore = 0; 97 static HBITMAP hbitmapRestoreD = 0; 98 99 BYTE lpGrayMask[] = { 0xAA, 0xA0, 100 0x55, 0x50, 101 0xAA, 0xA0, 102 0x55, 0x50, 103 0xAA, 0xA0, 104 0x55, 0x50, 105 0xAA, 0xA0, 106 0x55, 0x50, 107 0xAA, 0xA0, 108 0x55, 0x50}; 87 109 88 110 //****************************************************************************** … … 102 124 fIsSubclassedOS2Wnd = TRUE; 103 125 fFirstShow = FALSE; 126 fCreated = TRUE; 104 127 105 128 SetLastError(0); … … 456 479 457 480 hwndLinkAfter = HWND_TOP; 458 if( WIDGETS_IsControl(this, BUTTON_CONTROL) && ((dwStyle & 0x0f) == BS_GROUPBOX))481 if(CONTROLS_IsControl(this, BUTTON_CONTROL) && ((dwStyle & 0x0f) == BS_GROUPBOX)) 459 482 { 460 483 hwndLinkAfter = HWND_BOTTOM; … … 462 485 } 463 486 else 464 if( WIDGETS_IsControl(this, STATIC_CONTROL) && !(dwStyle & WS_GROUP)) {487 if(CONTROLS_IsControl(this, STATIC_CONTROL) && !(dwStyle & WS_GROUP)) { 465 488 dwStyle |= WS_CLIPSIBLINGS; 466 489 } … … 512 535 vertScrollInfo->flags = ESB_ENABLE_BOTH; 513 536 } 514 537 #if 0 //CB: PM frame not yet created! 515 538 /* Send the WM_GETMINMAXINFO message and fix the size if needed */ 516 539 if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD))) … … 522 545 if (cs->cy < minTrack.y ) cs->cy = minTrack.y; 523 546 } 524 547 #endif 525 548 if(cs->style & WS_CHILD) 526 549 { … … 583 606 584 607 OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP, 585 dwOSWinStyle, dwOSFrameStyle,(char *)windowNameA,608 dwOSWinStyle,(char *)windowNameA, 586 609 (owner) ? owner->getOS2WindowHandle() : OSLIB_HWND_DESKTOP, 587 610 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE, … … 619 642 return FALSE; 620 643 } 621 #if 0622 if(OS2Hwnd != OS2HwndFrame) {623 if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) {624 dprintf(("WM_CREATE: WinSetWindowULong %X failed!!", OS2HwndFrame));625 SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error626 return FALSE;627 }628 if(OSLibWinSetWindowULong(OS2HwndFrame, OFFSET_WIN32PM_MAGIC, WIN32PM_MAGIC) == FALSE) {629 dprintf(("WM_CREATE: WinSetWindowULong2 %X failed!!", OS2HwndFrame));630 SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error631 return FALSE;632 }633 }634 #endif635 644 636 645 OSLibWinSetOwner(OS2Hwnd, OS2HwndFrame); 637 646 638 FrameGetScrollBarHandles(this,dwStyle & WS_HSCROLL,dwStyle & WS_VSCROLL);639 subclassScrollBars(dwStyle & WS_HSCROLL,dwStyle & WS_VSCROLL);647 //FrameGetScrollBarHandles(this,dwStyle & WS_HSCROLL,dwStyle & WS_VSCROLL); 648 //subclassScrollBars(dwStyle & WS_HSCROLL,dwStyle & WS_VSCROLL); 640 649 641 650 fakeWinBase.hwndThis = OS2Hwnd; … … 645 654 if(windowClass->getIcon()) 646 655 SetIcon(windowClass->getIcon()); 647 648 656 /* Get class or window DC if needed */ 649 657 if(windowClass->getStyle() & CS_OWNDC) { … … 682 690 // Subclass frame 683 691 pOldFrameProc = FrameSubclassFrameWindow(this); 684 if (isChild()) FrameSetBorderSize(this,TRUE); 685 692 //if (isChild()) FrameSetBorderSize(this,TRUE); 693 694 //preset rects 695 rectWindow.left = cs->x; 696 rectWindow.right = cs->x+cs->cx; 697 rectWindow.top = cs->y; 698 rectWindow.bottom = cs->y+cs->cy; 699 rectClient = rectWindow; 700 if (getParent()) MapWindowPoints(getParent()->getWindowHandle(),0,(PPOINT)&rectWindow,2); 686 701 /* Send the WM_CREATE message 687 702 * Perhaps we shouldn't allow width/height changes as well. … … 690 705 maxPos.x = rectWindow.left; maxPos.y = rectWindow.top; 691 706 692 SetWindowPos(hwndLinkAfter,cs->x,cs->y,cs->cx,cs->cy,SWP_NOACTIVATE | SWP_NOREDRAW);707 //SetWindowPos(hwndLinkAfter,cs->x,cs->y,cs->cx,cs->cy,SWP_NOACTIVATE | SWP_NOREDRAW); 693 708 694 709 //Note: Solitaire crashes when receiving WM_SIZE messages before WM_CREATE 695 710 fNoSizeMsg = FALSE; 711 fCreated = TRUE; 696 712 697 713 if(SendInternalMessageA(WM_NCCREATE, 0, (LPARAM)cs) ) 698 714 { 699 fCreated = TRUE; 700 715 RECT rect; 716 717 //update rect 718 rectWindow.left = cs->x; 719 rectWindow.right = cs->x+cs->cx; 720 rectWindow.top = cs->y; 721 rectWindow.bottom = cs->y+cs->cy; 722 rectClient = rectWindow; 723 if (getParent()) MapWindowPoints(getParent()->getWindowHandle(),0,(PPOINT)&rectWindow,2); 701 724 SendNCCalcSize(FALSE, &rectWindow, NULL, NULL, 0, &rectClient ); 702 // OffsetRect(&rectWindow, maxPos.x - rectWindow.left, maxPos.y - rectWindow.top); 725 OffsetRect(&rectWindow, maxPos.x - rectWindow.left, maxPos.y - rectWindow.top); 726 //set the window size and update the client 727 rect = rectWindow; 728 if (getParent()) MapWindowPoints(0,getParent()->getWindowHandle(),(PPOINT)&rect,2); 729 SetWindowPos(hwndLinkAfter,rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,SWP_NOACTIVATE | SWP_NOREDRAW | SWP_FRAMECHANGED); 703 730 if( (SendInternalMessageA(WM_CREATE, 0, (LPARAM)cs )) != -1 ) 704 731 { … … 1076 1103 ULONG Win32BaseWindow::MsgNCPaint() 1077 1104 { 1078 return SendInternalMessageA(WM_PAINT, 0, 0); 1105 HRGN hrgn; 1106 1107 hrgn = 0; //CB: todo: set to frame update region 1108 return SendInternalMessageA(WM_NCPAINT,hrgn,0); 1079 1109 } 1080 1110 //****************************************************************************** … … 1227 1257 return rc; 1228 1258 } 1229 /*********************************************************************** 1230 * NC_HandleNCLButtonDown 1231 * 1232 * Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc(). 1233 */ 1259 //****************************************************************************** 1260 //****************************************************************************** 1261 LONG Win32BaseWindow::HandleNCActivate(WPARAM wParam) 1262 { 1263 WORD wStateChange; 1264 1265 if( wParam ) wStateChange = !(flags & WIN_NCACTIVATED); 1266 else wStateChange = flags & WIN_NCACTIVATED; 1267 1268 if( wStateChange ) 1269 { 1270 if (wParam) flags |= WIN_NCACTIVATED; 1271 else flags &= ~WIN_NCACTIVATED; 1272 1273 if(!(dwStyle & WS_MINIMIZE)) 1274 DoNCPaint((HRGN)1,FALSE); 1275 } 1276 1277 return TRUE; 1278 } 1279 //****************************************************************************** 1280 //****************************************************************************** 1281 VOID Win32BaseWindow::TrackMinMaxBox(WORD wParam) 1282 { 1283 MSG msg; 1284 HDC hdc; 1285 BOOL pressed = TRUE; 1286 UINT state; 1287 1288 if (wParam == HTMINBUTTON) 1289 { 1290 /* If the style is not present, do nothing */ 1291 if (!(dwStyle & WS_MINIMIZEBOX)) 1292 return; 1293 /* Check if the sysmenu item for minimize is there */ 1294 #if 0 //CB: todo 1295 state = GetMenuState(hSysMenu,SC_MINIMIZE,MF_BYCOMMAND); 1296 #endif 1297 } else 1298 { 1299 /* If the style is not present, do nothing */ 1300 if (!(dwStyle & WS_MAXIMIZEBOX)) 1301 return; 1302 /* Check if the sysmenu item for maximize is there */ 1303 #if 0 //CB: todo 1304 state = GetMenuState(hSysMenu, SC_MAXIMIZE, MF_BYCOMMAND); 1305 #endif 1306 } 1307 SetCapture(Win32Hwnd); 1308 hdc = GetWindowDC(Win32Hwnd); 1309 if (wParam == HTMINBUTTON) 1310 DrawMinButton(hdc,TRUE,FALSE); 1311 else 1312 DrawMaxButton(hdc,TRUE,FALSE); 1313 do 1314 { 1315 BOOL oldstate = pressed; 1316 1317 GetMessageA(&msg,Win32Hwnd,0,0); 1318 pressed = (HandleNCHitTest(msg.pt) == wParam); 1319 if (pressed != oldstate) 1320 { 1321 if (wParam == HTMINBUTTON) 1322 DrawMinButton(hdc,pressed,FALSE); 1323 else 1324 DrawMaxButton(hdc,pressed,FALSE); 1325 } 1326 } while (msg.message != WM_LBUTTONUP); 1327 if (wParam == HTMINBUTTON) 1328 DrawMinButton(hdc,FALSE,FALSE); 1329 else 1330 DrawMaxButton(hdc,FALSE,FALSE); 1331 ReleaseCapture(); 1332 ReleaseDC(Win32Hwnd,hdc); 1333 /* If the item minimize or maximize of the sysmenu are not there */ 1334 /* or if the style is not present, do nothing */ 1335 if ((!pressed) || (state == 0xFFFFFFFF)) 1336 return; 1337 if (wParam == HTMINBUTTON) 1338 SendInternalMessageA(WM_SYSCOMMAND,SC_MINIMIZE,*(LPARAM*)&msg.pt); 1339 else 1340 SendInternalMessageA(WM_SYSCOMMAND,IsZoomed(Win32Hwnd) ? SC_RESTORE:SC_MAXIMIZE,*(LPARAM*)&msg.pt); 1341 } 1342 //****************************************************************************** 1343 //****************************************************************************** 1344 VOID Win32BaseWindow::TrackCloseButton(WORD wParam) 1345 { 1346 MSG msg; 1347 HDC hdc; 1348 BOOL pressed = TRUE; 1349 UINT state; 1350 1351 #if 0 //CB: todo 1352 if (hSysMenu == 0) 1353 return; 1354 state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND); 1355 #endif 1356 /* If the item close of the sysmenu is disabled or not there do nothing */ 1357 if((state & MF_DISABLED) || (state & MF_GRAYED) || (state == 0xFFFFFFFF)) 1358 return; 1359 hdc = GetWindowDC(Win32Hwnd); 1360 SetCapture(Win32Hwnd); 1361 DrawCloseButton(hdc,TRUE,FALSE); 1362 do 1363 { 1364 BOOL oldstate = pressed; 1365 1366 GetMessageA(&msg,Win32Hwnd,0,0); 1367 pressed = (HandleNCHitTest(msg.pt) == wParam); 1368 if (pressed != oldstate) 1369 DrawCloseButton(hdc, pressed, FALSE); 1370 } while (msg.message != WM_LBUTTONUP); 1371 DrawCloseButton(hdc, FALSE, FALSE); 1372 ReleaseCapture(); 1373 ReleaseDC(Win32Hwnd, hdc ); 1374 if (!pressed) return; 1375 SendInternalMessageA(WM_SYSCOMMAND,SC_CLOSE,*(LPARAM*)&msg.pt); 1376 } 1377 //****************************************************************************** 1378 //****************************************************************************** 1234 1379 LONG Win32BaseWindow::HandleNCLButtonDown(WPARAM wParam,LPARAM lParam) 1235 1380 { … … 1237 1382 { 1238 1383 case HTCAPTION: 1239 SendInternalMessageA(WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam); 1384 SetActiveWindow(); 1385 if (GetActiveWindow() == Win32Hwnd) 1386 SendInternalMessageA(WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam); 1240 1387 break; 1241 1388 1242 1389 case HTSYSMENU: 1243 SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTSYSMENU,lParam); 1390 if(dwStyle & WS_SYSMENU ) 1391 { 1392 if( !(dwStyle & WS_MINIMIZE) ) 1393 { 1394 HDC hDC = GetWindowDC(Win32Hwnd); 1395 DrawSysButton(hDC,TRUE); 1396 ReleaseDC(Win32Hwnd,hDC); 1397 } 1398 SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTSYSMENU,lParam); 1399 } 1244 1400 break; 1245 1401 … … 1254 1410 case HTVSCROLL: 1255 1411 SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam); 1412 break; 1413 1414 case HTMINBUTTON: 1415 case HTMAXBUTTON: 1416 TrackMinMaxBox(wParam); 1417 break; 1418 1419 case HTCLOSE: 1420 TrackCloseButton(wParam); 1256 1421 break; 1257 1422 … … 1294 1459 return 0; 1295 1460 } 1461 //****************************************************************************** 1462 //****************************************************************************** 1463 BOOL Win32BaseWindow::WindowNeedsWMBorder() 1464 { 1465 if (!(dwStyle & WS_CHILD) && 1466 //Options.managed && //CB: to check 1467 !(dwExStyle & WS_EX_TOOLWINDOW) && 1468 ( ((dwStyle & WS_CAPTION) == WS_CAPTION) || 1469 (dwStyle & WS_THICKFRAME))) 1470 return TRUE; 1471 if (dwExStyle & WS_EX_TRAYWINDOW) 1472 return TRUE; 1473 return FALSE; 1474 } 1475 //****************************************************************************** 1476 //****************************************************************************** 1477 VOID Win32BaseWindow::AdjustRectOuter(LPRECT rect,BOOL menu) 1478 { 1479 if(dwStyle & WS_ICONIC) return; 1480 1481 /* Decide if the window will be managed (see CreateWindowEx) */ 1482 if (!WindowNeedsWMBorder()) 1483 { 1484 if (HAS_THICKFRAME(dwStyle,dwExStyle )) 1485 InflateRect( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) ); 1486 else 1487 if (HAS_DLGFRAME( dwStyle, dwExStyle )) 1488 InflateRect(rect, GetSystemMetrics(SM_CXDLGFRAME), GetSystemMetrics(SM_CYDLGFRAME) ); 1489 else 1490 if (HAS_THINFRAME( dwStyle )) 1491 InflateRect( rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER)); 1492 1493 if ((dwStyle & WS_CAPTION) == WS_CAPTION) 1494 { 1495 if (dwExStyle & WS_EX_TOOLWINDOW) 1496 rect->top -= GetSystemMetrics(SM_CYSMCAPTION); 1497 else 1498 rect->top -= GetSystemMetrics(SM_CYCAPTION); 1499 } 1500 } 1501 1502 if (menu) 1503 rect->top -= GetSystemMetrics(SM_CYMENU); 1504 } 1505 //****************************************************************************** 1506 //****************************************************************************** 1507 VOID Win32BaseWindow::AdjustRectInner(LPRECT rect) 1508 { 1509 if(dwStyle & WS_ICONIC) return; 1510 1511 if (dwExStyle & WS_EX_CLIENTEDGE) 1512 InflateRect (rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE)); 1513 1514 if (dwExStyle & WS_EX_STATICEDGE) 1515 InflateRect (rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER)); 1516 1517 if (dwStyle & WS_VSCROLL) rect->right += GetSystemMetrics(SM_CXVSCROLL); 1518 if (dwStyle & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL); 1519 } 1520 //****************************************************************************** 1521 //****************************************************************************** 1522 LONG Win32BaseWindow::HandleNCCalcSize(RECT *winRect) 1523 { 1524 RECT tmpRect = { 0, 0, 0, 0 }; 1525 LONG result = 0; 1526 UINT style = (UINT) GetClassLongA(Win32Hwnd,GCL_STYLE); 1527 1528 if (style & CS_VREDRAW) result |= WVR_VREDRAW; 1529 if (style & CS_HREDRAW) result |= WVR_HREDRAW; 1530 1531 if( !( dwStyle & WS_MINIMIZE ) ) 1532 { 1533 AdjustRectOuter(&tmpRect,FALSE); 1534 1535 winRect->left -= tmpRect.left; 1536 winRect->top -= tmpRect.top; 1537 winRect->right -= tmpRect.right; 1538 winRect->bottom -= tmpRect.bottom; 1539 1540 if (HAS_MENU(this)) 1541 { 1542 #if 0 //CB: todo 1543 winRect->top += 1544 MENU_GetMenuBarHeight(Win32Hwnd, 1545 winRect->right - winRect->left, 1546 -tmpRect.left, -tmpRect.top ) + 1; 1547 #endif 1548 } 1549 1550 SetRect (&tmpRect, 0, 0, 0, 0); 1551 AdjustRectInner(&tmpRect); 1552 winRect->left -= tmpRect.left; 1553 winRect->top -= tmpRect.top; 1554 winRect->right -= tmpRect.right; 1555 winRect->bottom -= tmpRect.bottom; 1556 } 1557 1558 return result; 1559 } 1560 //****************************************************************************** 1561 //****************************************************************************** 1562 LONG Win32BaseWindow::HandleNCHitTest(POINT pt) 1563 { 1564 RECT rect = rectWindow; 1565 1566 if (!PtInRect(&rect,pt)) return HTNOWHERE; 1567 1568 if (dwStyle & WS_MINIMIZE) return HTCAPTION; 1569 1570 if (!(flags & WIN_MANAGED)) 1571 { 1572 /* Check borders */ 1573 if (HAS_THICKFRAME(dwStyle,dwExStyle)) 1574 { 1575 InflateRect( &rect, -GetSystemMetrics(SM_CXFRAME), -GetSystemMetrics(SM_CYFRAME) ); 1576 if (!PtInRect( &rect, pt )) 1577 { 1578 /* Check top sizing border */ 1579 if (pt.y < rect.top) 1580 { 1581 if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT; 1582 if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT; 1583 return HTTOP; 1584 } 1585 /* Check bottom sizing border */ 1586 if (pt.y >= rect.bottom) 1587 { 1588 if (pt.x < rect.left+GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT; 1589 if (pt.x >= rect.right-GetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT; 1590 return HTBOTTOM; 1591 } 1592 /* Check left sizing border */ 1593 if (pt.x < rect.left) 1594 { 1595 if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT; 1596 if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT; 1597 return HTLEFT; 1598 } 1599 /* Check right sizing border */ 1600 if (pt.x >= rect.right) 1601 { 1602 if (pt.y < rect.top+GetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT; 1603 if (pt.y >= rect.bottom-GetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT; 1604 return HTRIGHT; 1605 } 1606 } 1607 } 1608 else /* No thick frame */ 1609 { 1610 if (HAS_DLGFRAME(dwStyle,dwExStyle)) 1611 InflateRect(&rect, -GetSystemMetrics(SM_CXDLGFRAME), -GetSystemMetrics(SM_CYDLGFRAME)); 1612 else if (HAS_THINFRAME(dwStyle )) 1613 InflateRect(&rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER)); 1614 if (!PtInRect( &rect, pt )) return HTBORDER; 1615 } 1616 1617 /* Check caption */ 1618 1619 if ((dwStyle & WS_CAPTION) == WS_CAPTION) 1620 { 1621 if (dwExStyle & WS_EX_TOOLWINDOW) 1622 rect.top += GetSystemMetrics(SM_CYSMCAPTION) - 1; 1623 else 1624 rect.top += GetSystemMetrics(SM_CYCAPTION) - 1; 1625 if (!PtInRect( &rect, pt )) 1626 { 1627 /* Check system menu */ 1628 if(dwStyle & WS_SYSMENU) 1629 { 1630 /* Check if there is an user icon */ 1631 HICON hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM); 1632 if(!hIcon) hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON); 1633 1634 /* If there is an icon associated with the window OR */ 1635 /* If there is no hIcon specified and this is not a modal dialog, */ 1636 /* there is a system menu icon. */ 1637 if((hIcon != 0) || (!(dwStyle & DS_MODALFRAME))) 1638 rect.left += GetSystemMetrics(SM_CYCAPTION) - 1; 1639 } 1640 if (pt.x < rect.left) return HTSYSMENU; 1641 1642 /* Check close button */ 1643 if (dwStyle & WS_SYSMENU) 1644 rect.right -= GetSystemMetrics(SM_CYCAPTION) - 1; 1645 if (pt.x > rect.right) return HTCLOSE; 1646 1647 /* Check maximize box */ 1648 /* In win95 there is automatically a Maximize button when there is a minimize one*/ 1649 if ((dwStyle & WS_MAXIMIZEBOX)|| (dwStyle & WS_MINIMIZEBOX)) 1650 rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; 1651 if (pt.x > rect.right) return HTMAXBUTTON; 1652 1653 /* Check minimize box */ 1654 /* In win95 there is automatically a Maximize button when there is a Maximize one*/ 1655 if ((dwStyle & WS_MINIMIZEBOX)||(dwStyle & WS_MAXIMIZEBOX)) 1656 rect.right -= GetSystemMetrics(SM_CXSIZE) + 1; 1657 1658 if (pt.x > rect.right) return HTMINBUTTON; 1659 return HTCAPTION; 1660 } 1661 } 1662 } 1663 1664 /* Check client area */ 1665 1666 ScreenToClient(Win32Hwnd,&pt); 1667 rect = rectClient; 1668 if (PtInRect(&rect,pt)) return HTCLIENT; 1669 1670 /* Check vertical scroll bar */ 1671 1672 if (dwStyle & WS_VSCROLL) 1673 { 1674 rect.right += GetSystemMetrics(SM_CXVSCROLL); 1675 if (PtInRect( &rect, pt )) return HTVSCROLL; 1676 } 1677 1678 /* Check horizontal scroll bar */ 1679 1680 if (dwStyle & WS_HSCROLL) 1681 { 1682 rect.bottom += GetSystemMetrics(SM_CYHSCROLL); 1683 if (PtInRect( &rect, pt )) 1684 { 1685 /* Check size box */ 1686 if ((dwStyle & WS_VSCROLL) && 1687 (pt.x >= rect.right - GetSystemMetrics(SM_CXVSCROLL))) 1688 return HTSIZE; 1689 return HTHSCROLL; 1690 } 1691 } 1692 1693 /* Check menu bar */ 1694 1695 if (HAS_MENU(this)) 1696 { 1697 if ((pt.y < 0) && (pt.x >= 0) && (pt.x < rect.right)) 1698 return HTMENU; 1699 } 1700 1701 /* Should never get here */ 1702 return HTERROR; 1703 } 1704 1705 //****************************************************************************** 1706 //****************************************************************************** 1707 VOID Win32BaseWindow::GetInsideRect(RECT *rect) 1708 { 1709 rect->top = rect->left = 0; 1710 rect->right = rectWindow.right - rectWindow.left; 1711 rect->bottom = rectWindow.bottom - rectWindow.top; 1712 1713 if ((dwStyle & WS_ICONIC) || (flags & WIN_MANAGED)) return; 1714 1715 /* Remove frame from rectangle */ 1716 if (HAS_THICKFRAME(dwStyle,dwExStyle)) 1717 { 1718 InflateRect( rect, -GetSystemMetrics(SM_CXSIZEFRAME), -GetSystemMetrics(SM_CYSIZEFRAME) ); 1719 } 1720 else if (HAS_DLGFRAME(dwStyle,dwExStyle )) 1721 { 1722 InflateRect( rect, -GetSystemMetrics(SM_CXFIXEDFRAME), -GetSystemMetrics(SM_CYFIXEDFRAME)); 1723 } 1724 else if (HAS_THINFRAME(dwStyle)) 1725 { 1726 InflateRect( rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER) ); 1727 } 1728 1729 /* We have additional border information if the window 1730 * is a child (but not an MDI child) */ 1731 if ( (dwStyle & WS_CHILD) && 1732 ( (dwExStyle & WS_EX_MDICHILD) == 0 ) ) 1733 { 1734 if (dwExStyle & WS_EX_CLIENTEDGE) 1735 InflateRect (rect, -GetSystemMetrics(SM_CXEDGE), -GetSystemMetrics(SM_CYEDGE)); 1736 1737 if (dwExStyle & WS_EX_STATICEDGE) 1738 InflateRect (rect, -GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER)); 1739 } 1740 } 1741 //****************************************************************************** 1742 //****************************************************************************** 1743 VOID Win32BaseWindow::DrawFrame(HDC hdc,RECT *rect,BOOL dlgFrame,BOOL active) 1744 { 1745 INT width, height; 1746 1747 if (dlgFrame) 1748 { 1749 width = GetSystemMetrics(SM_CXDLGFRAME) - GetSystemMetrics(SM_CXEDGE); 1750 height = GetSystemMetrics(SM_CYDLGFRAME) - GetSystemMetrics(SM_CYEDGE); 1751 } else 1752 { 1753 width = GetSystemMetrics(SM_CXFRAME) - GetSystemMetrics(SM_CXEDGE); 1754 height = GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYEDGE); 1755 } 1756 1757 SelectObject( hdc, GetSysColorBrush(active ? COLOR_ACTIVEBORDER : 1758 COLOR_INACTIVEBORDER) ); 1759 1760 /* Draw frame */ 1761 PatBlt( hdc, rect->left, rect->top, 1762 rect->right - rect->left, height, PATCOPY ); 1763 PatBlt( hdc, rect->left, rect->top, 1764 width, rect->bottom - rect->top, PATCOPY ); 1765 PatBlt( hdc, rect->left, rect->bottom - 1, 1766 rect->right - rect->left, -height, PATCOPY ); 1767 PatBlt( hdc, rect->right - 1, rect->top, 1768 -width, rect->bottom - rect->top, PATCOPY ); 1769 1770 InflateRect( rect, -width, -height ); 1771 } 1772 //****************************************************************************** 1773 //****************************************************************************** 1774 BOOL Win32BaseWindow::DrawSysButton(HDC hdc,BOOL down) 1775 { 1776 if(!(flags & WIN_MANAGED)) 1777 { 1778 HICON hIcon; 1779 RECT rect; 1780 1781 GetInsideRect(&rect); 1782 1783 hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM); 1784 if(!hIcon) hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON); 1785 1786 /* If there is no hIcon specified or this is not a modal dialog, */ 1787 /* get the default one. */ 1788 if(hIcon == 0) 1789 if (!(dwStyle & DS_MODALFRAME)) 1790 hIcon = LoadImageA(0, MAKEINTRESOURCEA(OIC_WINEICON), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR); 1791 1792 if (hIcon) 1793 DrawIconEx (hdc, rect.left + 2, rect.top + 2, hIcon, 1794 GetSystemMetrics(SM_CXSMICON), 1795 GetSystemMetrics(SM_CYSMICON), 1796 0, 0, DI_NORMAL); 1797 1798 return (hIcon != 0); 1799 } 1800 return FALSE; 1801 } 1802 //****************************************************************************** 1803 //****************************************************************************** 1804 BOOL Win32BaseWindow::DrawGrayButton(HDC hdc,int x,int y) 1805 { 1806 HBITMAP hMaskBmp; 1807 HDC hdcMask = CreateCompatibleDC (0); 1808 HBRUSH hOldBrush; 1809 hMaskBmp = CreateBitmap (12, 10, 1, 1, lpGrayMask); 1810 1811 if(hMaskBmp == 0) 1812 return FALSE; 1813 1814 SelectObject (hdcMask, hMaskBmp); 1815 1816 /* Draw the grayed bitmap using the mask */ 1817 hOldBrush = SelectObject (hdc, RGB(128, 128, 128)); 1818 BitBlt (hdc, x, y, 12, 10, 1819 hdcMask, 0, 0, 0xB8074A); 1820 1821 /* Clean up */ 1822 SelectObject (hdc, hOldBrush); 1823 DeleteObject(hMaskBmp); 1824 DeleteDC (hdcMask); 1825 1826 return TRUE; 1827 } 1828 //****************************************************************************** 1829 //****************************************************************************** 1830 VOID Win32BaseWindow::DrawCloseButton(HDC hdc,BOOL down,BOOL bGrayed) 1831 { 1832 RECT rect; 1833 HDC hdcMem; 1834 1835 if( !(flags & WIN_MANAGED) ) 1836 { 1837 BITMAP bmp; 1838 HBITMAP hBmp, hOldBmp; 1839 1840 GetInsideRect(&rect); 1841 1842 hdcMem = CreateCompatibleDC( hdc ); 1843 hBmp = down ? hbitmapCloseD : hbitmapClose; 1844 hOldBmp = SelectObject (hdcMem, hBmp); 1845 GetObjectA (hBmp, sizeof(BITMAP), &bmp); 1846 1847 BitBlt (hdc, rect.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2, 1848 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2, 1849 bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY); 1850 1851 if(bGrayed) 1852 DrawGrayButton(hdc,rect.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2 + 2, 1853 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2); 1854 1855 SelectObject (hdcMem, hOldBmp); 1856 DeleteDC (hdcMem); 1857 } 1858 } 1859 //****************************************************************************** 1860 //****************************************************************************** 1861 VOID Win32BaseWindow::DrawMaxButton(HDC hdc,BOOL down,BOOL bGrayed) 1862 { 1863 RECT rect; 1864 HDC hdcMem; 1865 1866 if( !(flags & WIN_MANAGED)) 1867 { 1868 BITMAP bmp; 1869 HBITMAP hBmp,hOldBmp; 1870 1871 GetInsideRect(&rect); 1872 hdcMem = CreateCompatibleDC( hdc ); 1873 hBmp = IsZoomed(Win32Hwnd) ? 1874 (down ? hbitmapRestoreD : hbitmapRestore ) : 1875 (down ? hbitmapMaximizeD: hbitmapMaximize); 1876 hOldBmp=SelectObject( hdcMem, hBmp ); 1877 GetObjectA (hBmp, sizeof(BITMAP), &bmp); 1878 1879 if (dwStyle & WS_SYSMENU) 1880 rect.right -= GetSystemMetrics(SM_CYCAPTION) + 1; 1881 1882 BitBlt( hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2, 1883 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2, 1884 bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY ); 1885 1886 if(bGrayed) 1887 DrawGrayButton(hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2, 1888 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2); 1889 1890 1891 SelectObject (hdcMem, hOldBmp); 1892 DeleteDC( hdcMem ); 1893 } 1894 } 1895 //****************************************************************************** 1896 //****************************************************************************** 1897 VOID Win32BaseWindow::DrawMinButton(HDC hdc,BOOL down,BOOL bGrayed) 1898 { 1899 RECT rect; 1900 HDC hdcMem; 1901 1902 if( !(flags & WIN_MANAGED)) 1903 1904 { 1905 BITMAP bmp; 1906 HBITMAP hBmp,hOldBmp; 1907 1908 GetInsideRect(&rect); 1909 1910 hdcMem = CreateCompatibleDC( hdc ); 1911 hBmp = down ? hbitmapMinimizeD : hbitmapMinimize; 1912 hOldBmp= SelectObject( hdcMem, hBmp ); 1913 GetObjectA (hBmp, sizeof(BITMAP), &bmp); 1914 1915 if (dwStyle & WS_SYSMENU) 1916 rect.right -= GetSystemMetrics(SM_CYCAPTION) + 1; 1917 1918 /* In win 95 there is always a Maximize box when there is a Minimize one */ 1919 if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX)) 1920 rect.right += -1 - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2; 1921 1922 BitBlt( hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2, 1923 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2, 1924 bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY ); 1925 1926 if(bGrayed) 1927 DrawGrayButton(hdc, rect.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2 + 2, 1928 rect.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2); 1929 1930 1931 SelectObject (hdcMem, hOldBmp); 1932 DeleteDC( hdcMem ); 1933 } 1934 } 1935 //****************************************************************************** 1936 //****************************************************************************** 1937 VOID Win32BaseWindow::DrawCaption(HDC hdc,RECT *rect,BOOL active) 1938 { 1939 RECT r = *rect; 1940 char buffer[256]; 1941 HPEN hPrevPen; 1942 HMENU hSysMenu; 1943 1944 if (flags & WIN_MANAGED) return; 1945 1946 hPrevPen = SelectObject( hdc, GetSysColorPen(COLOR_3DFACE) ); 1947 MoveToEx( hdc, r.left, r.bottom - 1, NULL ); 1948 LineTo( hdc, r.right, r.bottom - 1 ); 1949 SelectObject( hdc, hPrevPen ); 1950 r.bottom--; 1951 1952 FillRect( hdc, &r, GetSysColorBrush(active ? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION) ); 1953 1954 if (!hbitmapClose) 1955 { 1956 if (!(hbitmapClose = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_CLOSE)))) return; 1957 hbitmapCloseD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_CLOSED)); 1958 hbitmapMinimize = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_REDUCE)); 1959 hbitmapMinimizeD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_REDUCED)); 1960 hbitmapMaximize = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_ZOOM)); 1961 hbitmapMaximizeD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_ZOOMD)); 1962 hbitmapRestore = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_RESTORE)); 1963 hbitmapRestoreD = LoadBitmapA(0,MAKEINTRESOURCEA(OBM_RESTORED)); 1964 } 1965 1966 if ((dwStyle & WS_SYSMENU) && !(dwExStyle & WS_EX_TOOLWINDOW)) 1967 { 1968 if (DrawSysButton(hdc,FALSE)) 1969 r.left += GetSystemMetrics(SM_CYCAPTION) - 1; 1970 } 1971 1972 if (dwStyle & WS_SYSMENU) 1973 { 1974 UINT state; 1975 #if 0 //CB: todo 1976 /* Go get the sysmenu */ 1977 state = GetMenuState(hSysMenu, SC_CLOSE, MF_BYCOMMAND); 1978 #endif 1979 /* Draw a grayed close button if disabled and a normal one if SC_CLOSE is not there */ 1980 DrawCloseButton(hdc, FALSE, 1981 ((((state & MF_DISABLED) || (state & MF_GRAYED))) && (state != 0xFFFFFFFF))); 1982 r.right -= GetSystemMetrics(SM_CYCAPTION) - 1; 1983 1984 if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX)) 1985 { 1986 /* In win95 the two buttons are always there */ 1987 /* But if the menu item is not in the menu they're disabled*/ 1988 1989 DrawMaxButton(hdc, FALSE, (!(dwStyle & WS_MAXIMIZEBOX))); 1990 r.right -= GetSystemMetrics(SM_CXSIZE) + 1; 1991 1992 DrawMinButton(hdc, FALSE, (!(dwStyle & WS_MINIMIZEBOX))); 1993 r.right -= GetSystemMetrics(SM_CXSIZE) + 1; 1994 } 1995 } 1996 1997 if (GetWindowTextA(buffer, sizeof(buffer) )) 1998 { 1999 NONCLIENTMETRICSA nclm; 2000 HFONT hFont, hOldFont; 2001 nclm.cbSize = sizeof(NONCLIENTMETRICSA); 2002 SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0); 2003 if (dwExStyle & WS_EX_TOOLWINDOW) 2004 hFont = CreateFontIndirectA (&nclm.lfSmCaptionFont); 2005 else 2006 hFont = CreateFontIndirectA (&nclm.lfCaptionFont); 2007 hOldFont = SelectObject (hdc, hFont); 2008 if (active) SetTextColor( hdc, GetSysColor( COLOR_CAPTIONTEXT ) ); 2009 else SetTextColor( hdc, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) ); 2010 SetBkMode( hdc, TRANSPARENT ); 2011 r.left += 2; 2012 DrawTextA( hdc, buffer, -1, &r, 2013 DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT ); 2014 DeleteObject (SelectObject (hdc, hOldFont)); 2015 } 2016 } 2017 //****************************************************************************** 2018 //****************************************************************************** 2019 VOID Win32BaseWindow::DoNCPaint(HRGN clip,BOOL suppress_menupaint) 2020 { 2021 BOOL active = flags & WIN_NCACTIVATED; 2022 HDC hdc; 2023 RECT rect,rectClip,rfuzz; 2024 2025 /* MSDN docs are pretty idiotic here, they say app CAN use clipRgn in 2026 the call to GetDCEx implying that it is allowed not to use it either. 2027 However, the suggested GetDCEx( , DCX_WINDOW | DCX_INTERSECTRGN) 2028 will cause clipRgn to be deleted after ReleaseDC(). 2029 Now, how is the "system" supposed to tell what happened? 2030 */ 2031 2032 if (!(hdc = GetDCEx( Win32Hwnd, (clip > 1) ? clip : 0, DCX_USESTYLE | DCX_WINDOW | 2033 ((clip > 1) ?(DCX_INTERSECTRGN /*| DCX_KEEPCLIPRGN*/) : 0) ))) return; 2034 2035 2036 rect.top = rect.left = 0; 2037 rect.right = rectWindow.right - rectWindow.left; 2038 rect.bottom = rectWindow.bottom - rectWindow.top; 2039 2040 if( clip > 1 ) 2041 GetRgnBox( clip, &rectClip ); 2042 else 2043 { 2044 clip = 0; 2045 rectClip = rect; 2046 } 2047 2048 SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); 2049 2050 if(!(flags & WIN_MANAGED)) 2051 { 2052 if (HAS_BIGFRAME( dwStyle, dwExStyle)) 2053 { 2054 DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT | BF_ADJUST); 2055 } 2056 if (HAS_THICKFRAME( dwStyle, dwExStyle )) 2057 DrawFrame(hdc, &rect, FALSE, active ); 2058 else if (HAS_DLGFRAME( dwStyle, dwExStyle )) 2059 DrawFrame( hdc, &rect, TRUE, active ); 2060 else if (HAS_THINFRAME( dwStyle )) 2061 { 2062 SelectObject( hdc, GetStockObject(NULL_BRUSH) ); 2063 Rectangle( hdc, 0, 0, rect.right, rect.bottom ); 2064 } 2065 2066 if ((dwStyle & WS_CAPTION) == WS_CAPTION) 2067 { 2068 RECT r = rect; 2069 if (dwExStyle & WS_EX_TOOLWINDOW) 2070 { 2071 r.bottom = rect.top + GetSystemMetrics(SM_CYSMCAPTION); 2072 rect.top += GetSystemMetrics(SM_CYSMCAPTION); 2073 } 2074 else 2075 { 2076 r.bottom = rect.top + GetSystemMetrics(SM_CYCAPTION); 2077 rect.top += GetSystemMetrics(SM_CYCAPTION); 2078 } 2079 if( !clip || IntersectRect( &rfuzz, &r, &rectClip ) ) 2080 DrawCaption(hdc, &r, active); 2081 } 2082 } 2083 #if 0 //CB: todo 2084 if (HAS_MENU(wndPtr)) 2085 { 2086 RECT r = rect; 2087 r.bottom = rect.top + GetSystemMetrics(SM_CYMENU); 2088 2089 rect.top += MENU_DrawMenuBar( hdc, &r, hwnd, suppress_menupaint ) + 1; 2090 } 2091 #endif 2092 2093 if (dwExStyle & WS_EX_CLIENTEDGE) 2094 DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); 2095 2096 if (dwExStyle & WS_EX_STATICEDGE) 2097 DrawEdge (hdc, &rect, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST); 2098 2099 /* Draw the scroll-bars */ 2100 #if 0 //CB: todo 2101 if (dwStyle & WS_VSCROLL) 2102 SCROLL_DrawScrollBar( hwnd, hdc, SB_VERT, TRUE, TRUE ); 2103 if (wndPtr->dwStyle & WS_HSCROLL) 2104 SCROLL_DrawScrollBar( hwnd, hdc, SB_HORZ, TRUE, TRUE ); 2105 #endif 2106 /* Draw the "size-box" */ 2107 if ((dwStyle & WS_VSCROLL) && (dwStyle & WS_HSCROLL)) 2108 { 2109 RECT r = rect; 2110 r.left = r.right - GetSystemMetrics(SM_CXVSCROLL) + 1; 2111 r.top = r.bottom - GetSystemMetrics(SM_CYHSCROLL) + 1; 2112 FillRect( hdc, &r, GetSysColorBrush(COLOR_SCROLLBAR) ); 2113 } 2114 2115 ReleaseDC(Win32Hwnd,hdc); 2116 } 2117 //****************************************************************************** 2118 //****************************************************************************** 2119 LONG Win32BaseWindow::HandleNCPaint(HRGN clip) 2120 { 2121 if (!(dwStyle & WS_VISIBLE)) return 0; 2122 2123 if (dwStyle & WS_MINIMIZE) return 0; //CB: to check 2124 2125 DoNCPaint(clip,FALSE); 2126 2127 return 0; 2128 } 1296 2129 /*********************************************************************** 1297 2130 * NC_HandleNCLButtonDblClk … … 1605 2438 1606 2439 case WM_NCPAINT: 1607 return 0;2440 return HandleNCPaint((HRGN)wParam); 1608 2441 1609 2442 case WM_NCACTIVATE: 2443 return HandleNCActivate(wParam); 1610 2444 return TRUE; 1611 2445 … … 1617 2451 1618 2452 case WM_NCCALCSIZE: 1619 return NCHandleCalcSize(wParam, (NCCALCSIZE_PARAMS*)lParam);2453 return HandleNCCalcSize((RECT*)lParam); 1620 2454 1621 2455 case WM_CTLCOLORMSGBOX: … … 1669 2503 HCURSOR hCursor; 1670 2504 1671 switch( lastHitTestVal)2505 switch(LOWORD(lParam)) 1672 2506 { 1673 2507 case HTLEFT: … … 1806 2640 point.y = (SHORT)HIWORD(lParam); 1807 2641 1808 return FrameHitTest(this,point.x,point.y);2642 return HandleNCHitTest(point); 1809 2643 } 1810 2644 -
trunk/src/user32/new/win32wbase.h
r2290 r2292 1 /* $Id: win32wbase.h,v 1.1 3 2000-01-01 14:54:55 cbratschi Exp $ */1 /* $Id: win32wbase.h,v 1.14 2000-01-02 19:30:45 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 131 131 ULONG getClientWidth() { return rectClient.right - rectClient.left; }; 132 132 BOOL isChild(); 133 PRECT getClientRect() { return &rectClient; }; 133 PRECT getClientRectPtr() { return &rectClient; }; 134 void getClientRect(PRECT rect) 135 { 136 *rect = rectClient; 137 rectClient.right -= rectClient.left; 138 rectClient.bottom -= rectClient.top; 139 rectClient.left = rectClient.top = 0; 140 } 134 141 void setClientRect(PRECT rect) { rectClient = *rect; }; 135 142 PRECT getWindowRect() { return &rectWindow; }; … … 179 186 HWND getOS2HwndModalDialog() { return OS2HwndModalDialog; }; 180 187 BOOL CanReceiveSizeMsgs() { return !fNoSizeMsg; }; 188 BOOL IsWindowCreated() { return fCreated; } 181 189 BOOL IsWindowDestroyed() { return fIsDestroyed; }; 182 190 BOOL IsWindowEnabled(); … … 252 260 ULONG getBorderHeight() { return borderHeight; }; 253 261 254 static void NC_AdjustRectInner(LPRECT rect, DWORD style, DWORD exStyle);255 static void NC_AdjustRectOuter(LPRECT rect, DWORD style, BOOL menu, DWORD exStyle);256 static BOOL WindowNeedsWMBorder( DWORD style, DWORD exStyle );257 258 262 PVOID getOldWndProc() { return pOldWndProc; } 259 263 VOID setOldWndProc(PVOID aOldWndProc) { pOldWndProc = aOldWndProc; } … … 327 331 ULONG nrUserWindowLong; 328 332 329 RECT rectWindow; 330 RECT rectClient; 333 RECT rectWindow; //relative to screen 334 RECT rectClient; //relative to parent 331 335 332 336 CREATESTRUCTA *tmpcs; //temporary pointer to CREATESTRUCT used in CreateWindowEx … … 346 350 void GetMinMaxInfo(POINT *maxSize, POINT *maxPos, POINT *minTrack, POINT *maxTrack ); 347 351 LONG HandleWindowPosChanging(WINDOWPOS *winpos); 352 LONG HandleNCActivate(WPARAM wParam); 353 VOID TrackMinMaxBox(WORD wParam); 354 VOID TrackCloseButton(WORD wParam); 348 355 LONG HandleNCLButtonDown(WPARAM wParam,LPARAM lParam); 349 356 LONG HandleNCLButtonUp(WPARAM wParam,LPARAM lParam); 350 357 LONG HandleNCLButtonDblClk(WPARAM wParam,LPARAM lParam); 358 BOOL WindowNeedsWMBorder(); 359 VOID AdjustRectOuter(LPRECT rect,BOOL menu); 360 VOID AdjustRectInner(LPRECT rect); 361 LONG HandleNCCalcSize(RECT *winRect); 362 LONG HandleNCHitTest(POINT pt); 363 VOID GetInsideRect(RECT *rect); 364 VOID DrawFrame(HDC hdc,RECT *rect,BOOL dlgFrame,BOOL active); 365 BOOL DrawSysButton(HDC hdc,BOOL down); 366 BOOL DrawGrayButton(HDC hdc,int x,int y); 367 VOID DrawCloseButton(HDC hdc,BOOL down,BOOL bGrayed); 368 VOID DrawMaxButton(HDC hdc,BOOL down,BOOL bGrayed); 369 VOID DrawMinButton(HDC hdc,BOOL down,BOOL bGrayed); 370 VOID DrawCaption(HDC hdc,RECT *rect,BOOL active); 371 VOID DoNCPaint(HRGN clip,BOOL suppress_menupaint); 372 LONG HandleNCPaint(HRGN clip); 351 373 LONG HandleSysCommand(WPARAM wParam, POINT *pt32); 352 374 … … 355 377 RECT *oldClientRect, WINDOWPOS *winpos, 356 378 RECT *newClientRect ); 357 358 LONG NCHandleCalcSize(WPARAM wParam, NCCALCSIZE_PARAMS *ncsize);359 379 360 380 LRESULT SendInternalMessage(ULONG msg, WPARAM wParam, LPARAM lParam) -
trunk/src/user32/new/win32wbasepos.cpp
r2290 r2292 1 /* $Id: win32wbasepos.cpp,v 1. 1 2000-01-01 14:57:31cbratschi Exp $ */1 /* $Id: win32wbasepos.cpp,v 1.2 2000-01-02 19:30:45 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 (nonclient/position methods) … … 72 72 #define HAS_MENU() (!(getStyle() & WS_CHILD) && (GetMenu() != 0)) 73 73 74 #if 075 /***********************************************************************76 * WINPOS_MinMaximize77 *78 * Fill in lpRect and return additional flags to be used with SetWindowPos().79 * This function assumes that 'cmd' is different from the current window80 * state.81 */82 UINT Win32BaseWindow::MinMaximize(UINT cmd, LPRECT lpRect )83 {84 UINT swpFlags = 0;85 POINT pt, size;86 LPINTERNALPOS lpPos;87 88 size.x = rectWindow.left; size.y = rectWindow.top;89 lpPos = WINPOS_InitInternalPos( wndPtr, size, &rectWindow );90 91 if (lpPos && !HOOK_CallHooks16(WH_CBT, HCBT_MINMAX, hwndSelf, cmd))92 {93 if( dwStyle & WS_MINIMIZE )94 {95 if( !SendInternalMessageA(WM_QUERYOPEN, 0, 0L ) )96 return (SWP_NOSIZE | SWP_NOMOVE);97 swpFlags |= SWP_NOCOPYBITS;98 }99 switch( cmd )100 {101 case SW_MINIMIZE:102 if( dwStyle & WS_MAXIMIZE)103 {104 flags |= WIN_RESTORE_MAX;105 dwStyle &= ~WS_MAXIMIZE;106 }107 else108 flags &= ~WIN_RESTORE_MAX;109 dwStyle |= WS_MINIMIZE;110 111 #if 0112 if( flags & WIN_NATIVE )113 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, TRUE ) )114 swpFlags |= MINMAX_NOSWP;115 #endif116 117 lpPos->ptIconPos = WINPOS_FindIconPos( wndPtr, lpPos->ptIconPos );118 119 SetRect(lpRect, lpPos->ptIconPos.x, lpPos->ptIconPos.y,120 GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) );121 swpFlags |= SWP_NOCOPYBITS;122 break;123 124 case SW_MAXIMIZE:125 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL );126 127 if( dwStyle & WS_MINIMIZE )128 {129 if( flags & WIN_NATIVE )130 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )131 swpFlags |= MINMAX_NOSWP;132 133 WINPOS_ShowIconTitle( wndPtr, FALSE );134 dwStyle &= ~WS_MINIMIZE;135 }136 dwStyle |= WS_MAXIMIZE;137 138 SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,139 size.x, size.y );140 break;141 142 case SW_RESTORE:143 if( dwStyle & WS_MINIMIZE )144 {145 if( flags & WIN_NATIVE )146 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )147 swpFlags |= MINMAX_NOSWP;148 149 dwStyle &= ~WS_MINIMIZE;150 WINPOS_ShowIconTitle( wndPtr, FALSE );151 152 if( flags & WIN_RESTORE_MAX)153 {154 /* Restore to maximized position */155 CONV_POINT16TO32( &lpPos->ptMaxPos, &pt );156 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL);157 CONV_POINT32TO16( &pt, &lpPos->ptMaxPos );158 dwStyle |= WS_MAXIMIZE;159 SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, size.x, size.y );160 break;161 }162 }163 else164 if( !(dwStyle & WS_MAXIMIZE) ) return (UINT16)(-1);165 else dwStyle &= ~WS_MAXIMIZE;166 167 /* Restore to normal position */168 169 *lpRect = lpPos->rectNormal;170 lpRect->right -= lpRect->left;171 lpRect->bottom -= lpRect->top;172 173 break;174 }175 } else swpFlags |= SWP_NOSIZE | SWP_NOMOVE;176 return swpFlags;177 }178 #endif179 74 /******************************************************************* 180 75 * GetMinMaxInfo … … 280 175 return result; 281 176 } 282 //******************************************************************************283 //******************************************************************************284 LONG Win32BaseWindow::NCHandleCalcSize(WPARAM wParam, NCCALCSIZE_PARAMS *ncsize)285 {286 LONG result = 0;287 288 if (getStyle() & CS_VREDRAW) result |= WVR_VREDRAW;289 if (getStyle() & CS_HREDRAW) result |= WVR_HREDRAW;290 291 //TODO: Wine calculates new size of client area even when window is iconic (client edges)292 if(!(getStyle() & (WS_MINIMIZE | WS_ICONIC)))293 {294 dprintf(("NCHandleCalcSize %x (%d,%d) (%d,%d)", getWindowHandle(), ncsize->rgrc[0].left, ncsize->rgrc[0].top, ncsize->rgrc[0].right, ncsize->rgrc[0].bottom));295 OSLibWinCalcFrameRect(getOS2FrameWindowHandle(), &ncsize->rgrc[0], TRUE); //frame -> client296 dprintf(("NCHandleCalcSize Adjusted client rect (%d,%d) (%d,%d)", ncsize->rgrc[0].left, ncsize->rgrc[0].top, ncsize->rgrc[0].right, ncsize->rgrc[0].bottom));297 298 OffsetRect(&ncsize->rgrc[0], -ncsize->rgrc[0].left, -ncsize->rgrc[0].top);299 }300 #if 0301 //TODO: Docs say app should return 0 when fCalcValidRects == 0; Wine doesn't do this302 if(wParam == 0) //fCalcValidRects303 return 0;304 #endif305 return result;306 }307 /***********************************************************************308 * WIN_WindowNeedsWMBorder309 *310 * This method defines the rules for a window to have a WM border,311 * caption... It is used for consitency purposes.312 */313 BOOL Win32BaseWindow::WindowNeedsWMBorder( DWORD style, DWORD exStyle )314 {315 // if (!(style & WS_CHILD) && Options.managed &&316 if (!(style & WS_CHILD) &&317 (((style & WS_CAPTION) == WS_CAPTION) ||318 (style & WS_THICKFRAME)))319 return TRUE;320 return FALSE;321 }322 /******************************************************************************323 * NC_AdjustRectOuter95324 *325 * Computes the size of the "outside" parts of the window based on the326 * parameters of the client area.327 *328 + PARAMS329 * LPRECT16 rect330 * DWORD style331 * BOOL32 menu332 * DWORD exStyle333 *334 * NOTES335 * "Outer" parts of a window means the whole window frame, caption and336 * menu bar. It does not include "inner" parts of the frame like client337 * edge, static edge or scroll bars.338 *339 * Revision history340 * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)341 * Original (NC_AdjustRect95) cut & paste from NC_AdjustRect342 *343 * 20-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)344 * Split NC_AdjustRect95 into NC_AdjustRectOuter95 and345 * NC_AdjustRectInner95 and added handling of Win95 styles.346 *347 * 28-Jul-1999 Ove Kåven (ovek@arcticnet.no)348 * Streamlined window style checks.349 *350 *****************************************************************************/351 void Win32BaseWindow::NC_AdjustRectOuter(LPRECT rect, DWORD style, BOOL menu, DWORD exStyle)352 {353 if(style & WS_ICONIC) return;354 355 /* Decide if the window will be managed (see CreateWindowEx) */356 // if (!WindowNeedsWMBorder(style, exStyle))357 // {358 if (HAS_THICKFRAME( style, exStyle ))359 InflateRect( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) );360 else361 if (HAS_DLGFRAME( style, exStyle ))362 InflateRect(rect, GetSystemMetrics(SM_CXDLGFRAME), GetSystemMetrics(SM_CYDLGFRAME) );363 else364 if (HAS_THINFRAME( style ))365 InflateRect( rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));366 367 if ((style & WS_CAPTION) == WS_CAPTION)368 {369 if (exStyle & WS_EX_TOOLWINDOW)370 rect->top -= GetSystemMetrics(SM_CYSMCAPTION);371 else372 rect->top -= GetSystemMetrics(SM_CYCAPTION);373 }374 // }375 376 if (menu)377 rect->top -= GetSystemMetrics(SM_CYMENU);378 }379 /******************************************************************************380 * NC_AdjustRectInner95381 *382 * Computes the size of the "inside" part of the window based on the383 * parameters of the client area.384 *385 + PARAMS386 * LPRECT16 rect387 * DWORD style388 * DWORD exStyle389 *390 * NOTES391 * "Inner" part of a window means the window frame inside of the flat392 * window frame. It includes the client edge, the static edge and the393 * scroll bars.394 *395 * Revision history396 * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)397 * Original (NC_AdjustRect95) cut & paste from NC_AdjustRect398 *399 * 20-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)400 * Split NC_AdjustRect95 into NC_AdjustRectOuter95 and401 * NC_AdjustRectInner95 and added handling of Win95 styles.402 *403 *****************************************************************************/404 void Win32BaseWindow::NC_AdjustRectInner(LPRECT rect, DWORD style, DWORD exStyle)405 {406 if(style & WS_ICONIC) return;407 408 if (exStyle & WS_EX_CLIENTEDGE)409 InflateRect(rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));410 411 if (exStyle & WS_EX_STATICEDGE)412 InflateRect(rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));413 414 if (style & WS_VSCROLL) rect->right += GetSystemMetrics(SM_CXVSCROLL);415 if (style & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL);416 }417 177 /*********************************************************************** 418 178 * WINPOS_HandleWindowPosChanging16 -
trunk/src/user32/new/win32wmdichild.cpp
r2290 r2292 1 /* $Id: win32wmdichild.cpp,v 1. 6 2000-01-01 14:57:31cbratschi Exp $ */1 /* $Id: win32wmdichild.cpp,v 1.7 2000-01-02 19:30:45 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 MDI Child Window Class for OS/2 … … 506 506 { 507 507 INT nstagger; 508 RECT rect = *client->getClientRect();508 RECT rect; 509 509 INT spacing = GetSystemMetrics(SM_CYCAPTION) + 510 510 GetSystemMetrics(SM_CYFRAME) - 1; 511 511 512 client->getClientRect(&rect); 512 513 if( rect.bottom - rect.top - delta >= spacing ) 513 514 rect.bottom -= delta; … … 528 529 { 529 530 Win32MDIClientWindow *client = (Win32MDIClientWindow *)getParent(); 530 RECT rect = *client->getClientRect(); 531 531 RECT rect; 532 533 getClientRect(&rect); 532 534 if(client->getParent() == NULL) { 533 535 dprintf(("Win32MDIChildWindow::childGetMinMaxInfo:: client parent == NULL!!")); -
trunk/src/user32/new/win32wmdiclient.cpp
r2290 r2292 1 /* $Id: win32wmdiclient.cpp,v 1. 8 2000-01-01 14:57:31cbratschi Exp $ */1 /* $Id: win32wmdiclient.cpp,v 1.9 2000-01-02 19:30:46 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 MDI Client Window Class for OS/2 … … 101 101 AppendMenuA( hWindowMenu, MF_SEPARATOR, 0, NULL ); 102 102 103 setClientRect(frameWnd->getClientRect ());103 setClientRect(frameWnd->getClientRectPtr()); 104 104 105 105 dprintf(("MDIClient created - hwnd = %04x, idFirst = %u\n", getWindowHandle(), idFirstChild )); … … 694 694 { 695 695 INT nstagger; 696 RECT rect = *this->getClientRect();696 RECT rect; 697 697 INT spacing = GetSystemMetrics(SM_CYCAPTION) + 698 698 GetSystemMetrics(SM_CYFRAME) - 1; 699 699 700 getClientRect(&rect); 700 701 if( rect.bottom - rect.top - delta >= spacing ) 701 702 rect.bottom -= delta; -
trunk/src/user32/new/window.cpp
r2290 r2292 1 /* $Id: window.cpp,v 1.2 7 2000-01-01 14:57:34cbratschi Exp $ */1 /* $Id: window.cpp,v 1.28 2000-01-02 19:30:46 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 window apis for OS/2 … … 768 768 Win32BaseWindow *window; 769 769 770 if (!pRect) 771 { 772 SetLastError(ERROR_INVALID_PARAMETER); 773 return FALSE; 774 } 770 775 window = Win32BaseWindow::GetWindowFromHandle(hwnd); 771 776 if(!window) { 772 777 dprintf(("GetClientRect, window %x not found", hwnd)); 773 778 SetLastError(ERROR_INVALID_WINDOW_HANDLE); 774 return 0; 775 } 776 *pRect = *window->getClientRect(); 777 OffsetRect(pRect, -pRect->left, -pRect->top); 779 return FALSE; 780 } 781 window->getClientRect(pRect); 778 782 dprintf(("GetClientRect of %X returned (%d,%d) (%d,%d)\n", hwndWin32, pRect->left, pRect->top, pRect->right, pRect->bottom)); 779 783 return TRUE; … … 799 803 WS_EX_STATICEDGE | WS_EX_TOOLWINDOW); 800 804 if (exStyle & WS_EX_DLGMODALFRAME) style &= ~WS_THICKFRAME; 801 805 #if 0 //CB: todo 802 806 Win32BaseWindow::NC_AdjustRectOuter( rect, style, menu, exStyle ); 803 807 Win32BaseWindow::NC_AdjustRectInner( rect, style, exStyle ); 804 808 #endif 805 809 dprintf(("AdjustWindowRectEx returned (%d,%d)(%d,%d)\n", rect->left, rect->top, rect->right, rect->bottom)); 806 810 return TRUE; -
trunk/src/user32/new/winproc.cpp
r2290 r2292 1 /* $Id: winproc.cpp,v 1. 1 2000-01-01 14:57:38cbratschi Exp $ */1 /* $Id: winproc.cpp,v 1.2 2000-01-02 19:30:47 cbratschi Exp $ */ 2 2 /* 3 3 * Window procedure callbacks … … 49 49 50 50 /********************************************************************** 51 * 51 * WINPROC_GetPtr 52 52 * 53 53 * Return a pointer to the win proc. … … 59 59 60 60 if(ptr == NULL) { 61 61 return NULL; 62 62 } 63 63 … … 76 76 77 77 /********************************************************************** 78 * 78 * WINPROC_AllocWinProc 79 79 * 80 80 * Allocate a new window procedure. … … 91 91 /* Check if the function is already a win proc */ 92 92 93 if ((oldproc = WINPROC_GetPtr( func ))) 93 oldproc = WINPROC_GetPtr( func ); 94 if (oldproc) 94 95 { 95 96 *proc = *oldproc; … … 119 120 120 121 /********************************************************************** 121 * 122 * WINPROC_GetProc 122 123 * 123 124 * Get a window procedure pointer that can be passed to the Windows program. … … 135 136 136 137 /********************************************************************** 137 * 138 * WINPROC_SetProc 138 139 * 139 140 * Set the window procedure for a window or class. There are 140 141 * three tree classes of winproc callbacks: 141 142 * 142 * 1) class -> wp -not subclassed143 * class -> wp -> wp -> wp -> wp -SetClassLong()143 * 1) class -> wp - not subclassed 144 * class -> wp -> wp -> wp -> wp - SetClassLong() 144 145 * / / 145 * 2) window -' / -not subclassed146 * window -> wp -> wp ' -SetWindowLong()147 * 148 * 3) timer -> wp -SetTimer()149 * 150 * Initially, winproc of the window points to the current winproc 151 * thunk of its class. Subclassing prepends a new thunk to the 152 * window winproc chain at the head of the list. Thus, window thunk 153 * list includes class thunks and the latter are preserved when the 146 * 2) window -' / - not subclassed 147 * window -> wp -> wp ' - SetWindowLong() 148 * 149 * 3) timer -> wp - SetTimer() 150 * 151 * Initially, winproc of the window points to the current winproc 152 * thunk of its class. Subclassing prepends a new thunk to the 153 * window winproc chain at the head of the list. Thus, window thunk 154 * list includes class thunks and the latter are preserved when the 154 155 * window is destroyed. 155 156 * … … 162 163 163 164 if(func == NULL) { 164 165 165 *(WINDOWPROC **)pFirst = 0; 166 return TRUE; 166 167 } 167 168 … … 177 178 { 178 179 if ((*ppPrev)->user != user) 179 180 181 182 183 184 185 186 187 188 180 { 181 /* terminal thunk is being restored */ 182 183 WINPROC_FreeProc( *pFirst, (*ppPrev)->user ); 184 *(WINDOWPROC **)pFirst = *ppPrev; 185 return TRUE; 186 } 187 bRecycle = TRUE; 188 break; 189 } 189 190 } 190 191 else … … 197 198 } 198 199 } 199 200 200 201 /* WPF_CLASS thunk terminates window thunk list */ 201 202 if ((*ppPrev)->user != user) break; … … 229 230 230 231 /********************************************************************** 231 * 232 * WINPROC_FreeProc 232 233 * 233 234 * Free a list of win procs. … … 246 247 247 248 /********************************************************************** 248 * 249 * WINPROC_GetProcType 249 250 * 250 251 * Return the window procedure type. … … 259 260 260 261 /********************************************************************** 261 * CallWindowProc32A (USER32.18)262 * CallWindowProc32A (USER32.18) 262 263 * 263 264 * The CallWindowProc() function invokes the windows procedure _func_, … … 280 281 * CONFORMANCE 281 282 * 282 * ECMA-234, Win32 283 */ 284 LRESULT WINAPI CallWindowProcA( 283 * ECMA-234, Win32 284 */ 285 LRESULT WINAPI CallWindowProcA( 285 286 WNDPROC func, /* window procedure */ 286 287 HWND hwnd, /* target window */ … … 319 320 320 321 /********************************************************************** 321 * 322 * CallWindowProc32W (USER32.19) 322 323 */ 323 324 LRESULT WINAPI CallWindowProcW( WNDPROC func, HWND hwnd, UINT msg,
Note:
See TracChangeset
for help on using the changeset viewer.