Some more frame formating
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12195 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -327,25 +327,23 @@ void wxFrame::DoSetClientSize(
|
|||||||
// and the client area; add this to the new client size to move the
|
// and the client area; add this to the new client size to move the
|
||||||
// window. Remember OS/2's backwards y coord system!
|
// window. Remember OS/2's backwards y coord system!
|
||||||
//
|
//
|
||||||
int nActualWidth = vRect2.xRight - vRect2.xLeft - vRect.xRight + nWidth;
|
int nActualWidth = vRect2.xRight - vRect2.xLeft - vRect.xRight;
|
||||||
int nActualHeight = vRect2.yTop + vRect2.yTop - vRect.yTop + nHeight;
|
int nActualHeight = vRect2.yTop + vRect2.yTop - vRect.yTop;
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
if ( GetStatusBar() )
|
wxStatusBar* pStatusBar = GetStatusBar();
|
||||||
{
|
|
||||||
int nStatusX;
|
|
||||||
int nStatusY;
|
|
||||||
|
|
||||||
GetStatusBar()->GetClientSize( &nStatusX
|
if (pStatusBar && pStatusBar->IsShown())
|
||||||
,&nStatusY
|
{
|
||||||
);
|
nActualHeight += pStatusBar->GetSize().y;
|
||||||
nActualHeight += nStatusY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
wxPoint vPoint(GetClientAreaOrigin());
|
wxPoint vPoint(GetClientAreaOrigin());
|
||||||
nActualWidth += vPoint.y;
|
|
||||||
nActualHeight += vPoint.x;
|
nActualWidth += vPoint.x;
|
||||||
|
nActualHeight += vPoint.y;
|
||||||
|
|
||||||
POINTL vPointl;
|
POINTL vPointl;
|
||||||
|
|
||||||
@@ -412,9 +410,19 @@ bool wxFrame::Show(
|
|||||||
bool bShow
|
bool bShow
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
int nShowCmd;
|
||||||
SWP vSwp;
|
SWP vSwp;
|
||||||
|
|
||||||
DoShowWindow((int)bShow);
|
if (bShow)
|
||||||
|
{
|
||||||
|
nShowCmd = SWP_SHOW;
|
||||||
|
}
|
||||||
|
else // hide
|
||||||
|
{
|
||||||
|
nShowCmd = SWP_HIDE;
|
||||||
|
}
|
||||||
|
|
||||||
|
DoShowWindow(nShowCmd);
|
||||||
|
|
||||||
if (bShow)
|
if (bShow)
|
||||||
{
|
{
|
||||||
@@ -1407,7 +1415,40 @@ bool wxFrame::HandlePaint()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return(wxWindow::HandlePaint());
|
if (!wxWindow::HandlePaint())
|
||||||
|
{
|
||||||
|
HPS hPS;
|
||||||
|
RECTL vRect;
|
||||||
|
|
||||||
|
hPS = ::WinBeginPaint( GetHwnd()
|
||||||
|
,NULLHANDLE
|
||||||
|
,&vRect
|
||||||
|
);
|
||||||
|
if(hPS)
|
||||||
|
{
|
||||||
|
::GpiCreateLogColorTable( hPS
|
||||||
|
,0L
|
||||||
|
,LCOLF_CONSECRGB
|
||||||
|
,0L
|
||||||
|
,(LONG)wxTheColourDatabase->m_nSize
|
||||||
|
,(PLONG)wxTheColourDatabase->m_palTable
|
||||||
|
);
|
||||||
|
::GpiCreateLogColorTable( hPS
|
||||||
|
,0L
|
||||||
|
,LCOLF_RGB
|
||||||
|
,0L
|
||||||
|
,0L
|
||||||
|
,NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
::WinFillRect( hPS
|
||||||
|
,&vRect
|
||||||
|
,GetBackgroundColour().GetPixel()
|
||||||
|
);
|
||||||
|
::WinEndPaint(hPS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -1410,49 +1410,36 @@ void wxWindowOS2::DoGetPosition(
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
HWND hWnd = GetHwnd();
|
HWND hWnd = GetHwnd();
|
||||||
RECT vRect;
|
SWP vSwp;
|
||||||
POINTL vPoint;
|
POINTL vPoint;
|
||||||
|
wxWindow* pParent = GetParent();
|
||||||
::WinQueryWindowRect(hWnd, &vRect);
|
|
||||||
|
|
||||||
vPoint.x = vRect.xLeft;
|
|
||||||
vPoint.y = vRect.yBottom;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// We do the adjustments with respect to the parent only for the "real"
|
// It would seem that WinQueryWindowRect would be the correlary to
|
||||||
// children, not for the dialogs/frames
|
// the WIN32 WinGetRect, but unlike WinGetRect which returns the window
|
||||||
|
// origin position in screen coordinates, WinQueryWindowRect returns it
|
||||||
|
// relative to itself, i.e. (0,0). To get the same under PM we must
|
||||||
|
// us WinQueryWindowPos. This call, unlike the WIN32 call, however,
|
||||||
|
// returns a position relative to it's parent, so no parent adujstments
|
||||||
|
// are needed under OS/2. Also, windows should be created using
|
||||||
|
// wxWindow coordinates, i.e 0,0 is the TOP left so vSwp will already
|
||||||
|
// reflect that.
|
||||||
//
|
//
|
||||||
if (!IsTopLevel())
|
::WinQueryWindowPos(hWnd, &vSwp);
|
||||||
|
|
||||||
|
vPoint.x = vSwp.x;
|
||||||
|
vPoint.y = vSwp.y;
|
||||||
|
|
||||||
|
//
|
||||||
|
// We may be faking the client origin. So a window that's really at (0,
|
||||||
|
// 30) may appear (to wxWin apps) to be at (0, 0).
|
||||||
|
//
|
||||||
|
if (pParent)
|
||||||
{
|
{
|
||||||
HWND hParentWnd = 0;
|
wxPoint vPt(pParent->GetClientAreaOrigin());
|
||||||
wxWindow* pParent = GetParent();
|
|
||||||
|
|
||||||
if (pParent)
|
vPoint.x -= vPt.x;
|
||||||
hParentWnd = GetWinHwnd(pParent);
|
vPoint.y -= vPt.y;
|
||||||
|
|
||||||
//
|
|
||||||
// Since we now have the absolute screen coords, if there's a parent we
|
|
||||||
// must subtract its bottom left corner
|
|
||||||
//
|
|
||||||
if (hParentWnd)
|
|
||||||
{
|
|
||||||
RECTL vRect2;
|
|
||||||
|
|
||||||
::WinQueryWindowRect(hParentWnd, &vRect2);
|
|
||||||
vPoint.x -= vRect.xLeft;
|
|
||||||
vPoint.y -= vRect.yBottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// We may be faking the client origin. So a window that's really at (0,
|
|
||||||
// 30) may appear (to wxWin apps) to be at (0, 0).
|
|
||||||
//
|
|
||||||
if (pParent) {
|
|
||||||
wxPoint vPt(pParent->GetClientAreaOrigin());
|
|
||||||
|
|
||||||
vPoint.x -= vPt.x;
|
|
||||||
vPoint.y -= vPt.y;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pX)
|
if (pX)
|
||||||
@@ -1467,18 +1454,14 @@ void wxWindowOS2::DoScreenToClient(
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
HWND hWnd = GetHwnd();
|
HWND hWnd = GetHwnd();
|
||||||
POINTL ptl;
|
SWP vSwp;
|
||||||
|
|
||||||
ptl.x = pX ? *pX : 0;
|
::WinQueryWindowPos(hWnd, &vSwp);
|
||||||
ptl.y = pY ? *pY : 0;
|
|
||||||
|
|
||||||
::WinMapWindowPoints(HWND_DESKTOP, hWnd, &ptl, 1);
|
|
||||||
|
|
||||||
if (pX)
|
if (pX)
|
||||||
*pX = ptl.x;
|
*pX += vSwp.x;
|
||||||
if (pY)
|
if (pY)
|
||||||
*pY = ptl.y;
|
*pY += vSwp.y;
|
||||||
|
|
||||||
} // end of wxWindowOS2::DoScreenToClient
|
} // end of wxWindowOS2::DoScreenToClient
|
||||||
|
|
||||||
void wxWindowOS2::DoClientToScreen(
|
void wxWindowOS2::DoClientToScreen(
|
||||||
@@ -1487,17 +1470,14 @@ void wxWindowOS2::DoClientToScreen(
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
HWND hWnd = GetHwnd();
|
HWND hWnd = GetHwnd();
|
||||||
POINTL ptl;
|
SWP vSwp;
|
||||||
|
|
||||||
ptl.x = pX ? *pX : 0;
|
::WinQueryWindowPos(hWnd, &vSwp);
|
||||||
ptl.y = pY ? *pY : 0;
|
|
||||||
|
|
||||||
::WinMapWindowPoints(hWnd, HWND_DESKTOP, &ptl, 1);
|
|
||||||
|
|
||||||
if (pX)
|
if (pX)
|
||||||
*pX = ptl.x;
|
*pX += vSwp.x;
|
||||||
if (pY)
|
if (pY)
|
||||||
*pY = ptl.y;
|
*pY += vSwp.y;
|
||||||
} // end of wxWindowOS2::DoClientToScreen
|
} // end of wxWindowOS2::DoClientToScreen
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1663,79 +1643,28 @@ void wxWindowOS2::DoSetClientSize(
|
|||||||
{
|
{
|
||||||
wxWindow* pParent = GetParent();
|
wxWindow* pParent = GetParent();
|
||||||
HWND hWnd = GetHwnd();
|
HWND hWnd = GetHwnd();
|
||||||
#if 0
|
|
||||||
HWND hParentWnd = (HWND)0;
|
HWND hParentWnd = (HWND)0;
|
||||||
HWND hClientWnd = (HWND)0;
|
POINTL vPoint;
|
||||||
RECTL vRect;
|
RECTL vRect;
|
||||||
RECT vRect2;
|
RECTL vRect2;
|
||||||
RECT vRect3;
|
RECTL vRect3;
|
||||||
|
HWND hClientWnd = (HWND)0;
|
||||||
|
|
||||||
hClientWnd = ::WinWindowFromID(GetHwnd(), FID_CLIENT);
|
hClientWnd = ::WinWindowFromID(hWnd, FID_CLIENT);
|
||||||
::WinQueryWindowRect(hClientWnd, &vRect2);
|
::WinQueryWindowRect(hClientWnd, &vRect2);
|
||||||
|
|
||||||
if (pParent)
|
|
||||||
hParentWnd = (HWND) pParent->GetHWND();
|
|
||||||
|
|
||||||
::WinQueryWindowRect(hWnd, &vRect);
|
::WinQueryWindowRect(hWnd, &vRect);
|
||||||
::WinQueryWindowRect(hParentWnd, &vRect3);
|
::WinQueryWindowRect(hParentWnd, &vRect3);
|
||||||
//
|
|
||||||
// Find the difference between the entire window (title bar and all)
|
|
||||||
// and the client area; add this to the new client size to move the
|
|
||||||
// window. OS/2 is backward from windows on height
|
|
||||||
//
|
|
||||||
int nActualWidth = vRect2.xRight - vRect2.xLeft - vRect.xRight + nWidth;
|
int nActualWidth = vRect2.xRight - vRect2.xLeft - vRect.xRight + nWidth;
|
||||||
int nActualHeight = vRect2.yTop - vRect2.yBottom - vRect.yTop + nHeight;
|
int nActualHeight = vRect2.yTop - vRect2.yBottom - vRect.yTop + nHeight;
|
||||||
|
|
||||||
//
|
|
||||||
// If there's a parent, must subtract the parent's bottom left corner
|
|
||||||
// since MoveWindow moves relative to the parent
|
|
||||||
//
|
|
||||||
POINTL vPoint;
|
|
||||||
|
|
||||||
vPoint.x = vRect2.xLeft;
|
|
||||||
vPoint.y = vRect2.yBottom;
|
|
||||||
if (pParent)
|
|
||||||
{ x
|
|
||||||
vPoint.x -= vRect3.xLeft;
|
|
||||||
vPoint.y -= vRect3.yBottom;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
HWND hParentWnd = (HWND)0;
|
|
||||||
HWND hClientWnd = (HWND)0;
|
|
||||||
RECTL vRect;
|
|
||||||
RECT vRect2;
|
|
||||||
|
|
||||||
hClientWnd = ::WinWindowFromID(GetHwnd(), FID_CLIENT);
|
|
||||||
::WinQueryWindowRect(hClientWnd, &vRect2);
|
|
||||||
::WinQueryWindowRect(hWnd, &vRect2);
|
|
||||||
|
|
||||||
if (pParent)
|
|
||||||
hParentWnd = (HWND) pParent->GetHWND();
|
|
||||||
|
|
||||||
::WinQueryWindowRect(hWnd, &vRect);
|
|
||||||
//
|
|
||||||
// Find the difference between the entire window (title bar and all)
|
|
||||||
// and the client area; add this to the new client size to move the
|
|
||||||
// window. OS/2 is backward from windows on height
|
|
||||||
//
|
|
||||||
int nActualWidth = vRect2.xRight - vRect2.xLeft - vRect.xRight + nWidth;
|
|
||||||
int nActualHeight = vRect2.yTop - vRect2.yBottom - vRect.yTop + nHeight;
|
|
||||||
|
|
||||||
nActualWidth = nWidth;
|
|
||||||
nActualHeight = nHeight;
|
|
||||||
//
|
|
||||||
// If there's a parent, must subtract the parent's bottom left corner
|
|
||||||
// since MoveWindow moves relative to the parent
|
|
||||||
//
|
|
||||||
POINTL vPoint;
|
|
||||||
|
|
||||||
vPoint.x = vRect2.xLeft;
|
vPoint.x = vRect2.xLeft;
|
||||||
vPoint.y = vRect2.yBottom;
|
vPoint.y = vRect2.yBottom;
|
||||||
if (pParent)
|
if (pParent)
|
||||||
{
|
{
|
||||||
::WinMapWindowPoints(hWnd, hParentWnd, &vPoint, 1);
|
vPoint.x -= vRect3.xLeft;
|
||||||
|
vPoint.y -= vRect3.yBottom;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
DoMoveWindow(vPoint.x, vPoint.y, nActualWidth, nActualHeight);
|
DoMoveWindow(vPoint.x, vPoint.y, nActualWidth, nActualHeight);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user