Changeset 1281 for trunk/src/user32/win32wbase.cpp
- Timestamp:
- Oct 14, 1999, 11:22:43 AM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/win32wbase.cpp
r1265 r1281 1 /* $Id: win32wbase.cpp,v 1.4 0 1999-10-13 14:24:27sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.41 1999-10-14 09:22:42 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 40 40 #include "pmframe.h" 41 41 #include "win32wdesktop.h" 42 #include <wprocess.h> 42 43 43 44 #define HAS_DLGFRAME(style,exStyle) \ … … 96 97 { 97 98 isUnicode = FALSE; 98 fCreated = FALSE;99 99 fFirstShow = TRUE; 100 100 fIsDialog = FALSE; 101 101 fInternalMsg = FALSE; 102 fNoSizeMsg = FALSE; 102 103 103 104 windowNameA = NULL; … … 203 204 { 204 205 char buffer[256]; 205 INT sw = SW_SHOW;206 206 POINT maxSize, maxPos, minTrack, maxTrack; 207 207 … … 210 210 #endif 211 211 212 sw = SW_SHOW; 212 213 SetLastError(0); 213 214 … … 463 464 rectClient = rectWindow; 464 465 465 //CB: dwOSFrameStyle handled by OSLibWinConvertStyle466 // OSLibWinCreateWindow: perhaps problems467 // shouldn't we always use a frame? -> no problems with scrollbars468 469 466 if(HIWORD(cs->lpszName)) 470 467 { … … 474 471 } 475 472 473 //copy pointer of CREATESTRUCT for usage in MsgCreate method 474 tmpcs = cs; 475 476 //Store our window object pointer in thread local memory, so PMWINDOW.CPP can retrieve it 477 THDB *thdb = GetThreadTHDB(); 478 479 if(thdb == NULL) { 480 dprintf(("Window creation failed - thdb == NULL")); //this is VERY bad 481 ExitProcess(666); 482 return FALSE; 483 } 484 485 thdb->newWindow = (ULONG)this; 486 476 487 OS2Hwnd = OSLibWinCreateWindow((getParent()) ? getParent()->getOS2WindowHandle() : OSLIB_HWND_DESKTOP, 477 488 dwOSWinStyle, dwOSFrameStyle, (char *)windowNameA, … … 485 496 return FALSE; 486 497 } 498 SetLastError(0); 499 return TRUE; 500 } 501 //****************************************************************************** 502 //****************************************************************************** 503 BOOL Win32BaseWindow::MsgCreate(HWND hwndFrame, HWND hwndClient) 504 { 505 POINT maxPos; 506 CREATESTRUCTA *cs = tmpcs; //pointer to CREATESTRUCT used in CreateWindowExA method 507 508 OS2Hwnd = hwndClient; 509 OS2HwndFrame = hwndFrame; 510 // if(!isFrameWindow()) 511 // OS2HwndFrame = hwndClient; 487 512 488 513 if(OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, (ULONG)this) == FALSE) { … … 523 548 #endif 524 549 525 if ( cs->style & WS_HSCROLL)550 if (dwStyle & WS_HSCROLL) 526 551 { 527 552 hwndHorzScroll = OSLibWinQueryScrollBarHandle(OS2HwndFrame, OSLIB_HSCROLL); 528 OSLibWinShowScrollBar(OS2HwndFrame, hwndHorzScroll, OSLIB_HSCROLL, FALSE, TRUE);529 } 530 531 if ( cs->style & WS_VSCROLL) {553 // OSLibWinShowScrollBar(OS2HwndFrame, hwndHorzScroll, OSLIB_HSCROLL, FALSE, TRUE); 554 } 555 556 if (dwStyle & WS_VSCROLL) { 532 557 hwndVertScroll = OSLibWinQueryScrollBarHandle(OS2HwndFrame, OSLIB_VSCROLL); 533 OSLibWinShowScrollBar(OS2HwndFrame, hwndVertScroll, OSLIB_VSCROLL, FALSE, TRUE);558 // OSLibWinShowScrollBar(OS2HwndFrame, hwndVertScroll, OSLIB_VSCROLL, FALSE, TRUE); 534 559 } 535 560 … … 558 583 if(windowClass->getIcon()) 559 584 SetIcon(windowClass->getIcon()); 560 561 if(getParent()) {562 SetWindowPos(getParent()->getWindowHandle(), rectClient.left, rectClient.top,563 rectClient.right-rectClient.left,564 rectClient.bottom-rectClient.top,565 SWP_NOACTIVATE | SWP_NOZORDER );566 }567 else {568 SetWindowPos(HWND_TOP, rectClient.left, rectClient.top,569 rectClient.right-rectClient.left,570 rectClient.bottom-rectClient.top,571 SWP_NOACTIVATE);572 }573 585 574 586 //Subclass frame … … 580 592 } 581 593 582 //Get the client window rectangle583 GetClientRect(Win32Hwnd, &rectClient);584 585 594 /* Send the WM_CREATE message 586 595 * Perhaps we shouldn't allow width/height changes as well. … … 589 598 maxPos.x = rectWindow.left; maxPos.y = rectWindow.top; 590 599 600 fNoSizeMsg = TRUE; 601 if(getParent()) { 602 SetWindowPos(getParent()->getWindowHandle(), rectClient.left, rectClient.top, 603 rectClient.right-rectClient.left, 604 rectClient.bottom-rectClient.top, 605 SWP_NOACTIVATE | SWP_NOZORDER ); 606 } 607 else { 608 SetWindowPos(HWND_TOP, rectClient.left, rectClient.top, 609 rectClient.right-rectClient.left, 610 rectClient.bottom-rectClient.top, 611 SWP_NOACTIVATE); 612 } 613 fNoSizeMsg = FALSE; 614 591 615 if(SendMessageA(WM_NCCREATE, 0, (LPARAM)cs) ) 592 616 { 593 fCreated = TRUE; //Allow WM_SIZE messages now594 617 SendNCCalcSize(FALSE, &rectWindow, NULL, NULL, 0, &rectClient ); 595 618 … … 604 627 SendMessageA(WM_MOVE, 0, MAKELONG( rectClient.left, rectClient.top ) ); 605 628 } 629 606 630 if (cs->style & WS_VISIBLE) ShowWindow( sw ); 607 631 … … 617 641 } 618 642 dprintf(("Window creation FAILED (NCCREATE cancelled creation)")); 619 fCreated = FALSE;620 OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32WNDPTR, 0);621 OSLibWinSetWindowULong(OS2Hwnd, OFFSET_WIN32PM_MAGIC, 0);622 DestroyWindow();623 643 SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error 624 644 return FALSE; 625 }626 //******************************************************************************627 //******************************************************************************628 ULONG Win32BaseWindow::MsgCreate(HWND hwndOS2, ULONG initParam)629 {630 OS2Hwnd = hwndOS2;631 return SendInternalMessageA(WM_CREATE, 0, initParam);632 645 } 633 646 //****************************************************************************** … … 680 693 { 681 694 dprintf(("MsgPosChanging")); 682 #if 1 683 if(fCreated == FALSE) { 695 if(fNoSizeMsg) 684 696 return 1; 685 } 686 #endif 697 687 698 return SendInternalMessageA(WM_WINDOWPOSCHANGING, 0, lp); 688 699 } … … 692 703 { 693 704 dprintf(("MsgPosChanged")); 694 #if 1 695 if(fCreated == FALSE) { 705 if(fNoSizeMsg) 696 706 return 1; 697 } 698 #endif 707 699 708 return SendInternalMessageA(WM_WINDOWPOSCHANGED, 0, lp); 700 709 } … … 704 713 { 705 714 dprintf(("MsgMove to (%d,%d)", x, y)); 706 if(f Created == FALSE) {715 if(fNoSizeMsg) 707 716 return 1; 708 }709 717 710 718 return SendInternalMessageA(WM_MOVE, 0, MAKELONG((USHORT)x, (USHORT)y)); … … 755 763 { 756 764 WORD fwSizeType = 0; 757 758 if(fCreated == FALSE) {//Solitaire crashes if it receives a WM_SIZE during CreateWindowEx (normal or our fault?)759 return 1;760 }761 765 762 766 if(fMinimize) { … … 1115 1119 } 1116 1120 //****************************************************************************** 1121 //****************************************************************************** 1122 BOOL Win32BaseWindow::isFrameWindow() 1123 { 1124 if((getParent() == NULL || getParent() == windowDesktop) && ((dwStyle & WS_CAPTION) == WS_CAPTION)) 1125 return TRUE; 1126 1127 return FALSE; 1128 } 1129 //****************************************************************************** 1117 1130 //TODO: Not complete (flags) 1118 1131 //****************************************************************************** … … 1176 1189 { 1177 1190 infoPtr->Page = info->nPage; 1191 dprintf(("SetScrollInfo: Set pagesize to %d", info->nPage)); 1178 1192 OSLibWinSetScrollPageSize(OS2HwndFrame, hwndScroll, info->nPage, infoPtr->MaxVal, fRedraw); 1179 1193 } … … 1186 1200 { 1187 1201 infoPtr->CurVal = info->nPos; 1202 dprintf(("SetScrollInfo: Set scroll position to %d", info->nPos)); 1188 1203 OSLibWinSetScrollPos(OS2HwndFrame, hwndScroll, info->nPos, fRedraw); 1189 1204 } … … 1208 1223 infoPtr->MaxVal = info->nMax; 1209 1224 1225 dprintf(("SetScrollInfo: Set scroll range to (%d,%d)", info->nMin, info->nMax)); 1210 1226 OSLibWinSetScrollRange(OS2HwndFrame, hwndScroll, info->nMin, info->nMax, fRedraw); 1211 1227 } … … 1984 2000 { 1985 2001 hParent = getParent()->getOS2WindowHandle(); 1986 OSLibWinQueryWindowPos(isFrameWindow() ? OS2HwndFrame:OS2Hwnd, &swpOld);1987 2002 } 1988 else 1989 OSLibWinQueryWindowPos(OS2HwndFrame, &swpOld); 2003 OSLibWinQueryWindowPos(OS2HwndFrame, &swpOld); 1990 2004 } 1991 2005 … … 1994 2008 return TRUE; 1995 2009 1996 if ((swp.fl & SWPOS_ZORDER) && (swp.hwndInsertBehind > HWNDOS_BOTTOM)) 2010 // if ((swp.fl & SWPOS_ZORDER) && (swp.hwndInsertBehind > HWNDOS_BOTTOM)) 2011 if ((swp.hwndInsertBehind > HWNDOS_BOTTOM)) 1997 2012 { 1998 Win32BaseWindow *wndBehind = Win32BaseWindow::GetWindowFromHandle(swp.hwndInsertBehind); 1999 swp.hwndInsertBehind = wndBehind->getOS2WindowHandle(); 2013 Win32BaseWindow *wndBehind = Win32BaseWindow::GetWindowFromHandle(swp.hwndInsertBehind); 2014 if(wndBehind) { 2015 swp.hwndInsertBehind = wndBehind->getOS2WindowHandle(); 2016 } 2017 else { 2018 dprintf(("ERROR: SetWindowPos: hwndInsertBehind %x invalid!",swp.hwndInsertBehind)); 2019 swp.hwndInsertBehind = 0; 2020 } 2000 2021 } 2022 #if 0 2001 2023 if (isFrameWindow()) 2002 2024 { … … 2015 2037 } 2016 2038 else 2017 swp.hwnd = OS2Hwnd; 2039 #endif 2040 swp.hwnd = OS2HwndFrame; 2018 2041 2019 2042 dprintf (("WinSetWindowPos %x %x (%d,%d)(%d,%d) %x", swp.hwnd, swp.hwndInsertBehind, swp.x, swp.y, swp.cx, swp.cy, swp.fl));
Note:
See TracChangeset
for help on using the changeset viewer.