Finish basic dialog support and some scrolling fixes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13923 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -269,6 +269,18 @@ bool wxTopLevelWindowOS2::CreateDialog(
|
|||||||
nX = (vSizeDpy.x - nWidth) / 2;
|
nX = (vSizeDpy.x - nWidth) / 2;
|
||||||
nY = (vSizeDpy.y - nHeight) / 2;
|
nY = (vSizeDpy.y - nHeight) / 2;
|
||||||
}
|
}
|
||||||
|
m_backgroundColour.Set(wxString("LIGHT GREY"));
|
||||||
|
|
||||||
|
LONG lColor = (LONG)m_backgroundColour.GetPixel();
|
||||||
|
|
||||||
|
if (!::WinSetPresParam( m_hWnd
|
||||||
|
,PP_BACKGROUNDCOLOR
|
||||||
|
,sizeof(LONG)
|
||||||
|
,(PVOID)&lColor
|
||||||
|
))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
::WinSetWindowPos( GetHwnd()
|
::WinSetWindowPos( GetHwnd()
|
||||||
,HWND_TOP
|
,HWND_TOP
|
||||||
,nX
|
,nX
|
||||||
@@ -277,6 +289,10 @@ 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;
|
||||||
SubclassWin(m_hWnd);
|
SubclassWin(m_hWnd);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} // end of wxTopLevelWindowOS2::CreateDialog
|
} // end of wxTopLevelWindowOS2::CreateDialog
|
||||||
|
@@ -764,7 +764,7 @@ void wxWindowOS2::SetScrollbar(
|
|||||||
int nPageSize = nThumbVisible;
|
int nPageSize = nThumbVisible;
|
||||||
SBCDATA vInfo;
|
SBCDATA vInfo;
|
||||||
HWND hWnd = GetHwnd();
|
HWND hWnd = GetHwnd();
|
||||||
ULONG ulStyle = WS_VISIBLE | WS_SYNCPAINT;
|
ULONG ulStyle = WS_VISIBLE;
|
||||||
RECTL vRect;
|
RECTL vRect;
|
||||||
|
|
||||||
::WinQueryWindowRect(hWnd, &vRect);
|
::WinQueryWindowRect(hWnd, &vRect);
|
||||||
@@ -798,7 +798,7 @@ void wxWindowOS2::SetScrollbar(
|
|||||||
,20
|
,20
|
||||||
,hWnd
|
,hWnd
|
||||||
,HWND_TOP
|
,HWND_TOP
|
||||||
,FID_HORZSCROLL
|
,60000
|
||||||
,&vInfo
|
,&vInfo
|
||||||
,NULL
|
,NULL
|
||||||
);
|
);
|
||||||
@@ -848,7 +848,7 @@ void wxWindowOS2::SetScrollbar(
|
|||||||
,vRect.yTop - (vRect.yBottom + 20)
|
,vRect.yTop - (vRect.yBottom + 20)
|
||||||
,hWnd
|
,hWnd
|
||||||
,HWND_TOP
|
,HWND_TOP
|
||||||
,FID_VERTSCROLL
|
,60001
|
||||||
,&vInfo
|
,&vInfo
|
||||||
,NULL
|
,NULL
|
||||||
);
|
);
|
||||||
@@ -892,10 +892,13 @@ void wxWindowOS2::ScrollWindow(
|
|||||||
, const wxRect* pRect
|
, const wxRect* pRect
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
nDy *= -1; // flip the sign of Dy as OS/2 is opposite Windows.
|
||||||
RECTL vRect;
|
RECTL vRect;
|
||||||
RECTL vRect2;
|
RECTL vRect2;
|
||||||
|
RECTL vRectHorz;
|
||||||
|
RECTL vRectVert;
|
||||||
|
RECTL vRectChild;
|
||||||
|
|
||||||
nDy *= -1; // flip the sign of Dy as OS/2 is opposite wxWin.
|
|
||||||
if (pRect)
|
if (pRect)
|
||||||
{
|
{
|
||||||
vRect2.xLeft = pRect->x;
|
vRect2.xLeft = pRect->x;
|
||||||
@@ -905,36 +908,28 @@ void wxWindowOS2::ScrollWindow(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
::WinQueryWindowRect(GetHwnd(), &vRect2);
|
::WinQueryWindowRect(GetHwnd(), &vRect);
|
||||||
::WinQueryWindowRect(m_hWndScrollBarHorz, &vRect);
|
::WinQueryWindowRect(m_hWndScrollBarHorz, &vRectHorz);
|
||||||
vRect2.yBottom += vRect.yTop - vRect.yBottom;
|
vRect2.yBottom += vRect.yTop - vRect.yBottom;
|
||||||
::WinQueryWindowRect(m_hWndScrollBarVert, &vRect);
|
::WinQueryWindowRect(m_hWndScrollBarVert, &vRectVert);
|
||||||
vRect2.xRight -= vRect.xRight - vRect.xLeft;
|
vRect2.xRight -= vRect.xRight - vRect.xLeft;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (pRect)
|
::WinScrollWindow( GetHwnd()
|
||||||
::WinScrollWindow( GetHwnd()
|
,(LONG)nDx
|
||||||
,(LONG)nDx
|
,(LONG)nDy
|
||||||
,(LONG)nDy
|
,&vRect
|
||||||
,&vRect2
|
,NULL
|
||||||
,NULL
|
,NULLHANDLE
|
||||||
,NULLHANDLE
|
,NULL
|
||||||
,NULL
|
,SW_INVALIDATERGN
|
||||||
,SW_INVALIDATERGN
|
);
|
||||||
);
|
::WinInvalidateRect(m_hWndScrollBarHorz, &vRectHorz, FALSE);
|
||||||
else
|
::WinInvalidateRect(m_hWndScrollBarVert, &vRectVert, FALSE);
|
||||||
::WinScrollWindow( GetHwnd()
|
|
||||||
,nDx
|
|
||||||
,nDy
|
|
||||||
,NULL
|
|
||||||
,NULL
|
|
||||||
,NULLHANDLE
|
|
||||||
,NULL
|
|
||||||
,SW_INVALIDATERGN
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Move the children
|
// Move the children
|
||||||
|
//
|
||||||
wxWindowList::Node* pCurrent = GetChildren().GetFirst();
|
wxWindowList::Node* pCurrent = GetChildren().GetFirst();
|
||||||
SWP vSwp;
|
SWP vSwp;
|
||||||
|
|
||||||
@@ -945,31 +940,53 @@ void wxWindowOS2::ScrollWindow(
|
|||||||
if (pChildWin->GetHWND() != NULLHANDLE)
|
if (pChildWin->GetHWND() != NULLHANDLE)
|
||||||
{
|
{
|
||||||
::WinQueryWindowPos(pChildWin->GetHWND(), &vSwp);
|
::WinQueryWindowPos(pChildWin->GetHWND(), &vSwp);
|
||||||
::WinQueryWindowRect(pChildWin->GetHWND(), &vRect);
|
::WinQueryWindowRect(pChildWin->GetHWND(), &vRectChild);
|
||||||
if (pChildWin->GetHWND() == m_hWndScrollBarVert ||
|
if (pChildWin->IsKindOf(CLASSINFO(wxControl)))
|
||||||
pChildWin->GetHWND() == m_hWndScrollBarHorz)
|
|
||||||
{
|
{
|
||||||
::WinSetWindowPos( pChildWin->GetHWND()
|
wxControl* pCtrl;
|
||||||
,HWND_TOP
|
|
||||||
,vSwp.x + nDx
|
//
|
||||||
,vSwp.y + nDy
|
// Must deal with controls that have margins like ENTRYFIELD. The SWP
|
||||||
,0
|
// struct of such a control will have and origin offset from its intended
|
||||||
,0
|
// position by the width of the margins.
|
||||||
,SWP_MOVE | SWP_SHOW | SWP_ZORDER
|
//
|
||||||
);
|
pCtrl = wxDynamicCast(pChildWin, wxControl);
|
||||||
|
vSwp.y -= pCtrl->GetYComp();
|
||||||
|
vSwp.x -= pCtrl->GetXComp();
|
||||||
}
|
}
|
||||||
else
|
::WinSetWindowPos( pChildWin->GetHWND()
|
||||||
|
,HWND_BOTTOM
|
||||||
|
,vSwp.x + nDx
|
||||||
|
,vSwp.y + nDy
|
||||||
|
,0
|
||||||
|
,0
|
||||||
|
,SWP_MOVE | SWP_ZORDER
|
||||||
|
);
|
||||||
|
if (pChildWin->IsKindOf(CLASSINFO(wxRadioBox)))
|
||||||
{
|
{
|
||||||
::WinSetWindowPos( pChildWin->GetHWND()
|
wxRadioBox* pRadioBox;
|
||||||
,HWND_BOTTOM
|
|
||||||
,vSwp.x + nDx
|
pRadioBox = wxDynamicCast(pChildWin, wxRadioBox);
|
||||||
,vSwp.y + nDy
|
pRadioBox->AdjustButtons( (int)vSwp.x + nDx
|
||||||
,0
|
,(int)vSwp.y + nDy
|
||||||
,0
|
,(int)vSwp.cx
|
||||||
,SWP_MOVE | SWP_ZORDER
|
,(int)vSwp.cy
|
||||||
);
|
,pRadioBox->GetSizeFlags()
|
||||||
::WinInvalidateRect(pChildWin->GetHWND(), &vRect, FALSE);
|
);
|
||||||
}
|
}
|
||||||
|
if (pChildWin->IsKindOf(CLASSINFO(wxSlider)))
|
||||||
|
{
|
||||||
|
wxSlider* pSlider;
|
||||||
|
|
||||||
|
pSlider = wxDynamicCast(pChildWin, wxSlider);
|
||||||
|
pSlider->AdjustSubControls( (int)vSwp.x + nDx
|
||||||
|
,(int)vSwp.y + nDy
|
||||||
|
,(int)vSwp.cx
|
||||||
|
,(int)vSwp.cy
|
||||||
|
,pSlider->GetSizeFlags()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
::WinInvalidateRect(pChildWin->GetHWND(), &vRectChild, FALSE);
|
||||||
}
|
}
|
||||||
pCurrent = pCurrent->GetNext();
|
pCurrent = pCurrent->GetNext();
|
||||||
}
|
}
|
||||||
@@ -2421,7 +2438,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
|
|||||||
// child controls, so we need to already be sized
|
// child controls, so we need to already be sized
|
||||||
// in order to get the child controls positoned properly.
|
// in order to get the child controls positoned properly.
|
||||||
//
|
//
|
||||||
if (IsKindOf(CLASSINFO(wxDialog)))
|
if (IsKindOf(CLASSINFO(wxDialog)) || IsKindOf(CLASSINFO(wxFrame)))
|
||||||
{
|
{
|
||||||
PSWP pSwp = (PSWP)PVOIDFROMMP(wParam);
|
PSWP pSwp = (PSWP)PVOIDFROMMP(wParam);
|
||||||
PSWP pSwp2 = pSwp++;
|
PSWP pSwp2 = pSwp++;
|
||||||
@@ -2432,6 +2449,16 @@ MRESULT wxWindowOS2::OS2WindowProc(
|
|||||||
,pSwp->cy
|
,pSwp->cy
|
||||||
,(WXUINT)lParam
|
,(WXUINT)lParam
|
||||||
);
|
);
|
||||||
|
if (IsKindOf(CLASSINFO(wxFrame)))
|
||||||
|
{
|
||||||
|
wxFrame* pFrame = wxDynamicCast(this, wxFrame);
|
||||||
|
|
||||||
|
if (pFrame)
|
||||||
|
{
|
||||||
|
if (pFrame->GetStatusBar())
|
||||||
|
pFrame->PositionStatusBar();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user