Lots of fixes for scrolling

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13944 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster 2002-01-31 22:48:09 +00:00
parent ffd0623c11
commit b3260bce47
19 changed files with 206 additions and 160 deletions

View File

@ -901,7 +901,8 @@ bool wxApp::ProcessMessage(
if (pMsg->msg == WM_TIMER && if (pMsg->msg == WM_TIMER &&
(SHORT1FROMMP(pMsg->mp1) != TID_CURSOR && (SHORT1FROMMP(pMsg->mp1) != TID_CURSOR &&
SHORT1FROMMP(pMsg->mp1) != TID_FLASHWINDOW && 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); wxTimerProc(NULL, 0, (int)pMsg->mp1, 0);

View File

@ -71,14 +71,6 @@ bool wxButton::Create(
// //
if (m_windowStyle & wxCLIP_SIBLINGS ) if (m_windowStyle & wxCLIP_SIBLINGS )
lStyle |= WS_CLIPSIBLINGS; 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 m_hWnd = (WXHWND)::WinCreateWindow( GetHwndOf(pParent) // Parent handle
,WC_BUTTON // A Button class window ,WC_BUTTON // A Button class window
@ -113,6 +105,7 @@ bool wxButton::Create(
,rSize.x ,rSize.x
,rSize.y ,rSize.y
); );
delete pButtonFont;
return TRUE; return TRUE;
} // end of wxButton::Create } // end of wxButton::Create

View File

@ -97,15 +97,6 @@ bool wxCheckBox::Create(
if (lStyle & wxCLIP_SIBLINGS ) if (lStyle & wxCLIP_SIBLINGS )
lSstyle |= WS_CLIPSIBLINGS; 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) m_hWnd = (WXHWND)::WinCreateWindow ( GetHwndOf(pParent)
,WC_BUTTON ,WC_BUTTON
,rsLabel.c_str() ,rsLabel.c_str()
@ -131,13 +122,18 @@ bool wxCheckBox::Create(
,(PVOID)&lColor ,(PVOID)&lColor
); );
SetFont(*wxSMALL_FONT); wxFont* pTextFont = new wxFont( 10
,wxMODERN
,wxNORMAL
,wxNORMAL
);
SetFont(*pTextFont);
SetSize( nX SetSize( nX
,nY ,nY
,nWidth ,nWidth
,nHeight ,nHeight
); );
delete pTextFont;
return TRUE; return TRUE;
} // end of wxCheckBox::Create } // end of wxCheckBox::Create

View File

@ -77,12 +77,18 @@ bool wxChoice::Create(
{ {
Append(asChoices[i]); Append(asChoices[i]);
} }
wxFont* pTextFont = new wxFont( 10
,wxMODERN
,wxNORMAL
,wxNORMAL
);
SetFont(*pTextFont);
SetSize( rPos.x SetSize( rPos.x
,rPos.y ,rPos.y
,rSize.x ,rSize.x
,rSize.y ,rSize.y
); );
delete pTextFont;
return TRUE; return TRUE;
} // end of wxChoice::Create } // end of wxChoice::Create

View File

@ -143,10 +143,14 @@ bool wxComboBox::Create(
// //
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
SetFont(*wxSMALL_FONT); wxFont* pTextFont = new wxFont( 10
,wxMODERN
,wxNORMAL
,wxNORMAL
);
SetFont(*pTextFont);
int i; int i;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
Append(asChoices[i]); Append(asChoices[i]);
@ -165,6 +169,7 @@ bool wxComboBox::Create(
,(PFNWP)wxComboEditWndProc ,(PFNWP)wxComboEditWndProc
); );
::WinSetWindowULong(GetHwnd(), QWL_USER, (ULONG)this); ::WinSetWindowULong(GetHwnd(), QWL_USER, (ULONG)this);
delete pTextFont;
return TRUE; return TRUE;
} // end of wxComboBox::Create } // end of wxComboBox::Create

View File

@ -140,15 +140,6 @@ bool wxControl::OS2CreateControl(
zClass = WC_BUTTON; zClass = WC_BUTTON;
dwStyle |= WS_VISIBLE; 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 m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
,(PSZ)zClass // Window class ,(PSZ)zClass // Window class
,(PSZ)rsLabel.c_str() // Initial Text ,(PSZ)rsLabel.c_str() // Initial Text

View File

@ -156,15 +156,6 @@ bool wxGauge::Create(
if (m_windowStyle & wxCLIP_SIBLINGS) if (m_windowStyle & wxCLIP_SIBLINGS)
lMsStyle |= WS_CLIPSIBLINGS; 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 m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
,WC_ENTRYFIELD // Window class ,WC_ENTRYFIELD // Window class
,(PSZ)NULL // Initial Text ,(PSZ)NULL // Initial Text
@ -185,7 +176,12 @@ bool wxGauge::Create(
::WinQueryWindowPos(m_hWnd, &vSwp); ::WinQueryWindowPos(m_hWnd, &vSwp);
SetXComp(vSwp.x); SetXComp(vSwp.x);
SetYComp(vSwp.y); SetYComp(vSwp.y);
SetFont(pParent->GetFont()); wxFont* pTextFont = new wxFont( 10
,wxMODERN
,wxNORMAL
,wxNORMAL
);
SetFont(*pTextFont);
if (nWidth == -1L) if (nWidth == -1L)
nWidth = 50L; nWidth = 50L;
if (nHeight == -1L) if (nHeight == -1L)
@ -196,6 +192,7 @@ bool wxGauge::Create(
,nHeight ,nHeight
); );
::WinShowWindow((HWND)GetHWND(), TRUE); ::WinShowWindow((HWND)GetHWND(), TRUE);
delete pTextFont;
return TRUE; return TRUE;
} // end of wxGauge::Create } // end of wxGauge::Create

View File

@ -143,15 +143,6 @@ bool wxListBox::Create(
// //
lStyle |= LS_NOADJUSTPOS; 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 m_hWnd = (WXHWND)::WinCreateWindow( GetWinHwnd(pParent) // Parent
,WC_LISTBOX // Default Listbox class ,WC_LISTBOX // Default Listbox class
,"LISTBOX" // Control's name ,"LISTBOX" // Control's name
@ -179,7 +170,12 @@ bool wxListBox::Create(
{ {
Append(asChoices[lUi]); 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 // Set standard wxWindows colors for Listbox items and highlighting
@ -208,6 +204,7 @@ bool wxListBox::Create(
,nWidth ,nWidth
,nHeight ,nHeight
); );
delete pTextFont;
return TRUE; return TRUE;
} // end of wxListBox::Create } // end of wxListBox::Create

View File

@ -399,7 +399,6 @@ bool wxOwnerDrawn::OnDrawItem(
,&vLine ,&vLine
); );
::GpiMove(hPS, &vPnt1); ::GpiMove(hPS, &vPnt1);
char zMsg[128];
::GpiBox( hPS ::GpiBox( hPS
,DRO_OUTLINE ,DRO_OUTLINE
,&vPnt2 ,&vPnt2

View File

@ -264,7 +264,11 @@ bool wxRadioBox::Create(
// System fonts are too big in OS/2 and they are blue // System fonts are too big in OS/2 and they are blue
// We want smaller fonts and black by default. // We want smaller fonts and black by default.
// //
wxFont& rFont = *wxSMALL_FONT; wxFont* pTextFont = new wxFont( 10
,wxMODERN
,wxNORMAL
,wxNORMAL
);
wxColour vColour; wxColour vColour;
LONG lColor; LONG lColor;
@ -319,9 +323,9 @@ bool wxRadioBox::Create(
m_pnRadioWidth = new int[nNum]; m_pnRadioWidth = new int[nNum];
m_pnRadioHeight = 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++) for (int i = 0; i < nNum; i++)
@ -365,7 +369,7 @@ bool wxRadioBox::Create(
m_ahRadioButtons[i] = (WXHWND)hWndBtn; m_ahRadioButtons[i] = (WXHWND)hWndBtn;
SubclassRadioButton((WXHWND)hWndBtn); SubclassRadioButton((WXHWND)hWndBtn);
wxOS2SetFont( hWndBtn wxOS2SetFont( hWndBtn
,rFont ,*pTextFont
); );
::WinSetWindowULong(hWndBtn, QWL_USER, (ULONG)this); ::WinSetWindowULong(hWndBtn, QWL_USER, (ULONG)this);
m_aSubControls.Add(nNewId); m_aSubControls.Add(nNewId);
@ -385,7 +389,7 @@ bool wxRadioBox::Create(
,NULL ,NULL
,NULL ,NULL
); );
SetFont(*wxSMALL_FONT); SetFont(*pTextFont);
lColor = (LONG)vColour.GetPixel(); lColor = (LONG)vColour.GetPixel();
::WinSetPresParam( m_hWnd ::WinSetPresParam( m_hWnd
,PP_FOREGROUNDCOLOR ,PP_FOREGROUNDCOLOR
@ -405,6 +409,7 @@ bool wxRadioBox::Create(
,rSize.x ,rSize.x
,rSize.y ,rSize.y
); );
delete pTextFont;
return TRUE; return TRUE;
} // end of wxRadioBox::Create } // end of wxRadioBox::Create

View File

@ -85,12 +85,18 @@ bool wxRadioButton::Create(
if (HasFlag(wxRB_GROUP)) if (HasFlag(wxRB_GROUP))
SetValue(TRUE); SetValue(TRUE);
SetFont(*wxSMALL_FONT); wxFont* pTextFont = new wxFont( 10
,wxMODERN
,wxNORMAL
,wxNORMAL
);
SetFont(*pTextFont);
SetSize( rPos.x SetSize( rPos.x
,rPos.y ,rPos.y
,rSize.x ,rSize.x
,rSize.y ,rSize.y
); );
delete pTextFont;
return TRUE; return TRUE;
} // end of wxRadioButton::Create } // end of wxRadioButton::Create

View File

@ -96,7 +96,7 @@ void wxSlider::AdjustSubControls(
,(LONG)nYOffset ,(LONG)nYOffset
,(LONG)nNewWidth ,(LONG)nNewWidth
,(LONG)nValueHeight ,(LONG)nValueHeight
,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW ,SWP_SIZE | SWP_MOVE
); );
} }
::WinSetWindowPos( (HWND)m_hStaticMin ::WinSetWindowPos( (HWND)m_hStaticMin
@ -105,7 +105,7 @@ void wxSlider::AdjustSubControls(
,(LONG)nYOffset ,(LONG)nYOffset
,(LONG)nMinLen ,(LONG)nMinLen
,(LONG)nCy ,(LONG)nCy
,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW ,SWP_SIZE | SWP_MOVE
); );
nXOffset += nWidth + nCx; nXOffset += nWidth + nCx;
@ -201,15 +201,6 @@ bool wxSlider::Create(
{ {
lMsStyle |= WS_VISIBLE | SS_TEXT | DT_VCENTER; 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 m_hStaticValue = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
,WC_STATIC // Window class ,WC_STATIC // Window class
,(PSZ)NULL // Initial Text ,(PSZ)NULL // Initial Text
@ -229,14 +220,6 @@ bool wxSlider::Create(
lWstyle = SS_TEXT|DT_LEFT|WS_VISIBLE; lWstyle = SS_TEXT|DT_LEFT|WS_VISIBLE;
if (m_windowStyle & wxCLIP_SIBLINGS) if (m_windowStyle & wxCLIP_SIBLINGS)
lWstyle |= WS_CLIPSIBLINGS; 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 m_hStaticMin = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
,WC_STATIC // Window class ,WC_STATIC // Window class
@ -282,15 +265,6 @@ bool wxSlider::Create(
else else
lMsStyle |= SLS_PRIMARYSCALE2; 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); m_nPageSize = ((nMaxValue - nMinValue)/10);
vSlData.usScale1Increments = m_nPageSize; vSlData.usScale1Increments = m_nPageSize;
vSlData.usScale2Increments = m_nPageSize; vSlData.usScale2Increments = m_nPageSize;
@ -329,7 +303,13 @@ bool wxSlider::Create(
m_hWnd = (WXHWND)hScrollBar; m_hWnd = (WXHWND)hScrollBar;
SubclassWin(GetHWND()); SubclassWin(GetHWND());
::WinSetWindowText((HWND)m_hWnd, ""); ::WinSetWindowText((HWND)m_hWnd, "");
SetFont(*wxSMALL_FONT);
wxFont* pTextFont = new wxFont( 10
,wxMODERN
,wxNORMAL
,wxNORMAL
);
SetFont(*pTextFont);
if (m_windowStyle & wxSL_LABELS) if (m_windowStyle & wxSL_LABELS)
{ {
// //
@ -339,14 +319,6 @@ bool wxSlider::Create(
lWstyle = SS_TEXT|DT_LEFT|WS_VISIBLE; lWstyle = SS_TEXT|DT_LEFT|WS_VISIBLE;
if (m_windowStyle & wxCLIP_SIBLINGS) if (m_windowStyle & wxCLIP_SIBLINGS)
lMsStyle |= WS_CLIPSIBLINGS; 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 m_hStaticMax = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
,WC_STATIC // Window class ,WC_STATIC // Window class
@ -441,6 +413,7 @@ bool wxSlider::Create(
,(PVOID)&lColor ,(PVOID)&lColor
); );
SetValue(nValue); SetValue(nValue);
delete pTextFont;
return TRUE; return TRUE;
} // end of wxSlider::Create } // end of wxSlider::Create

View File

@ -102,15 +102,6 @@ bool wxSpinButton::Create(
if (m_windowStyle & wxCLIP_SIBLINGS ) if (m_windowStyle & wxCLIP_SIBLINGS )
lSstyle |= WS_CLIPSIBLINGS; 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; SPBCDATA vCtrlData;
vCtrlData.cbSize = sizeof(SPBCDATA); vCtrlData.cbSize = sizeof(SPBCDATA);
@ -141,7 +132,12 @@ bool wxSpinButton::Create(
::WinQueryWindowPos(m_hWnd, &vSwp); ::WinQueryWindowPos(m_hWnd, &vSwp);
SetXComp(vSwp.x); SetXComp(vSwp.x);
SetYComp(vSwp.y); 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 // 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 // independent text ctrl in its place. 10 device units does this
@ -156,6 +152,7 @@ bool wxSpinButton::Create(
); );
::WinSetWindowULong(GetHwnd(), QWL_USER, (LONG)this); ::WinSetWindowULong(GetHwnd(), QWL_USER, (LONG)this);
fnWndProcSpinCtrl = (WXFARPROC)::WinSubclassWindow(m_hWnd, (PFNWP)wxSpinCtrlWndProc); fnWndProcSpinCtrl = (WXFARPROC)::WinSubclassWindow(m_hWnd, (PFNWP)wxSpinCtrlWndProc);
delete pTextFont;
return TRUE; return TRUE;
} // end of wxSpinButton::Create } // end of wxSpinButton::Create

View File

@ -151,15 +151,6 @@ bool wxSpinCtrl::Create(
if (m_windowStyle & wxCLIP_SIBLINGS ) if (m_windowStyle & wxCLIP_SIBLINGS )
lSstyle |= WS_CLIPSIBLINGS; 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; SPBCDATA vCtrlData;
vCtrlData.cbSize = sizeof(SPBCDATA); vCtrlData.cbSize = sizeof(SPBCDATA);
@ -187,7 +178,12 @@ bool wxSpinCtrl::Create(
m_hWndBuddy = m_hWnd; // One in the same for OS/2 m_hWndBuddy = m_hWnd; // One in the same for OS/2
if(pParent) if(pParent)
pParent->AddChild((wxSpinButton *)this); pParent->AddChild((wxSpinButton *)this);
SetFont(*wxSMALL_FONT); wxFont* pTextFont = new wxFont( 10
,wxMODERN
,wxNORMAL
,wxNORMAL
);
SetFont(*pTextFont);
::WinQueryWindowPos(m_hWnd, &vSwp); ::WinQueryWindowPos(m_hWnd, &vSwp);
SetXComp(vSwp.x); SetXComp(vSwp.x);
SetYComp(vSwp.y); SetYComp(vSwp.y);
@ -209,6 +205,7 @@ bool wxSpinCtrl::Create(
::WinSetWindowULong(GetHwnd(), QWL_USER, (LONG)this); ::WinSetWindowULong(GetHwnd(), QWL_USER, (LONG)this);
fnWndProcSpinCtrl = (WXFARPROC)::WinSubclassWindow(m_hWnd, (PFNWP)wxSpinCtrlWndProc); fnWndProcSpinCtrl = (WXFARPROC)::WinSubclassWindow(m_hWnd, (PFNWP)wxSpinCtrlWndProc);
m_svAllSpins.Add(this); m_svAllSpins.Add(this);
delete pTextFont;
return TRUE; return TRUE;
} // end of wxSpinCtrl::Create } // end of wxSpinCtrl::Create

View File

@ -79,12 +79,18 @@ bool wxStaticBox::Create(
,sizeof(LONG) ,sizeof(LONG)
,(PVOID)&lColor ,(PVOID)&lColor
); );
SetFont(*wxSMALL_FONT); wxFont* pTextFont = new wxFont( 10
,wxMODERN
,wxNORMAL
,wxNORMAL
);
SetFont(*pTextFont);
SetSize( rPos.x SetSize( rPos.x
,rPos.y ,rPos.y
,rSize.x ,rSize.x
,rSize.y ,rSize.y
); );
delete pTextFont;
return TRUE; return TRUE;
} // end of wxStaticBox::Create } // end of wxStaticBox::Create

View File

@ -67,15 +67,6 @@ bool wxStaticText::Create(
lSstyle |= DT_RIGHT; lSstyle |= DT_RIGHT;
else else
lSstyle |= DT_LEFT; 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 m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
,WC_STATIC // Window class ,WC_STATIC // Window class
,(PSZ)rsLabel.c_str() // Initial Text ,(PSZ)rsLabel.c_str() // Initial Text
@ -110,12 +101,18 @@ bool wxStaticText::Create(
); );
SubclassWin(m_hWnd); SubclassWin(m_hWnd);
wxControl::SetFont(*wxSMALL_FONT); wxFont* pTextFont = new wxFont( 10
,wxMODERN
,wxNORMAL
,wxNORMAL
);
wxControl::SetFont(*pTextFont);
SetSize( nX SetSize( nX
,nY ,nY
,nWidth ,nWidth
,nHeight ,nHeight
); );
delete pTextFont;
return TRUE; return TRUE;
} // end of wxStaticText::Create } // end of wxStaticText::Create

View File

@ -154,14 +154,6 @@ bool wxTextCtrl::Create(
if (m_windowStyle & wxTE_PASSWORD) // hidden input if (m_windowStyle & wxTE_PASSWORD) // hidden input
lSstyle |= ES_UNREADABLE; 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) if (m_bIsMLE)
{ {
@ -231,6 +223,7 @@ bool wxTextCtrl::Create(
,rSize.x ,rSize.x
,rSize.y ,rSize.y
); );
delete pTextFont;
return TRUE; return TRUE;
} // end of wxTextCtrl::Create } // end of wxTextCtrl::Create
@ -320,7 +313,10 @@ void wxTextCtrl::WriteText(
const wxString& rsValue 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(); AdjustSpaceLimit();
} // end of wxTextCtrl::WriteText } // end of wxTextCtrl::WriteText

View File

@ -281,6 +281,7 @@ bool wxTopLevelWindowOS2::CreateDialog(
{ {
return FALSE; return FALSE;
} }
::WinSetWindowPos( GetHwnd() ::WinSetWindowPos( GetHwnd()
,HWND_TOP ,HWND_TOP
,nX ,nX
@ -289,9 +290,6 @@ bool wxTopLevelWindowOS2::CreateDialog(
,nHeight ,nHeight
,SWP_MOVE | SWP_SIZE | SWP_ZORDER | SWP_SHOW ,SWP_MOVE | SWP_SIZE | SWP_ZORDER | SWP_SHOW
); );
//
// Set the m_hFrame to m_hWnd for Dialogs
//
m_hFrame = m_hWnd; m_hFrame = m_hWnd;
SubclassWin(m_hWnd); SubclassWin(m_hWnd);
return TRUE; return TRUE;

View File

@ -766,6 +766,7 @@ void wxWindowOS2::SetScrollbar(
HWND hWnd = GetHwnd(); HWND hWnd = GetHwnd();
ULONG ulStyle = WS_VISIBLE; ULONG ulStyle = WS_VISIBLE;
RECTL vRect; RECTL vRect;
SWP vSwp;
::WinQueryWindowRect(hWnd, &vRect); ::WinQueryWindowRect(hWnd, &vRect);
if (nPageSize > 1 && nRange > 0) if (nPageSize > 1 && nRange > 0)
@ -783,18 +784,13 @@ void wxWindowOS2::SetScrollbar(
ulStyle |= SBS_HORZ; ulStyle |= SBS_HORZ;
if (m_hWndScrollBarHorz == 0L) 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 m_hWndScrollBarHorz = ::WinCreateWindow( hWnd
,WC_SCROLLBAR ,WC_SCROLLBAR
,(PSZ)NULL ,(PSZ)NULL
,ulStyle ,ulStyle
,vRect.xLeft ,vRect.xLeft
,vRect.yBottom ,vRect.yBottom
,vRect.xRight - vRect.xLeft ,vRect.xRight - vRect.xLeft - 20
,20 ,20
,hWnd ,hWnd
,HWND_TOP ,HWND_TOP
@ -824,7 +820,7 @@ void wxWindowOS2::SetScrollbar(
,HWND_TOP ,HWND_TOP
,vRect.xLeft ,vRect.xLeft
,vRect.yBottom ,vRect.yBottom
,vRect.xRight - vRect.xLeft ,vRect.xRight - vRect.xLeft - 20
,20 ,20
,SWP_ACTIVATE | SWP_MOVE | SWP_SIZE | SWP_SHOW ,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. nDy *= -1; // flip the sign of Dy as OS/2 is opposite Windows.
RECTL vRect; RECTL vRect;
RECTL vRect2;
RECTL vRectHorz; RECTL vRectHorz;
RECTL vRectVert; RECTL vRectVert;
RECTL vRectChild; RECTL vRectChild;
if (pRect) if (pRect)
{ {
vRect2.xLeft = pRect->x; vRect.xLeft = pRect->x;
vRect2.yTop = pRect->y + pRect->height; vRect.yTop = pRect->y + pRect->height;
vRect2.xRight = pRect->x + pRect->width; vRect.xRight = pRect->x + pRect->width;
vRect2.yBottom = pRect->y; vRect.yBottom = pRect->y;
} }
else else
{ {
::WinQueryWindowRect(GetHwnd(), &vRect); ::WinQueryWindowRect(GetHwnd(), &vRect);
::WinQueryWindowRect(m_hWndScrollBarHorz, &vRectHorz); ::WinQueryWindowRect(m_hWndScrollBarHorz, &vRectHorz);
vRect2.yBottom += vRect.yTop - vRect.yBottom; vRect.yBottom += vRectHorz.yTop - vRectHorz.yBottom;
::WinQueryWindowRect(m_hWndScrollBarVert, &vRectVert); ::WinQueryWindowRect(m_hWndScrollBarVert, &vRectVert);
vRect2.xRight -= vRect.xRight - vRect.xLeft; vRect.xRight -= vRectVert.xRight - vRectVert.xLeft;
} }
::WinScrollWindow( GetHwnd() ::WinScrollWindow( GetHwnd()
@ -924,9 +919,6 @@ void wxWindowOS2::ScrollWindow(
,NULL ,NULL
,SW_INVALIDATERGN ,SW_INVALIDATERGN
); );
::WinInvalidateRect(m_hWndScrollBarHorz, &vRectHorz, FALSE);
::WinInvalidateRect(m_hWndScrollBarVert, &vRectVert, FALSE);
// //
// Move the children // Move the children
// //
@ -940,7 +932,7 @@ void wxWindowOS2::ScrollWindow(
if (pChildWin->GetHWND() != NULLHANDLE) if (pChildWin->GetHWND() != NULLHANDLE)
{ {
::WinQueryWindowPos(pChildWin->GetHWND(), &vSwp); ::WinQueryWindowPos(pChildWin->GetHWND(), &vSwp);
::WinQueryWindowRect(pChildWin->GetHWND(), &vRectChild); ::WinQueryWindowRect(pChildWin->GetHWND(), &vRect);
if (pChildWin->IsKindOf(CLASSINFO(wxControl))) if (pChildWin->IsKindOf(CLASSINFO(wxControl)))
{ {
wxControl* pCtrl; wxControl* pCtrl;
@ -960,7 +952,7 @@ void wxWindowOS2::ScrollWindow(
,vSwp.y + nDy ,vSwp.y + nDy
,0 ,0
,0 ,0
,SWP_MOVE | SWP_ZORDER ,SWP_MOVE
); );
if (pChildWin->IsKindOf(CLASSINFO(wxRadioBox))) if (pChildWin->IsKindOf(CLASSINFO(wxRadioBox)))
{ {
@ -990,6 +982,38 @@ void wxWindowOS2::ScrollWindow(
} }
pCurrent = pCurrent->GetNext(); 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 } // end of wxWindowOS2::ScrollWindow
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -4063,12 +4087,12 @@ void wxWindowOS2::MoveChildren(
vSwp.x -= pCtrl->GetXComp(); vSwp.x -= pCtrl->GetXComp();
} }
::WinSetWindowPos( GetHwndOf(pWin) ::WinSetWindowPos( GetHwndOf(pWin)
,HWND_TOP ,HWND_BOTTOM
,vSwp.x ,vSwp.x
,vSwp.y - nDiff ,vSwp.y - nDiff
,vSwp.cx ,vSwp.cx
,vSwp.cy ,vSwp.cy
,SWP_MOVE ,SWP_MOVE | SWP_ZORDER
); );
if (pWin->IsKindOf(CLASSINFO(wxRadioBox))) if (pWin->IsKindOf(CLASSINFO(wxRadioBox)))
{ {
@ -4094,6 +4118,68 @@ void wxWindowOS2::MoveChildren(
,(int)pSlider->GetSizeFlags() ,(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 } // end of wxWindowOS2::MoveChildren