X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b7d8f285c3df03a267d6ccb7ad38380f684310ea..36202885d48e85cc2012f5595ec1dfe00991e886:/src/os2/window.cpp diff --git a/src/os2/window.cpp b/src/os2/window.cpp index 14726230ab..2aef2aaeff 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -332,6 +332,7 @@ bool wxWindow::Create( { HWND hParent = NULLHANDLE; wxPoint vPos = rPos; // The OS/2 position + ULONG ulCreateFlags = 0L; wxCHECK_MSG(pParent, FALSE, wxT("can't create wxWindow without parent")); @@ -354,15 +355,25 @@ bool wxWindow::Create( // // OS2 uses normal coordinates, no bassackwards Windows ones // - nTempy = pParent->GetSize().y - (vPos.y + rSize.y); -#if 0 - if (nTempy < 0) + if (pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)) || + pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) + ) { - nTempy = pParent->GetSize().y + (vPos.y + rSize.y); - pParent->SetSize(0, 0, pParent->GetSize().x, nTempy); + wxWindow* pGrandParent = NULL; + + pGrandParent = pParent->GetParent(); + if (pGrandParent) + nTempy = pGrandParent->GetSize().y - (vPos.y + rSize.y); + else + nTempy = pParent->GetSize().y - (vPos.y + rSize.y); } -#endif + else + nTempy = pParent->GetSize().y - (vPos.y + rSize.y); vPos.y = nTempy; + if ( pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)) || + pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) + ) + ulCreateFlags |= WS_CLIPSIBLINGS; } else { @@ -373,9 +384,6 @@ bool wxWindow::Create( vPos.y = vRect.yTop - (vPos.y + rSize.y); } - ULONG ulCreateFlags = 0L; - - // // Most wxSTYLES are really PM Class specific styles and will be // set in those class create procs. PM's basic windows styles are @@ -384,7 +392,7 @@ bool wxWindow::Create( ulCreateFlags |= WS_VISIBLE; - if ( lStyle & wxCLIP_SIBLINGS ) + if (lStyle & wxCLIP_SIBLINGS) ulCreateFlags |= WS_CLIPSIBLINGS; if (lStyle & wxCLIP_CHILDREN ) @@ -728,7 +736,7 @@ void wxWindow::SetScrollbar( int nPageSize = nThumbVisible; SBCDATA vInfo; HWND hWnd = GetHwnd(); - ULONG ulStyle = WS_VISIBLE; + ULONG ulStyle = WS_VISIBLE | WS_SYNCPAINT; RECTL vRect; ::WinQueryWindowRect(hWnd, &vRect); @@ -752,7 +760,7 @@ void wxWindow::SetScrollbar( // registered as child windows of the window in order that child // windows may be scrolled without scrolling the scrollbars themselves! // - m_hWndScrollBarHorz = ::WinCreateWindow( HWND_DESKTOP + m_hWndScrollBarHorz = ::WinCreateWindow( hWnd ,WC_SCROLLBAR ,(PSZ)NULL ,ulStyle @@ -802,14 +810,14 @@ void wxWindow::SetScrollbar( ulStyle |= SBS_VERT; if (m_hWndScrollBarVert == 0L) { - m_hWndScrollBarVert = ::WinCreateWindow( HWND_DESKTOP + m_hWndScrollBarVert = ::WinCreateWindow( hWnd ,WC_SCROLLBAR ,(PSZ)NULL ,ulStyle ,vRect.xRight - 20 - ,vRect.yBottom + ,vRect.yBottom + 20 ,20 - ,vRect.yTop - vRect.yBottom + ,vRect.yTop - (vRect.yBottom + 20) ,hWnd ,HWND_TOP ,FID_VERTSCROLL @@ -837,9 +845,9 @@ void wxWindow::SetScrollbar( ::WinSetWindowPos( m_hWndScrollBarVert ,HWND_TOP ,vRect.xRight - 20 - ,vRect.yBottom + ,vRect.yBottom + 20 ,20 - ,vRect.yTop - vRect.yBottom + ,vRect.yTop - (vRect.yBottom + 20) ,SWP_ACTIVATE | SWP_MOVE | SWP_SIZE | SWP_SHOW ); } @@ -867,7 +875,15 @@ void wxWindow::ScrollWindow( vRect2.xRight = pRect->x + pRect->width; vRect2.yBottom = pRect->y; } + else + { + ::WinQueryWindowRect(GetHwnd(), &vRect2); + ::WinQueryWindowRect(m_hWndScrollBarHorz, &vRect); + vRect2.yBottom += vRect.yTop - vRect.yBottom; + ::WinQueryWindowRect(m_hWndScrollBarVert, &vRect); + vRect2.xRight -= vRect.xRight - vRect.xLeft; + } if (pRect) ::WinScrollWindow( GetHwnd() ,(LONG)nDx @@ -876,7 +892,7 @@ void wxWindow::ScrollWindow( ,NULL ,NULLHANDLE ,NULL - ,SW_SCROLLCHILDREN | SW_INVALIDATERGN + ,SW_INVALIDATERGN ); else ::WinScrollWindow( GetHwnd() @@ -886,8 +902,49 @@ void wxWindow::ScrollWindow( ,NULL ,NULLHANDLE ,NULL - ,SW_SCROLLCHILDREN | SW_INVALIDATERGN + ,SW_INVALIDATERGN ); + + // + // Move the children + wxWindowList::Node* pCurrent = GetChildren().GetFirst(); + SWP vSwp; + + while (pCurrent) + { + wxWindow* pChildWin = pCurrent->GetData(); + + if (pChildWin->GetHWND() != NULLHANDLE) + { + ::WinQueryWindowPos(pChildWin->GetHWND(), &vSwp); + ::WinQueryWindowRect(pChildWin->GetHWND(), &vRect); + if (pChildWin->GetHWND() == m_hWndScrollBarVert || + pChildWin->GetHWND() == m_hWndScrollBarHorz) + { + ::WinSetWindowPos( pChildWin->GetHWND() + ,HWND_TOP + ,vSwp.x + nDx + ,vSwp.y + nDy + ,0 + ,0 + ,SWP_MOVE | SWP_SHOW | SWP_ZORDER + ); + } + else + { + ::WinSetWindowPos( pChildWin->GetHWND() + ,HWND_BOTTOM + ,vSwp.x + nDx + ,vSwp.y + nDy + ,0 + ,0 + ,SWP_MOVE | SWP_ZORDER + ); + ::WinInvalidateRect(pChildWin->GetHWND(), &vRect, FALSE); + } + } + pCurrent = pCurrent->GetNext(); + } } // end of wxWindow::ScrollWindow // --------------------------------------------------------------------------- @@ -1277,7 +1334,10 @@ void wxWindow::DoGetClientSize( HWND hWndClient; RECTL vRect; - hWndClient = ::WinWindowFromID(GetHwnd(), FID_CLIENT); + if (IsKindOf(CLASSINFO(wxFrame))) + hWndClient = ::WinWindowFromID(GetHwnd(), FID_CLIENT); + else + hWndClient = NULLHANDLE; if( hWndClient == NULLHANDLE) ::WinQueryWindowRect(GetHwnd(), &vRect); else @@ -2540,10 +2600,8 @@ bool wxWindow::OS2Create( RECTL vParentRect; HWND hWndClient; - if (lX > -1L) - lX1 = lX; - if (lY > -1L) - lY1 = lY; + lX1 = lX; + lY1 = lY; if (lWidth > -1L) lWidth1 = lWidth; if (lHeight > -1L)