From b3260bce473ab247edd8ca1d3aee4eb648b4b97e Mon Sep 17 00:00:00 2001 From: David Webster Date: Thu, 31 Jan 2002 22:48:09 +0000 Subject: [PATCH] Lots of fixes for scrolling git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13944 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/os2/app.cpp | 3 +- src/os2/button.cpp | 9 +-- src/os2/checkbox.cpp | 18 +++--- src/os2/choice.cpp | 8 ++- src/os2/combobox.cpp | 9 ++- src/os2/control.cpp | 9 --- src/os2/gauge.cpp | 17 +++--- src/os2/listbox.cpp | 17 +++--- src/os2/ownerdrw.cpp | 1 - src/os2/radiobox.cpp | 15 +++-- src/os2/radiobut.cpp | 8 ++- src/os2/slider.cpp | 47 ++++------------ src/os2/spinbutt.cpp | 17 +++--- src/os2/spinctrl.cpp | 17 +++--- src/os2/statbox.cpp | 8 ++- src/os2/stattext.cpp | 17 +++--- src/os2/textctrl.cpp | 14 ++--- src/os2/toplevel.cpp | 4 +- src/os2/window.cpp | 128 ++++++++++++++++++++++++++++++++++++------- 19 files changed, 206 insertions(+), 160 deletions(-) diff --git a/src/os2/app.cpp b/src/os2/app.cpp index 7bcf7d2b7d..8062159328 100644 --- a/src/os2/app.cpp +++ b/src/os2/app.cpp @@ -901,7 +901,8 @@ bool wxApp::ProcessMessage( if (pMsg->msg == WM_TIMER && (SHORT1FROMMP(pMsg->mp1) != TID_CURSOR && SHORT1FROMMP(pMsg->mp1) != TID_FLASHWINDOW && - SHORT1FROMMP(pMsg->mp1) != TID_SCROLL + SHORT1FROMMP(pMsg->mp1) != TID_SCROLL && + SHORT1FROMMP(pMsg->mp1) != 0x0000 )) wxTimerProc(NULL, 0, (int)pMsg->mp1, 0); diff --git a/src/os2/button.cpp b/src/os2/button.cpp index 33634d0a7a..19977b783a 100644 --- a/src/os2/button.cpp +++ b/src/os2/button.cpp @@ -71,14 +71,6 @@ bool wxButton::Create( // if (m_windowStyle & wxCLIP_SIBLINGS ) lStyle |= WS_CLIPSIBLINGS; - // - // If the parent is a scrolled window the controls must - // have this style or they will overlap the scrollbars - // - if (pParent) - if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) || - pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow))) - lStyle |= WS_CLIPSIBLINGS; m_hWnd = (WXHWND)::WinCreateWindow( GetHwndOf(pParent) // Parent handle ,WC_BUTTON // A Button class window @@ -113,6 +105,7 @@ bool wxButton::Create( ,rSize.x ,rSize.y ); + delete pButtonFont; return TRUE; } // end of wxButton::Create diff --git a/src/os2/checkbox.cpp b/src/os2/checkbox.cpp index 2c18c0eb22..e2b20ca4d7 100644 --- a/src/os2/checkbox.cpp +++ b/src/os2/checkbox.cpp @@ -97,15 +97,6 @@ bool wxCheckBox::Create( if (lStyle & wxCLIP_SIBLINGS ) lSstyle |= WS_CLIPSIBLINGS; - // - // If the parent is a scrolled window the controls must - // have this style or they will overlap the scrollbars - // - if (pParent) - if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) || - pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow))) - lSstyle |= WS_CLIPSIBLINGS; - m_hWnd = (WXHWND)::WinCreateWindow ( GetHwndOf(pParent) ,WC_BUTTON ,rsLabel.c_str() @@ -131,13 +122,18 @@ bool wxCheckBox::Create( ,(PVOID)&lColor ); - SetFont(*wxSMALL_FONT); - + wxFont* pTextFont = new wxFont( 10 + ,wxMODERN + ,wxNORMAL + ,wxNORMAL + ); + SetFont(*pTextFont); SetSize( nX ,nY ,nWidth ,nHeight ); + delete pTextFont; return TRUE; } // end of wxCheckBox::Create diff --git a/src/os2/choice.cpp b/src/os2/choice.cpp index 00d0d583e4..21bdbb4151 100644 --- a/src/os2/choice.cpp +++ b/src/os2/choice.cpp @@ -77,12 +77,18 @@ bool wxChoice::Create( { Append(asChoices[i]); } + wxFont* pTextFont = new wxFont( 10 + ,wxMODERN + ,wxNORMAL + ,wxNORMAL + ); + SetFont(*pTextFont); SetSize( rPos.x ,rPos.y ,rSize.x ,rSize.y ); - + delete pTextFont; return TRUE; } // end of wxChoice::Create diff --git a/src/os2/combobox.cpp b/src/os2/combobox.cpp index fc4697b255..8b0980688b 100644 --- a/src/os2/combobox.cpp +++ b/src/os2/combobox.cpp @@ -143,10 +143,14 @@ bool wxComboBox::Create( // SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); - SetFont(*wxSMALL_FONT); + wxFont* pTextFont = new wxFont( 10 + ,wxMODERN + ,wxNORMAL + ,wxNORMAL + ); + SetFont(*pTextFont); int i; - for (i = 0; i < n; i++) { Append(asChoices[i]); @@ -165,6 +169,7 @@ bool wxComboBox::Create( ,(PFNWP)wxComboEditWndProc ); ::WinSetWindowULong(GetHwnd(), QWL_USER, (ULONG)this); + delete pTextFont; return TRUE; } // end of wxComboBox::Create diff --git a/src/os2/control.cpp b/src/os2/control.cpp index f9f19112b9..3ed6d787a0 100644 --- a/src/os2/control.cpp +++ b/src/os2/control.cpp @@ -140,15 +140,6 @@ bool wxControl::OS2CreateControl( zClass = WC_BUTTON; dwStyle |= WS_VISIBLE; - // - // If the parent is a scrolled window the controls must - // have this style or they will overlap the scrollbars - // - if (pParent) - if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) || - pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow))) - dwStyle |= WS_CLIPSIBLINGS; - m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle ,(PSZ)zClass // Window class ,(PSZ)rsLabel.c_str() // Initial Text diff --git a/src/os2/gauge.cpp b/src/os2/gauge.cpp index b7700f4147..e12f172304 100644 --- a/src/os2/gauge.cpp +++ b/src/os2/gauge.cpp @@ -156,15 +156,6 @@ bool wxGauge::Create( if (m_windowStyle & wxCLIP_SIBLINGS) lMsStyle |= WS_CLIPSIBLINGS; - // - // If the parent is a scrolled window the controls must - // have this style or they will overlap the scrollbars - // - if (pParent) - if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) || - pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow))) - lMsStyle |= WS_CLIPSIBLINGS; - m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle ,WC_ENTRYFIELD // Window class ,(PSZ)NULL // Initial Text @@ -185,7 +176,12 @@ bool wxGauge::Create( ::WinQueryWindowPos(m_hWnd, &vSwp); SetXComp(vSwp.x); SetYComp(vSwp.y); - SetFont(pParent->GetFont()); + wxFont* pTextFont = new wxFont( 10 + ,wxMODERN + ,wxNORMAL + ,wxNORMAL + ); + SetFont(*pTextFont); if (nWidth == -1L) nWidth = 50L; if (nHeight == -1L) @@ -196,6 +192,7 @@ bool wxGauge::Create( ,nHeight ); ::WinShowWindow((HWND)GetHWND(), TRUE); + delete pTextFont; return TRUE; } // end of wxGauge::Create diff --git a/src/os2/listbox.cpp b/src/os2/listbox.cpp index f99ec829ec..2e7ffc1757 100644 --- a/src/os2/listbox.cpp +++ b/src/os2/listbox.cpp @@ -143,15 +143,6 @@ bool wxListBox::Create( // lStyle |= LS_NOADJUSTPOS; - // - // If the parent is a scrolled window the controls must - // have this style or they will overlap the scrollbars - // - if (pParent) - if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) || - pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow))) - lStyle |= WS_CLIPSIBLINGS; - m_hWnd = (WXHWND)::WinCreateWindow( GetWinHwnd(pParent) // Parent ,WC_LISTBOX // Default Listbox class ,"LISTBOX" // Control's name @@ -179,7 +170,12 @@ bool wxListBox::Create( { Append(asChoices[lUi]); } - SetFont(*wxSMALL_FONT); + wxFont* pTextFont = new wxFont( 10 + ,wxMODERN + ,wxNORMAL + ,wxNORMAL + ); + SetFont(*pTextFont); // // Set standard wxWindows colors for Listbox items and highlighting @@ -208,6 +204,7 @@ bool wxListBox::Create( ,nWidth ,nHeight ); + delete pTextFont; return TRUE; } // end of wxListBox::Create diff --git a/src/os2/ownerdrw.cpp b/src/os2/ownerdrw.cpp index 75c8906036..5e156318e3 100644 --- a/src/os2/ownerdrw.cpp +++ b/src/os2/ownerdrw.cpp @@ -399,7 +399,6 @@ bool wxOwnerDrawn::OnDrawItem( ,&vLine ); ::GpiMove(hPS, &vPnt1); - char zMsg[128]; ::GpiBox( hPS ,DRO_OUTLINE ,&vPnt2 diff --git a/src/os2/radiobox.cpp b/src/os2/radiobox.cpp index 70a9a050e4..8fa3845bae 100644 --- a/src/os2/radiobox.cpp +++ b/src/os2/radiobox.cpp @@ -264,7 +264,11 @@ bool wxRadioBox::Create( // System fonts are too big in OS/2 and they are blue // We want smaller fonts and black by default. // - wxFont& rFont = *wxSMALL_FONT; + wxFont* pTextFont = new wxFont( 10 + ,wxMODERN + ,wxNORMAL + ,wxNORMAL + ); wxColour vColour; LONG lColor; @@ -319,9 +323,9 @@ bool wxRadioBox::Create( m_pnRadioWidth = new int[nNum]; m_pnRadioHeight = new int[nNum]; - if (rFont.Ok()) + if (pTextFont->Ok()) { - hFont = rFont.GetResourceHandle(); + hFont = pTextFont->GetResourceHandle(); } for (int i = 0; i < nNum; i++) @@ -365,7 +369,7 @@ bool wxRadioBox::Create( m_ahRadioButtons[i] = (WXHWND)hWndBtn; SubclassRadioButton((WXHWND)hWndBtn); wxOS2SetFont( hWndBtn - ,rFont + ,*pTextFont ); ::WinSetWindowULong(hWndBtn, QWL_USER, (ULONG)this); m_aSubControls.Add(nNewId); @@ -385,7 +389,7 @@ bool wxRadioBox::Create( ,NULL ,NULL ); - SetFont(*wxSMALL_FONT); + SetFont(*pTextFont); lColor = (LONG)vColour.GetPixel(); ::WinSetPresParam( m_hWnd ,PP_FOREGROUNDCOLOR @@ -405,6 +409,7 @@ bool wxRadioBox::Create( ,rSize.x ,rSize.y ); + delete pTextFont; return TRUE; } // end of wxRadioBox::Create diff --git a/src/os2/radiobut.cpp b/src/os2/radiobut.cpp index 1f48c70a66..f30fb7e201 100644 --- a/src/os2/radiobut.cpp +++ b/src/os2/radiobut.cpp @@ -85,12 +85,18 @@ bool wxRadioButton::Create( if (HasFlag(wxRB_GROUP)) SetValue(TRUE); - SetFont(*wxSMALL_FONT); + wxFont* pTextFont = new wxFont( 10 + ,wxMODERN + ,wxNORMAL + ,wxNORMAL + ); + SetFont(*pTextFont); SetSize( rPos.x ,rPos.y ,rSize.x ,rSize.y ); + delete pTextFont; return TRUE; } // end of wxRadioButton::Create diff --git a/src/os2/slider.cpp b/src/os2/slider.cpp index 7819dca287..b190205052 100644 --- a/src/os2/slider.cpp +++ b/src/os2/slider.cpp @@ -96,7 +96,7 @@ void wxSlider::AdjustSubControls( ,(LONG)nYOffset ,(LONG)nNewWidth ,(LONG)nValueHeight - ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW + ,SWP_SIZE | SWP_MOVE ); } ::WinSetWindowPos( (HWND)m_hStaticMin @@ -105,7 +105,7 @@ void wxSlider::AdjustSubControls( ,(LONG)nYOffset ,(LONG)nMinLen ,(LONG)nCy - ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW + ,SWP_SIZE | SWP_MOVE ); nXOffset += nWidth + nCx; @@ -201,15 +201,6 @@ bool wxSlider::Create( { lMsStyle |= WS_VISIBLE | SS_TEXT | DT_VCENTER; - // - // If the parent is a scrolled window the controls must - // have this style or they will overlap the scrollbars - // - if (pParent) - if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) || - pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow))) - lMsStyle |= WS_CLIPSIBLINGS; - m_hStaticValue = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle ,WC_STATIC // Window class ,(PSZ)NULL // Initial Text @@ -229,14 +220,6 @@ bool wxSlider::Create( lWstyle = SS_TEXT|DT_LEFT|WS_VISIBLE; if (m_windowStyle & wxCLIP_SIBLINGS) lWstyle |= WS_CLIPSIBLINGS; - // - // If the parent is a scrolled window the controls must - // have this style or they will overlap the scrollbars - // - if (pParent) - if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) || - pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow))) - lWstyle |= WS_CLIPSIBLINGS; m_hStaticMin = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle ,WC_STATIC // Window class @@ -282,15 +265,6 @@ bool wxSlider::Create( else lMsStyle |= SLS_PRIMARYSCALE2; - // - // If the parent is a scrolled window the controls must - // have this style or they will overlap the scrollbars - // - if (pParent) - if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) || - pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow))) - lMsStyle |= WS_CLIPSIBLINGS; - m_nPageSize = ((nMaxValue - nMinValue)/10); vSlData.usScale1Increments = m_nPageSize; vSlData.usScale2Increments = m_nPageSize; @@ -329,7 +303,13 @@ bool wxSlider::Create( m_hWnd = (WXHWND)hScrollBar; SubclassWin(GetHWND()); ::WinSetWindowText((HWND)m_hWnd, ""); - SetFont(*wxSMALL_FONT); + + wxFont* pTextFont = new wxFont( 10 + ,wxMODERN + ,wxNORMAL + ,wxNORMAL + ); + SetFont(*pTextFont); if (m_windowStyle & wxSL_LABELS) { // @@ -339,14 +319,6 @@ bool wxSlider::Create( lWstyle = SS_TEXT|DT_LEFT|WS_VISIBLE; if (m_windowStyle & wxCLIP_SIBLINGS) lMsStyle |= WS_CLIPSIBLINGS; - // - // If the parent is a scrolled window the controls must - // have this style or they will overlap the scrollbars - // - if (pParent) - if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) || - pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow))) - lWstyle |= WS_CLIPSIBLINGS; m_hStaticMax = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle ,WC_STATIC // Window class @@ -441,6 +413,7 @@ bool wxSlider::Create( ,(PVOID)&lColor ); SetValue(nValue); + delete pTextFont; return TRUE; } // end of wxSlider::Create diff --git a/src/os2/spinbutt.cpp b/src/os2/spinbutt.cpp index 720b9d0f1e..2103d2c98b 100644 --- a/src/os2/spinbutt.cpp +++ b/src/os2/spinbutt.cpp @@ -102,15 +102,6 @@ bool wxSpinButton::Create( if (m_windowStyle & wxCLIP_SIBLINGS ) lSstyle |= WS_CLIPSIBLINGS; - // - // If the parent is a scrolled window the controls must - // have this style or they will overlap the scrollbars - // - if (pParent) - if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) || - pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow))) - lSstyle |= WS_CLIPSIBLINGS; - SPBCDATA vCtrlData; vCtrlData.cbSize = sizeof(SPBCDATA); @@ -141,7 +132,12 @@ bool wxSpinButton::Create( ::WinQueryWindowPos(m_hWnd, &vSwp); SetXComp(vSwp.x); SetYComp(vSwp.y); - SetFont(*wxSMALL_FONT); + wxFont* pTextFont = new wxFont( 10 + ,wxMODERN + ,wxNORMAL + ,wxNORMAL + ); + SetFont(*pTextFont); // // For OS/2 we want to hide the text portion so we can substitute an // independent text ctrl in its place. 10 device units does this @@ -156,6 +152,7 @@ bool wxSpinButton::Create( ); ::WinSetWindowULong(GetHwnd(), QWL_USER, (LONG)this); fnWndProcSpinCtrl = (WXFARPROC)::WinSubclassWindow(m_hWnd, (PFNWP)wxSpinCtrlWndProc); + delete pTextFont; return TRUE; } // end of wxSpinButton::Create diff --git a/src/os2/spinctrl.cpp b/src/os2/spinctrl.cpp index bfda23f725..8c2735901e 100644 --- a/src/os2/spinctrl.cpp +++ b/src/os2/spinctrl.cpp @@ -151,15 +151,6 @@ bool wxSpinCtrl::Create( if (m_windowStyle & wxCLIP_SIBLINGS ) lSstyle |= WS_CLIPSIBLINGS; - // - // If the parent is a scrolled window the controls must - // have this style or they will overlap the scrollbars - // - if (pParent) - if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) || - pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow))) - lSstyle |= WS_CLIPSIBLINGS; - SPBCDATA vCtrlData; vCtrlData.cbSize = sizeof(SPBCDATA); @@ -187,7 +178,12 @@ bool wxSpinCtrl::Create( m_hWndBuddy = m_hWnd; // One in the same for OS/2 if(pParent) pParent->AddChild((wxSpinButton *)this); - SetFont(*wxSMALL_FONT); + wxFont* pTextFont = new wxFont( 10 + ,wxMODERN + ,wxNORMAL + ,wxNORMAL + ); + SetFont(*pTextFont); ::WinQueryWindowPos(m_hWnd, &vSwp); SetXComp(vSwp.x); SetYComp(vSwp.y); @@ -209,6 +205,7 @@ bool wxSpinCtrl::Create( ::WinSetWindowULong(GetHwnd(), QWL_USER, (LONG)this); fnWndProcSpinCtrl = (WXFARPROC)::WinSubclassWindow(m_hWnd, (PFNWP)wxSpinCtrlWndProc); m_svAllSpins.Add(this); + delete pTextFont; return TRUE; } // end of wxSpinCtrl::Create diff --git a/src/os2/statbox.cpp b/src/os2/statbox.cpp index 7ca2b7fa23..61f5db74d6 100644 --- a/src/os2/statbox.cpp +++ b/src/os2/statbox.cpp @@ -79,12 +79,18 @@ bool wxStaticBox::Create( ,sizeof(LONG) ,(PVOID)&lColor ); - SetFont(*wxSMALL_FONT); + wxFont* pTextFont = new wxFont( 10 + ,wxMODERN + ,wxNORMAL + ,wxNORMAL + ); + SetFont(*pTextFont); SetSize( rPos.x ,rPos.y ,rSize.x ,rSize.y ); + delete pTextFont; return TRUE; } // end of wxStaticBox::Create diff --git a/src/os2/stattext.cpp b/src/os2/stattext.cpp index 8719214241..56e44dca0e 100644 --- a/src/os2/stattext.cpp +++ b/src/os2/stattext.cpp @@ -67,15 +67,6 @@ bool wxStaticText::Create( lSstyle |= DT_RIGHT; else lSstyle |= DT_LEFT; - // - // If the parent is a scrolled window the controls must - // have this style or they will overlap the scrollbars - // - if (pParent) - if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) || - pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow))) - lSstyle |= WS_CLIPSIBLINGS; - m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle ,WC_STATIC // Window class ,(PSZ)rsLabel.c_str() // Initial Text @@ -110,12 +101,18 @@ bool wxStaticText::Create( ); SubclassWin(m_hWnd); - wxControl::SetFont(*wxSMALL_FONT); + wxFont* pTextFont = new wxFont( 10 + ,wxMODERN + ,wxNORMAL + ,wxNORMAL + ); + wxControl::SetFont(*pTextFont); SetSize( nX ,nY ,nWidth ,nHeight ); + delete pTextFont; return TRUE; } // end of wxStaticText::Create diff --git a/src/os2/textctrl.cpp b/src/os2/textctrl.cpp index 0c762e5d8e..87c8150bac 100644 --- a/src/os2/textctrl.cpp +++ b/src/os2/textctrl.cpp @@ -154,14 +154,6 @@ bool wxTextCtrl::Create( if (m_windowStyle & wxTE_PASSWORD) // hidden input lSstyle |= ES_UNREADABLE; } - // - // If the parent is a scrolled window the controls must - // have this style or they will overlap the scrollbars - // - if (pParent) - if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) || - pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow))) - lSstyle |= WS_CLIPSIBLINGS; if (m_bIsMLE) { @@ -231,6 +223,7 @@ bool wxTextCtrl::Create( ,rSize.x ,rSize.y ); + delete pTextFont; return TRUE; } // end of wxTextCtrl::Create @@ -320,7 +313,10 @@ void wxTextCtrl::WriteText( const wxString& rsValue ) { - ::WinSendMsg(GetHwnd(), MLM_INSERT, MPARAM((PCHAR)rsValue.c_str()), MPARAM(0)); + if (m_bIsMLE) + ::WinSendMsg(GetHwnd(), MLM_INSERT, MPARAM((PCHAR)rsValue.c_str()), MPARAM(0)); + else + ::WinSetWindowText(GetHwnd(), rsValue.c_str()); AdjustSpaceLimit(); } // end of wxTextCtrl::WriteText diff --git a/src/os2/toplevel.cpp b/src/os2/toplevel.cpp index 888f0ccf68..c0187c6f00 100644 --- a/src/os2/toplevel.cpp +++ b/src/os2/toplevel.cpp @@ -281,6 +281,7 @@ bool wxTopLevelWindowOS2::CreateDialog( { return FALSE; } + ::WinSetWindowPos( GetHwnd() ,HWND_TOP ,nX @@ -289,9 +290,6 @@ bool wxTopLevelWindowOS2::CreateDialog( ,nHeight ,SWP_MOVE | SWP_SIZE | SWP_ZORDER | SWP_SHOW ); - // - // Set the m_hFrame to m_hWnd for Dialogs - // m_hFrame = m_hWnd; SubclassWin(m_hWnd); return TRUE; diff --git a/src/os2/window.cpp b/src/os2/window.cpp index 681b0b3451..3d0ae02f03 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -766,6 +766,7 @@ void wxWindowOS2::SetScrollbar( HWND hWnd = GetHwnd(); ULONG ulStyle = WS_VISIBLE; RECTL vRect; + SWP vSwp; ::WinQueryWindowRect(hWnd, &vRect); if (nPageSize > 1 && nRange > 0) @@ -783,18 +784,13 @@ void wxWindowOS2::SetScrollbar( ulStyle |= SBS_HORZ; if (m_hWndScrollBarHorz == 0L) { - // - // We create the scrollbars with the desktop so that they are not - // registered as child windows of the window in order that child - // windows may be scrolled without scrolling the scrollbars themselves! - // m_hWndScrollBarHorz = ::WinCreateWindow( hWnd ,WC_SCROLLBAR ,(PSZ)NULL ,ulStyle ,vRect.xLeft ,vRect.yBottom - ,vRect.xRight - vRect.xLeft + ,vRect.xRight - vRect.xLeft - 20 ,20 ,hWnd ,HWND_TOP @@ -824,7 +820,7 @@ void wxWindowOS2::SetScrollbar( ,HWND_TOP ,vRect.xLeft ,vRect.yBottom - ,vRect.xRight - vRect.xLeft + ,vRect.xRight - vRect.xLeft - 20 ,20 ,SWP_ACTIVATE | SWP_MOVE | SWP_SIZE | SWP_SHOW ); @@ -894,25 +890,24 @@ void wxWindowOS2::ScrollWindow( { nDy *= -1; // flip the sign of Dy as OS/2 is opposite Windows. RECTL vRect; - RECTL vRect2; RECTL vRectHorz; RECTL vRectVert; RECTL vRectChild; if (pRect) { - vRect2.xLeft = pRect->x; - vRect2.yTop = pRect->y + pRect->height; - vRect2.xRight = pRect->x + pRect->width; - vRect2.yBottom = pRect->y; + vRect.xLeft = pRect->x; + vRect.yTop = pRect->y + pRect->height; + vRect.xRight = pRect->x + pRect->width; + vRect.yBottom = pRect->y; } else { ::WinQueryWindowRect(GetHwnd(), &vRect); ::WinQueryWindowRect(m_hWndScrollBarHorz, &vRectHorz); - vRect2.yBottom += vRect.yTop - vRect.yBottom; + vRect.yBottom += vRectHorz.yTop - vRectHorz.yBottom; ::WinQueryWindowRect(m_hWndScrollBarVert, &vRectVert); - vRect2.xRight -= vRect.xRight - vRect.xLeft; + vRect.xRight -= vRectVert.xRight - vRectVert.xLeft; } ::WinScrollWindow( GetHwnd() @@ -924,9 +919,6 @@ void wxWindowOS2::ScrollWindow( ,NULL ,SW_INVALIDATERGN ); - ::WinInvalidateRect(m_hWndScrollBarHorz, &vRectHorz, FALSE); - ::WinInvalidateRect(m_hWndScrollBarVert, &vRectVert, FALSE); - // // Move the children // @@ -940,7 +932,7 @@ void wxWindowOS2::ScrollWindow( if (pChildWin->GetHWND() != NULLHANDLE) { ::WinQueryWindowPos(pChildWin->GetHWND(), &vSwp); - ::WinQueryWindowRect(pChildWin->GetHWND(), &vRectChild); + ::WinQueryWindowRect(pChildWin->GetHWND(), &vRect); if (pChildWin->IsKindOf(CLASSINFO(wxControl))) { wxControl* pCtrl; @@ -960,7 +952,7 @@ void wxWindowOS2::ScrollWindow( ,vSwp.y + nDy ,0 ,0 - ,SWP_MOVE | SWP_ZORDER + ,SWP_MOVE ); if (pChildWin->IsKindOf(CLASSINFO(wxRadioBox))) { @@ -990,6 +982,38 @@ void wxWindowOS2::ScrollWindow( } pCurrent = pCurrent->GetNext(); } + if (GetChildren().GetCount() > 0) + { + // + // Clean up child window slop + // + ::WinQueryWindowRect(GetHwnd(), &vRect); + vRect.xRight -= 20; + vRect.yBottom += 20; + ::WinInvalidateRect(GetHwnd(), &vRect, TRUE); + } + + // + // Takes a lot to keep the scrollbars on top of everything + // + ::WinSetWindowPos( m_hWndScrollBarHorz + ,HWND_TOP + ,0 + ,0 + ,0 + ,0 + ,SWP_ZORDER + ); + ::WinSetWindowPos( m_hWndScrollBarVert + ,HWND_TOP + ,0 + ,0 + ,0 + ,0 + ,SWP_ZORDER + ); + ::WinInvalidateRect(m_hWndScrollBarHorz, &vRectHorz, FALSE); + ::WinInvalidateRect(m_hWndScrollBarVert, &vRectVert, FALSE); } // end of wxWindowOS2::ScrollWindow // --------------------------------------------------------------------------- @@ -4063,12 +4087,12 @@ void wxWindowOS2::MoveChildren( vSwp.x -= pCtrl->GetXComp(); } ::WinSetWindowPos( GetHwndOf(pWin) - ,HWND_TOP + ,HWND_BOTTOM ,vSwp.x ,vSwp.y - nDiff ,vSwp.cx ,vSwp.cy - ,SWP_MOVE + ,SWP_MOVE | SWP_ZORDER ); if (pWin->IsKindOf(CLASSINFO(wxRadioBox))) { @@ -4094,6 +4118,68 @@ void wxWindowOS2::MoveChildren( ,(int)pSlider->GetSizeFlags() ); } + // + // Originally created before Panel was properly sized, most likely. + // So now the the panel is sized correctly, resize the scrollbars + // and bring them to the top of all the other panel children + // + if (m_hWndScrollBarVert != NULLHANDLE || + m_hWndScrollBarHorz != NULLHANDLE) + { + RECTL vRect; + + ::WinQueryWindowRect(GetHwnd(), &vRect); + ::WinQueryWindowPos(m_hWndScrollBarHorz, &vSwp); + if ( (vRect.xRight - vRect.xLeft) - vSwp.cx != 20) + { + ::WinSetWindowPos( m_hWndScrollBarHorz + ,HWND_TOP + ,0 + ,0 + ,(vRect.xRight - vRect.xLeft) - 20 + ,vSwp.cy + ,SWP_ZORDER | SWP_SIZE + ); + } + else + { + ::WinSetWindowPos( m_hWndScrollBarHorz + ,HWND_TOP + ,0 + ,0 + ,0 + ,0 + ,SWP_ZORDER + ); + } + ::WinQueryWindowPos(m_hWndScrollBarVert, &vSwp); + if ( (vRect.yTop - vRect.yBottom) - vSwp.cy != 20) + { + ::WinSetWindowPos( m_hWndScrollBarVert + ,HWND_TOP + ,vSwp.x + ,vSwp.y + 20 + ,vSwp.cx + ,(vRect.yTop - vRect.yBottom) - 20 + ,SWP_ZORDER | SWP_SIZE | SWP_MOVE + ); + } + else + { + ::WinSetWindowPos( m_hWndScrollBarVert + ,HWND_TOP + ,0 + ,0 + ,0 + ,0 + ,SWP_ZORDER + ); + } + ::WinQueryWindowRect(m_hWndScrollBarHorz, &vRect); + ::WinInvalidateRect(m_hWndScrollBarHorz, &vRect, FALSE); + ::WinQueryWindowRect(m_hWndScrollBarVert, &vRect); + ::WinInvalidateRect(m_hWndScrollBarVert, &vRect, FALSE); + } } } // end of wxWindowOS2::MoveChildren -- 2.45.2