Changeset 397 for trunk/src/user32/new/win32wnd.cpp
- Timestamp:
- Jul 26, 1999, 11:01:34 AM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/win32wnd.cpp
r392 r397 1 /* $Id: win32wnd.cpp,v 1.2 2 1999-07-25 15:51:56sandervl Exp $ */1 /* $Id: win32wnd.cpp,v 1.23 1999-07-26 09:01:34 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Code for OS/2 … … 41 41 !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME)) 42 42 43 #define HAS_BORDER(style, exStyle) \ 44 ((style & WS_BORDER) || HAS_THICKFRAME(style) || HAS_DLGFRAME(style,exStyle)) 45 43 46 //****************************************************************************** 44 47 //****************************************************************************** … … 235 238 } 236 239 240 if (cs->x < 0) cs->x = 0; 241 if (cs->y < 0) cs->y = 0; 242 237 243 //Allocate window words 238 244 nrUserWindowLong = windowClass->getExtraWndWords(); … … 345 351 DWORD dwOSWinStyle, dwOSFrameStyle; 346 352 347 OSLibWinConvertStyle(cs->style, &dwOSWinStyle, &dwOSFrameStyle); 348 349 OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : 0, 353 OSLibWinConvertStyle(cs->style, cs->dwExStyle, &dwOSWinStyle, &dwOSFrameStyle); 354 355 //TODO: Test 356 #if 1 357 if(cs->style & WS_CHILD) { 358 dwOSFrameStyle = 0; 359 } 360 #endif 361 362 OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2FrameWindowHandle() : OSLIB_HWND_DESKTOP, 350 363 dwOSWinStyle, dwOSFrameStyle, (char *)cs->lpszName, 351 (owner) ? owner->getOS2 WindowHandle() : 0,364 (owner) ? owner->getOS2FrameWindowHandle() : OSLIB_HWND_DESKTOP, 352 365 (hwndLinkAfter == HWND_BOTTOM) ? TRUE : FALSE, 353 366 &OS2HwndFrame); … … 378 391 } 379 392 #endif 393 380 394 /* Set the window menu */ 381 395 if ((dwStyle & (WS_CAPTION | WS_CHILD)) == WS_CAPTION ) … … 396 410 SetIcon(windowClass->getIcon()); 397 411 412 if(getParent()) { 413 SetWindowPos(getParent()->getWindowHandle(), rectClient.left, rectClient.top, 414 rectClient.right-rectClient.left, 415 rectClient.bottom-rectClient.top, 416 SWP_NOACTIVATE); 417 } 418 else { 419 SetWindowPos(HWND_TOP, rectClient.left, rectClient.top, 420 rectClient.right-rectClient.left, 421 rectClient.bottom-rectClient.top, 422 SWP_NOACTIVATE); 423 } 424 //Get the client window rectangle 425 GetClientRect(Win32Hwnd, &rectClient); 426 398 427 /* Send the WM_CREATE message 399 428 * Perhaps we shouldn't allow width/height changes as well. … … 404 433 if(SendInternalMessage(WM_NCCREATE, 0, (LPARAM)cs) ) 405 434 { 435 //doesn't work right, messes up client rectangle 436 #if 0 406 437 SendNCCalcSize(FALSE, &rectWindow, NULL, NULL, 0, &rectClient ); 438 #endif 407 439 OffsetRect(&rectWindow, maxPos.x - rectWindow.left, maxPos.y - rectWindow.top); 408 440 dprintf(("Sending WM_CREATE")); … … 415 447 SendMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) ); 416 448 } 417 SetWindowPos(HWND_TOP, rectClient.left, rectClient.top,418 rectClient.right-rectClient.left,419 rectClient.bottom-rectClient.top,420 SWP_NOACTIVATE);421 449 if (cs->style & WS_VISIBLE) ShowWindow( sw ); 422 450 … … 432 460 } 433 461 } 462 OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, 0); 463 OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, 0); 464 DestroyWindow(); 434 465 return FALSE; 435 466 } … … 469 500 else 470 501 flags &= ~WIN_RESTORE_MAX; 471 dwStyle |= WS_MINIMIZE;502 dwStyle |= WS_MINIMIZE; 472 503 473 504 #if 0 … … 680 711 ULONG Win32Window::MsgEnable(BOOL fEnable) 681 712 { 682 return SendInternalMessageA(WM_ENABLE, fEnable, 0);713 return SendInternalMessageA(WM_ENABLE, fEnable, 0); 683 714 } 684 715 //****************************************************************************** … … 687 718 ULONG Win32Window::MsgShow(BOOL fShow) 688 719 { 689 return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0);720 return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0); 690 721 } 691 722 //****************************************************************************** … … 693 724 ULONG Win32Window::MsgMove(ULONG x, ULONG y) 694 725 { 695 dprintf(("MsgMove to (%d,%d)", x, y)); 696 return SendInternalMessageA(WM_MOVE, 0, MAKELONG((USHORT)x, (USHORT)y)); 726 dprintf(("MsgMove to (%d,%d)", x, y)); 727 if(fCreated == FALSE) { 728 return 1; 729 } 730 731 return SendInternalMessageA(WM_MOVE, 0, MAKELONG((USHORT)x, (USHORT)y)); 697 732 } 698 733 //****************************************************************************** … … 1352 1387 ULONG setstate = 0; 1353 1388 1354 switch(hwndInsertAfter) {1389 switch(hwndInsertAfter) { 1355 1390 case HWND_BOTTOM: 1356 1391 hwndInsertAfter = HWNDOS_BOTTOM; … … 1365 1400 if(window) { 1366 1401 hwndInsertAfter = window->getOS2WindowHandle(); 1402 PRECT clientRect = window->getClientRect(); 1403 1404 #if 0 1405 if(x+cx > clientRect->right - clientRect->left) { 1406 cx = (clientRect->right - clientRect->left) - x; 1407 } 1408 if(y+cy > clientRect->bottom - clientRect->top) { 1409 cy = (clientRect->bottom - clientRect->top) - y; 1410 } 1411 #endif 1412 //TODO: Not quite right (Solitaire child window placement slightly wrong) 1413 if (HAS_DLGFRAME(window->getStyle(), window->getExStyle() )) 1414 { 1415 x += GetSystemMetrics(SM_CXDLGFRAME); 1416 y -= GetSystemMetrics(SM_CYDLGFRAME); 1417 } 1418 else 1419 { 1420 if (HAS_THICKFRAME(window->getStyle())) 1421 { 1422 x += GetSystemMetrics(SM_CXFRAME); 1423 y -= GetSystemMetrics(SM_CYFRAME); 1424 } 1425 if (window->getStyle() & WS_BORDER) 1426 { 1427 x += GetSystemMetrics(SM_CXBORDER); 1428 y -= GetSystemMetrics(SM_CYBORDER); 1429 } 1430 } 1367 1431 } 1368 1432 else { … … 1370 1434 hwndInsertAfter = 0; 1371 1435 } 1436 1372 1437 break; 1373 1438 1374 } 1375 setstate = SWPOS_MOVE | SWPOS_SIZE | SWPOS_ACTIVATE | SWPOS_ZORDER; 1376 if(fuFlags & SWP_DRAWFRAME) 1377 setstate |= 0; //TODO 1378 if(fuFlags & SWP_FRAMECHANGED) 1379 setstate |= 0; //TODO 1380 if(fuFlags & SWP_HIDEWINDOW) 1381 setstate &= ~SWPOS_ZORDER; 1382 if(fuFlags & SWP_NOACTIVATE) 1383 setstate &= ~SWPOS_ACTIVATE; 1384 if(fuFlags & SWP_NOCOPYBITS) 1385 setstate |= 0; //TODO 1386 if(fuFlags & SWP_NOMOVE) 1387 setstate &= ~SWPOS_MOVE; 1388 if(fuFlags & SWP_NOSIZE) 1389 setstate &= ~SWPOS_SIZE; 1390 if(fuFlags & SWP_NOREDRAW) 1391 setstate |= SWPOS_NOREDRAW; 1392 if(fuFlags & SWP_NOZORDER) 1393 setstate &= ~SWPOS_ZORDER; 1394 if(fuFlags & SWP_SHOWWINDOW) 1395 setstate |= SWPOS_SHOW; 1396 1397 return OSLibWinSetWindowPos(OS2HwndFrame, hwndInsertAfter, x, y, cx, cy, setstate); 1439 } 1440 setstate = SWPOS_MOVE | SWPOS_SIZE | SWPOS_ACTIVATE | SWPOS_ZORDER; 1441 if(fuFlags & SWP_DRAWFRAME) 1442 setstate |= 0; //TODO 1443 if(fuFlags & SWP_FRAMECHANGED) 1444 setstate |= 0; //TODO 1445 if(fuFlags & SWP_HIDEWINDOW) 1446 setstate &= ~SWPOS_ZORDER; 1447 if(fuFlags & SWP_NOACTIVATE) 1448 setstate &= ~SWPOS_ACTIVATE; 1449 if(fuFlags & SWP_NOCOPYBITS) 1450 setstate |= 0; //TODO 1451 if(fuFlags & SWP_NOMOVE) 1452 setstate &= ~SWPOS_MOVE; 1453 if(fuFlags & SWP_NOSIZE) 1454 setstate &= ~SWPOS_SIZE; 1455 if(fuFlags & SWP_NOREDRAW) 1456 setstate |= SWPOS_NOREDRAW; 1457 if(fuFlags & SWP_NOZORDER) 1458 setstate &= ~SWPOS_ZORDER; 1459 if(fuFlags & SWP_SHOWWINDOW) 1460 setstate |= SWPOS_SHOW; 1461 1462 //TODO send NCCREATE if size changed or SWP_FRAMECHANGED flag specified. 1463 return OSLibWinSetWindowPos(OS2HwndFrame, hwndInsertAfter, x, y, cx, cy, setstate); 1398 1464 } 1399 1465 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.