Changeset 1265 for trunk/src/user32/win32wbase.cpp
- Timestamp:
- Oct 13, 1999, 4:24:49 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/win32wbase.cpp
r1261 r1265 1 /* $Id: win32wbase.cpp,v 1. 39 1999-10-12 18:51:38sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.40 1999-10-13 14:24:27 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 43 43 #define HAS_DLGFRAME(style,exStyle) \ 44 44 (((exStyle) & WS_EX_DLGMODALFRAME) || \ 45 (((style) & WS_DLGFRAME) && !((style) & WS_ BORDER)))46 47 #define HAS_THICKFRAME(style ) \45 (((style) & WS_DLGFRAME) && !((style) & WS_THICKFRAME))) 46 47 #define HAS_THICKFRAME(style,exStyle) \ 48 48 (((style) & WS_THICKFRAME) && \ 49 !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME)) 49 !((exStyle) & WS_EX_DLGMODALFRAME)) 50 51 #define HAS_THINFRAME(style) \ 52 (((style) & WS_BORDER) || !((style) & (WS_CHILD | WS_POPUP))) 53 54 #define HAS_BIGFRAME(style,exStyle) \ 55 (((style) & (WS_THICKFRAME | WS_DLGFRAME)) || \ 56 ((exStyle) & WS_EX_DLGMODALFRAME)) 57 58 #define HAS_ANYFRAME(style,exStyle) \ 59 (((style) & (WS_THICKFRAME | WS_DLGFRAME | WS_BORDER)) || \ 60 ((exStyle) & WS_EX_DLGMODALFRAME) || \ 61 !((style) & (WS_CHILD | WS_POPUP))) 50 62 51 63 #define HAS_3DFRAME(exStyle) \ … … 436 448 } 437 449 450 DWORD dwOSWinStyle, dwOSFrameStyle; 451 452 OSLibWinConvertStyle(cs->style, &cs->dwExStyle, &dwOSWinStyle, &dwOSFrameStyle, &borderWidth, &borderHeight); 453 dwExStyle = cs->dwExStyle; 454 455 //SvL: Add bordersize 456 cs->cy += 2*borderHeight; 457 cs->cx += 2*borderWidth; 458 438 459 rectWindow.left = cs->x; 439 460 rectWindow.top = cs->y; … … 441 462 rectWindow.bottom = cs->y + cs->cy; 442 463 rectClient = rectWindow; 443 444 DWORD dwOSWinStyle, dwOSFrameStyle;445 446 OSLibWinConvertStyle(cs->style, &cs->dwExStyle, &dwOSWinStyle, &dwOSFrameStyle, &borderWidth, &borderHeight);447 dwExStyle = cs->dwExStyle;448 464 449 465 //CB: dwOSFrameStyle handled by OSLibWinConvertStyle … … 573 589 maxPos.x = rectWindow.left; maxPos.y = rectWindow.top; 574 590 575 fCreated = TRUE; //Allow WM_SIZE messages now576 591 if(SendMessageA(WM_NCCREATE, 0, (LPARAM)cs) ) 577 592 { 578 //doesn't work right, messes up client rectangle 579 #if 0 593 fCreated = TRUE; //Allow WM_SIZE messages now 580 594 SendNCCalcSize(FALSE, &rectWindow, NULL, NULL, 0, &rectClient ); 581 #endif 595 582 596 OffsetRect(&rectWindow, maxPos.x - rectWindow.left, maxPos.y - rectWindow.top); 583 597 dprintf(("Sending WM_CREATE")); … … 609 623 SetLastError(ERROR_OUTOFMEMORY); //TODO: Better error 610 624 return FALSE; 611 }612 #if 0613 /***********************************************************************614 * WINPOS_MinMaximize615 *616 * Fill in lpRect and return additional flags to be used with SetWindowPos().617 * This function assumes that 'cmd' is different from the current window618 * state.619 */620 UINT Win32BaseWindow::MinMaximize(UINT cmd, LPRECT lpRect )621 {622 UINT swpFlags = 0;623 POINT pt, size;624 LPINTERNALPOS lpPos;625 626 size.x = rectWindow.left; size.y = rectWindow.top;627 lpPos = WINPOS_InitInternalPos( wndPtr, size, &rectWindow );628 629 if (lpPos && !HOOK_CallHooks16(WH_CBT, HCBT_MINMAX, hwndSelf, cmd))630 {631 if( dwStyle & WS_MINIMIZE )632 {633 if( !SendMessageA(WM_QUERYOPEN, 0, 0L ) )634 return (SWP_NOSIZE | SWP_NOMOVE);635 swpFlags |= SWP_NOCOPYBITS;636 }637 switch( cmd )638 {639 case SW_MINIMIZE:640 if( dwStyle & WS_MAXIMIZE)641 {642 flags |= WIN_RESTORE_MAX;643 dwStyle &= ~WS_MAXIMIZE;644 }645 else646 flags &= ~WIN_RESTORE_MAX;647 dwStyle |= WS_MINIMIZE;648 649 #if 0650 if( flags & WIN_NATIVE )651 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, TRUE ) )652 swpFlags |= MINMAX_NOSWP;653 #endif654 655 lpPos->ptIconPos = WINPOS_FindIconPos( wndPtr, lpPos->ptIconPos );656 657 SetRect(lpRect, lpPos->ptIconPos.x, lpPos->ptIconPos.y,658 GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) );659 swpFlags |= SWP_NOCOPYBITS;660 break;661 662 case SW_MAXIMIZE:663 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL );664 665 if( dwStyle & WS_MINIMIZE )666 {667 if( flags & WIN_NATIVE )668 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )669 swpFlags |= MINMAX_NOSWP;670 671 WINPOS_ShowIconTitle( wndPtr, FALSE );672 dwStyle &= ~WS_MINIMIZE;673 }674 dwStyle |= WS_MAXIMIZE;675 676 SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,677 size.x, size.y );678 break;679 680 case SW_RESTORE:681 if( dwStyle & WS_MINIMIZE )682 {683 if( flags & WIN_NATIVE )684 if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )685 swpFlags |= MINMAX_NOSWP;686 687 dwStyle &= ~WS_MINIMIZE;688 WINPOS_ShowIconTitle( wndPtr, FALSE );689 690 if( flags & WIN_RESTORE_MAX)691 {692 /* Restore to maximized position */693 CONV_POINT16TO32( &lpPos->ptMaxPos, &pt );694 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL);695 CONV_POINT32TO16( &pt, &lpPos->ptMaxPos );696 dwStyle |= WS_MAXIMIZE;697 SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, size.x, size.y );698 break;699 }700 }701 else702 if( !(dwStyle & WS_MAXIMIZE) ) return (UINT16)(-1);703 else dwStyle &= ~WS_MAXIMIZE;704 705 /* Restore to normal position */706 707 *lpRect = lpPos->rectNormal;708 lpRect->right -= lpRect->left;709 lpRect->bottom -= lpRect->top;710 711 break;712 }713 } else swpFlags |= SWP_NOSIZE | SWP_NOMOVE;714 return swpFlags;715 }716 #endif717 /*******************************************************************718 * GetMinMaxInfo719 *720 * Get the minimized and maximized information for a window.721 */722 void Win32BaseWindow::GetMinMaxInfo(POINT *maxSize, POINT *maxPos,723 POINT *minTrack, POINT *maxTrack )724 {725 MINMAXINFO MinMax;726 INT xinc, yinc;727 728 /* Compute default values */729 730 MinMax.ptMaxSize.x = GetSystemMetrics(SM_CXSCREEN);731 MinMax.ptMaxSize.y = GetSystemMetrics(SM_CYSCREEN);732 MinMax.ptMinTrackSize.x = GetSystemMetrics(SM_CXMINTRACK);733 MinMax.ptMinTrackSize.y = GetSystemMetrics(SM_CYMINTRACK);734 MinMax.ptMaxTrackSize.x = GetSystemMetrics(SM_CXSCREEN);735 MinMax.ptMaxTrackSize.y = GetSystemMetrics(SM_CYSCREEN);736 737 if (flags & WIN_MANAGED) xinc = yinc = 0;738 else if (HAS_DLGFRAME( dwStyle, dwExStyle ))739 {740 xinc = GetSystemMetrics(SM_CXDLGFRAME);741 yinc = GetSystemMetrics(SM_CYDLGFRAME);742 }743 else744 {745 xinc = yinc = 0;746 if (HAS_THICKFRAME(dwStyle))747 {748 xinc += GetSystemMetrics(SM_CXFRAME);749 yinc += GetSystemMetrics(SM_CYFRAME);750 }751 if (dwStyle & WS_BORDER)752 {753 xinc += GetSystemMetrics(SM_CXBORDER);754 yinc += GetSystemMetrics(SM_CYBORDER);755 }756 }757 MinMax.ptMaxSize.x += 2 * xinc;758 MinMax.ptMaxSize.y += 2 * yinc;759 760 #if 0761 lpPos = (LPINTERNALPOS)GetPropA( hwndSelf, atomInternalPos );762 if( lpPos && !EMPTYPOINT(lpPos->ptMaxPos) )763 CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition );764 else765 {766 #endif767 MinMax.ptMaxPosition.x = -xinc;768 MinMax.ptMaxPosition.y = -yinc;769 // }770 771 SendMessageA(WM_GETMINMAXINFO, 0, (LPARAM)&MinMax );772 773 /* Some sanity checks */774 775 dprintf(("GetMinMaxInfo: %ld %ld / %ld %ld / %ld %ld / %ld %ld\n",776 MinMax.ptMaxSize.x, MinMax.ptMaxSize.y,777 MinMax.ptMaxPosition.x, MinMax.ptMaxPosition.y,778 MinMax.ptMaxTrackSize.x, MinMax.ptMaxTrackSize.y,779 MinMax.ptMinTrackSize.x, MinMax.ptMinTrackSize.y));780 MinMax.ptMaxTrackSize.x = MAX( MinMax.ptMaxTrackSize.x,781 MinMax.ptMinTrackSize.x );782 MinMax.ptMaxTrackSize.y = MAX( MinMax.ptMaxTrackSize.y,783 MinMax.ptMinTrackSize.y );784 785 if (maxSize) *maxSize = MinMax.ptMaxSize;786 if (maxPos) *maxPos = MinMax.ptMaxPosition;787 if (minTrack) *minTrack = MinMax.ptMinTrackSize;788 if (maxTrack) *maxTrack = MinMax.ptMaxTrackSize;789 }790 /***********************************************************************791 * WINPOS_SendNCCalcSize792 *793 * Send a WM_NCCALCSIZE message to a window.794 * All parameters are read-only except newClientRect.795 * oldWindowRect, oldClientRect and winpos must be non-NULL only796 * when calcValidRect is TRUE.797 */798 LONG Win32BaseWindow::SendNCCalcSize(BOOL calcValidRect, RECT *newWindowRect, RECT *oldWindowRect,799 RECT *oldClientRect, WINDOWPOS *winpos,800 RECT *newClientRect )801 {802 NCCALCSIZE_PARAMS params;803 WINDOWPOS winposCopy;804 LONG result;805 806 params.rgrc[0] = *newWindowRect;807 if (calcValidRect)808 {809 winposCopy = *winpos;810 params.rgrc[1] = *oldWindowRect;811 params.rgrc[2] = *oldClientRect;812 params.lppos = &winposCopy;813 }814 result = SendMessageA(WM_NCCALCSIZE, calcValidRect,815 (LPARAM)¶ms );816 *newClientRect = params.rgrc[0];817 return result;818 625 } 819 626 //****************************************************************************** … … 1611 1418 return(TRUE); 1612 1419 1420 case WM_NCCALCSIZE: 1421 return NCHandleCalcSize(wParam, (NCCALCSIZE_PARAMS *)lParam); 1422 1613 1423 case WM_CTLCOLORMSGBOX: 1614 1424 case WM_CTLCOLOREDIT: … … 2165 1975 wpos.hwnd = getWindowHandle(); 2166 1976 1977 //SvL: Add bordersize 1978 wpos.cy += 2*borderHeight; 1979 wpos.cx += 2*borderWidth; 1980 2167 1981 if(~fuFlags & (SWP_NOMOVE | SWP_NOSIZE)) 2168 1982 { … … 2198 2012 if (swp.cy < minTrack.y) swp.cy = minTrack.y; 2199 2013 } 2200 2201 2014 swp.hwnd = OS2HwndFrame; 2202 2015 }
Note:
See TracChangeset
for help on using the changeset viewer.