Changeset 1425 for trunk/src/user32/pmframe.cpp
- Timestamp:
- Oct 24, 1999, 1:05:05 AM (26 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32
-
Property svn:ignore
set to
user32.lrf
user32exp.def
resource.asm
-
Property svn:ignore
set to
-
trunk/src/user32/pmframe.cpp
r1408 r1425 1 /* $Id: pmframe.cpp,v 1.1 0 1999-10-23 10:21:43sandervl Exp $ */1 /* $Id: pmframe.cpp,v 1.11 1999-10-23 23:04:36 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Frame Managment Code for OS/2 … … 27 27 #define PMFRAMELOG 28 28 29 //****************************************************************************** 30 //****************************************************************************** 29 31 VOID Draw3DRect(HPS hps,RECTL rect,LONG colorBR,LONG colorTL) 30 32 { … … 47 49 GpiLine(hps,&point); 48 50 } 49 51 //****************************************************************************** 52 //****************************************************************************** 50 53 VOID DeflateRect(RECTL *rect) 51 54 { … … 55 58 rect->yBottom++; 56 59 } 57 60 //****************************************************************************** 61 //****************************************************************************** 58 62 VOID DrawFrame(HPS hps,RECTL *rect,Win32BaseWindow *win32wnd) 59 63 { … … 73 77 DeflateRect(rect); 74 78 Draw3DRect(hps,*rect,clrLight,clrBlack); 75 } else if (dwExStyle & WS_EX_DLGMODALFRAME_W) 79 } 80 else if (dwExStyle & WS_EX_DLGMODALFRAME_W) 76 81 { 77 82 Draw3DRect(hps,*rect,clrBlack,clrLight); … … 80 85 DeflateRect(rect); 81 86 Draw3DRect(hps,*rect,clrLight,clrLight); 82 } else if (dwExStyle & WS_EX_STATICEDGE_W) 87 } 88 else if (dwExStyle & WS_EX_STATICEDGE_W) 83 89 { 84 90 Draw3DRect(hps,*rect,clrWhite,clrDark); 85 } else if (dwExStyle & WS_EX_WINDOWEDGE_W); 91 } 92 else if (dwExStyle & WS_EX_WINDOWEDGE_W); 86 93 else if (dwStyle & WS_BORDER_W) 87 94 { … … 91 98 DeflateRect(rect); 92 99 } 93 100 //****************************************************************************** 101 //****************************************************************************** 94 102 BOOL CanDrawSizeBox(Win32BaseWindow *win32wnd) 95 103 { … … 98 106 && win32wnd->getHorzScrollHandle() && WinQueryWindow(win32wnd->getHorzScrollHandle(),QW_PARENT) == win32wnd->getOS2FrameWindowHandle()); 99 107 } 100 108 //****************************************************************************** 109 //****************************************************************************** 101 110 VOID GetSizeBox(Win32BaseWindow *win32wnd,RECTL *rect) 102 111 { … … 110 119 rect->yBottom = swpHorz.y; 111 120 } 112 121 //****************************************************************************** 122 //****************************************************************************** 113 123 BOOL InSizeBox(Win32BaseWindow *win32wnd,POINTS *points) 114 124 { … … 126 136 return FALSE; 127 137 } 128 138 //****************************************************************************** 139 //****************************************************************************** 129 140 VOID DrawSizeBox(HPS hps,RECTL rect) 130 141 { … … 156 167 } 157 168 } 158 169 //****************************************************************************** 170 //****************************************************************************** 171 void DrawActivate(Win32BaseWindow *win32wnd, HWND hwnd) 172 { 173 if (!win32wnd->isChild()) 174 { 175 if (CanDrawSizeBox(win32wnd)) 176 { 177 HPS hps; 178 RECTL rect; 179 180 GetSizeBox(win32wnd,&rect); 181 hps = WinGetClipPS(hwnd,0,PSF_CLIPCHILDREN | PSF_CLIPSIBLINGS); 182 DrawSizeBox(hps,rect); 183 WinReleasePS(hps); 184 185 } 186 } 187 else 188 { 189 HPS hps; 190 RECTL rect; 191 192 WinQueryWindowRect(hwnd,&rect); 193 rect.xRight = rect.xRight-rect.xLeft; 194 rect.yTop = rect.yTop-rect.yBottom; 195 rect.xLeft = rect.yBottom = 0; 196 hps = WinGetClipPS(hwnd,0,PSF_CLIPCHILDREN | PSF_CLIPSIBLINGS); 197 DrawFrame(hps,&rect,win32wnd); 198 WinReleasePS(hps); 199 } 200 } 159 201 //****************************************************************************** 160 202 //Win32 frame message handler … … 180 222 switch(msg) 181 223 { 182 #if 0224 #if 1 183 225 case WM_ADJUSTWINDOWPOS: 184 226 { … … 186 228 SWP swpOld; 187 229 WINDOWPOS wp; 188 ULONG parentHeight = 0; 189 HWND hParent = NULLHANDLE, hFrame = NULLHANDLE, hwndAfter; 190 191 dprintf(("PMFRAME: WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", hwnd, pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 230 HWND hParent = NULLHANDLE, hwndAfter; 231 232 dprintf(("PMFRAME: WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", win32wnd->getWindowHandle(), pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 192 233 193 234 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) 194 235 goto RunDefFrameProc; 236 195 237 if(!win32wnd->CanReceiveSizeMsgs()) { 196 goto RunDefFrameProc;238 break; 197 239 } 198 240 … … 208 250 } 209 251 hwndAfter = pswp->hwndInsertBehind; 210 hFrame = win32wnd->getOS2FrameWindowHandle(); 211 OSLibMapSWPtoWINDOWPOSFrame(pswp, &wp, &swpOld, hParent, hFrame); 252 OSLibMapSWPtoWINDOWPOSFrame(pswp, &wp, &swpOld, hParent, hwnd); 212 253 213 254 wp.hwnd = win32wnd->getWindowHandle(); … … 219 260 if(win32wnd->MsgPosChanging((LPARAM)&wp) == 0) 220 261 {//app or default window handler changed wp 221 dprintf((" OS2: WM_ADJUSTWINDOWPOS, app changed windowpos struct"));262 dprintf(("PMFRAME: WM_ADJUSTWINDOWPOS, app changed windowpos struct")); 222 263 dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 223 OSLibMapWINDOWPOStoSWP (&wp, pswp, &swpOld, hParent, hFrame);264 OSLibMapWINDOWPOStoSWPFrame(&wp, pswp, &swpOld, hParent, hwnd); 224 265 dprintf(("%x (%d,%d), (%d,%d)", pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 225 266 pswp->fl |= SWP_NOADJUST; 226 267 pswp->hwndInsertBehind = hwndAfter; 227 pswp->hwnd = h Frame;268 pswp->hwnd = hwnd; 228 269 229 270 RestoreOS2TIB(); … … 233 274 } 234 275 276 case WM_WINDOWPOSCHANGED: 277 { 278 PSWP pswp = (PSWP)mp1; 279 SWP swpOld = *(pswp + 1); 280 WINDOWPOS wp; 281 HWND hParent = NULLHANDLE; 282 LONG yDelta = pswp->cy - swpOld.cy; 283 LONG xDelta = pswp->cx - swpOld.cx; 284 285 dprintf(("PMFRAME: WM_WINDOWPOSCHANGED (%x) %x %x (%d,%d) (%d,%d)", mp2, win32wnd->getWindowHandle(), pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 286 287 RestoreOS2TIB(); 288 rc = OldFrameProc(hwnd,msg,mp1,mp2); 289 SetWin32TIB(); 290 291 if ((pswp->fl & (SWP_SIZE | SWP_MOVE | SWP_ZORDER)) == 0) 292 goto PosChangedEnd; 293 294 if(!win32wnd->CanReceiveSizeMsgs()) 295 goto PosChangedEnd; 296 297 if(pswp->fl & (SWP_MOVE | SWP_SIZE)) { 298 if (win32wnd->isChild()) { 299 if(win32wnd->getParent()) { 300 hParent = win32wnd->getParent()->getOS2WindowHandle(); 301 } 302 else goto PosChangedEnd; //parent has just been destroyed 303 } 304 } 305 OSLibMapSWPtoWINDOWPOSFrame(pswp, &wp, &swpOld, hParent, hwnd); 306 307 //delta is difference between old and new client height 308 yDelta = swpOld.cy - win32wnd->getWindowHeight(); 309 310 win32wnd->setWindowRect(wp.x, wp.y, wp.x+wp.cx, wp.y+wp.cy); 311 win32wnd->setClientRect(swpOld.x, swpOld.y, swpOld.x + swpOld.cx, swpOld.y + swpOld.cy); 312 313 wp.hwnd = win32wnd->getWindowHandle(); 314 if ((pswp->fl & SWP_ZORDER) && (pswp->hwndInsertBehind > HWND_BOTTOM)) 315 { 316 Win32BaseWindow *wndAfter = Win32BaseWindow::GetWindowFromOS2Handle(pswp->hwndInsertBehind); 317 if(wndAfter) wp.hwndInsertAfter = wndAfter->getWindowHandle(); 318 } 319 320 if (yDelta != 0 || xDelta != 0) 321 { 322 HENUM henum = WinBeginEnumWindows(WinWindowFromID(pswp->hwnd, FID_CLIENT)); 323 SWP swp[10]; 324 int i = 0; 325 HWND hwnd; 326 327 while ((hwnd = WinGetNextWindow(henum)) != NULLHANDLE) 328 { 329 #if 0 330 if (mdiClient ) 331 { 332 continue; 333 } 334 #endif 335 WinQueryWindowPos(hwnd, &(swp[i])); 336 337 #ifdef DEBUG 338 Win32BaseWindow *window = Win32BaseWindow::GetWindowFromOS2Handle(hwnd); 339 dprintf(("ENUMERATE %x delta %d (%d,%d) (%d,%d) %x", (window) ? window->getWindowHandle() : hwnd, 340 yDelta, swp[i].x, swp[i].y, swp[i].cx, swp[i].cy, swp[i].fl)); 341 #endif 342 343 if(swp[i].y != 0) { 344 //child window at offset <> 0 from client area -> offset now changes 345 swp[i].y += yDelta; 346 swp[i].fl &= ~(SWP_NOREDRAW); 347 } 348 //else child window with the same start coorindates as the client area 349 //The app should resize it. 350 351 if (i == 9) 352 { 353 WinSetMultWindowPos(GetThreadHAB(), swp, 10); 354 i = 0; 355 } 356 else 357 { 358 i++; 359 } 360 } 361 362 WinEndEnumWindows(henum); 363 364 if (i) 365 WinSetMultWindowPos(GetThreadHAB(), swp, i); 366 } 367 if (yDelta != 0) 368 { 369 POINT pt; 370 if(GetCaretPos (&pt) == TRUE) 371 { 372 pt.y -= yDelta; 373 SetCaretPos (pt.x, pt.y); 374 } 375 } 376 win32wnd->MsgPosChanged((LPARAM)&wp); 377 378 PosChangedEnd: 379 return rc; 380 } 381 #if 0 382 case WM_ENABLE: 383 dprintf(("PMFRAME: WM_ENABLE %x", win32wnd->getWindowHandle())); 384 win32wnd->MsgEnable(SHORT1FROMMP(mp1)); 385 goto RunDefFrameProc; 386 387 case WM_SHOW: 388 dprintf(("PMFRAME: WM_SHOW %x %d", win32wnd->getWindowHandle(), mp1)); 389 win32wnd->MsgShow((ULONG)mp1); 390 goto RunDefFrameProc; 391 392 case WM_ACTIVATE: 393 { 394 HWND hwndActivate = (HWND)mp2; 395 BOOL fMinimized = FALSE; 396 397 dprintf(("PMFRAME: WM_ACTIVATE %x %x", hwnd, hwndActivate)); 398 if(WinQueryWindowULong(hwndActivate, OFFSET_WIN32PM_MAGIC) != WIN32PM_MAGIC) { 399 //another (non-win32) application's window 400 //set to NULL (allowed according to win32 SDK) to avoid problems 401 hwndActivate = NULL; 402 } 403 if(WinQueryWindowULong(hwnd, QWL_STYLE) & WS_MINIMIZED) 404 { 405 fMinimized = TRUE; 406 } 407 408 win32wnd->MsgActivate(SHORT1FROMMP(mp1), fMinimized, Win32BaseWindow::OS2ToWin32Handle(hwndActivate)); 409 410 RestoreOS2TIB(); 411 MRESULT rc = OldFrameProc(hwnd,msg,mp1,mp2); 412 DrawActivate(win32wnd, hwnd); 413 return rc; 414 } 415 #else 416 case WM_ACTIVATE: 417 DrawActivate(win32wnd, hwnd); 418 goto RunDefFrameProc; 419 #endif 235 420 #else 236 421 case WM_ADJUSTWINDOWPOS: … … 242 427 if(wndchild && wndchild->isChild()) 243 428 { 429 #if 0 430 SWP swp = *pswp; 431 432 MRESULT rc = OldFrameProc(hwnd, msg, mp1, mp2); 433 pswp->x = swp.x; 434 pswp->y = swp.y; 435 pswp->fl = swp.fl; 436 #endif 244 437 dprintf(("PMFRAME: WM_ADJUSTWINDOWPOS %x %x %x (%d,%d) (%d,%d)", hwnd, pswp->hwnd, pswp->fl, pswp->x, pswp->y, pswp->cx, pswp->cy)); 245 438 RestoreOS2TIB(); … … 249 442 } 250 443 444 case WM_ACTIVATE: 445 DrawActivate(win32wnd, hwnd); 446 goto RunDefFrameProc; 251 447 #endif 252 448 … … 265 461 RestoreOS2TIB(); 266 462 return (MRESULT)TRUE; 267 } else if (win32wnd->isChild()) goto RunDefWndProc; 463 } 464 else if (win32wnd->isChild()) goto RunDefWndProc; 268 465 else goto RunDefFrameProc; 269 466 … … 277 474 RestoreOS2TIB(); 278 475 return (MRESULT)TRUE; 279 } else if (win32wnd->isChild()) goto RunDefWndProc; 476 } 477 else if (win32wnd->isChild()) goto RunDefWndProc; 280 478 else goto RunDefFrameProc; 281 479 … … 288 486 else goto RunDefFrameProc; 289 487 290 case WM_ ACTIVATE:488 case WM_PAINT: 291 489 #ifdef PMFRAMELOG 292 dprintf(("PMFRAME: WM_ ACTIVATE"));490 dprintf(("PMFRAME: WM_PAINT")); 293 491 #endif 294 492 if (!win32wnd->isChild()) … … 311 509 RestoreOS2TIB(); 312 510 return res; 313 } else goto RunDefFrameProc; 314 } else 511 } 512 else goto RunDefFrameProc; 513 } 514 else 315 515 { 316 MRESULT res;516 RECTL rect; 317 517 HPS hps; 318 RECTL rect; 319 320 RestoreOS2TIB(); 321 res = OldFrameProc(hwnd,msg,mp1,mp2); 518 519 RestoreOS2TIB(); 520 OldFrameProc(hwnd,msg,mp1,mp2); 322 521 SetWin32TIB(); 323 522 … … 331 530 332 531 RestoreOS2TIB(); 333 return res;334 }335 336 case WM_PAINT:337 #ifdef PMFRAMELOG338 dprintf(("PMFRAME: WM_PAINT"));339 #endif340 if (!win32wnd->isChild())341 {342 if (CanDrawSizeBox(win32wnd))343 {344 MRESULT res;345 HPS hps;346 RECTL rect;347 348 RestoreOS2TIB();349 res = OldFrameProc(hwnd,msg,mp1,mp2);350 SetWin32TIB();351 352 GetSizeBox(win32wnd,&rect);353 hps = WinGetClipPS(hwnd,0,PSF_CLIPCHILDREN | PSF_CLIPSIBLINGS);354 DrawSizeBox(hps,rect);355 WinReleasePS(hps);356 357 RestoreOS2TIB();358 return res;359 } else goto RunDefFrameProc;360 } else361 {362 RECTL rect;363 HPS hps;364 365 RestoreOS2TIB();366 OldFrameProc(hwnd,msg,mp1,mp2);367 SetWin32TIB();368 369 WinQueryWindowRect(hwnd,&rect);370 rect.xRight = rect.xRight-rect.xLeft;371 rect.yTop = rect.yTop-rect.yBottom;372 rect.xLeft = rect.yBottom = 0;373 hps = WinGetClipPS(hwnd,0,PSF_CLIPCHILDREN | PSF_CLIPSIBLINGS);374 DrawFrame(hps,&rect,win32wnd);375 WinReleasePS(hps);376 377 RestoreOS2TIB();378 532 return (MRESULT)0; 379 533 }
Note:
See TracChangeset
for help on using the changeset viewer.