fixed DoSetClientSize() to use ::MoveWindow() instead of deferred sizing which never updated the client size we were checking here

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34806 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2005-07-02 22:22:20 +00:00
parent 7a19fb6e5f
commit b0268dafc1

View File

@ -1692,28 +1692,21 @@ void wxWindowMSW::DoSetClientSize(int width, int height)
RECT rectClient;
::GetClientRect(GetHwnd(), &rectClient);
// if the size is already ok, stop here (rectClient.left = top = 0)
// if the size is already ok, stop here (NB: rectClient.left = top = 0)
if ( (rectClient.right == width || width == wxDefaultCoord) &&
(rectClient.bottom == height || height == wxDefaultCoord) )
{
break;
}
int widthClient = width,
heightClient = height;
// 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
RECT rectWin;
::GetWindowRect(GetHwnd(), &rectWin);
widthClient += rectWin.right - rectWin.left - rectClient.right;
heightClient += rectWin.bottom - rectWin.top - rectClient.bottom;
POINT point;
point.x = rectWin.left;
point.y = rectWin.top;
const int widthWin = rectWin.right - rectWin.left,
heightWin = rectWin.bottom - rectWin.top;
// MoveWindow positions the child windows relative to the parent, so
// adjust if necessary
@ -1722,11 +1715,21 @@ void wxWindowMSW::DoSetClientSize(int width, int height)
wxWindow *parent = GetParent();
if ( parent )
{
::ScreenToClient(GetHwndOf(parent), &point);
::ScreenToClient(GetHwndOf(parent), (POINT *)&rectWin);
}
}
DoMoveWindow(point.x, point.y, widthClient, heightClient);
// don't call DoMoveWindow() because we want to move window immediately
// and not defer it here
if ( !::MoveWindow(GetHwnd(),
rectWin.left,
rectWin.top,
width + widthWin - rectClient.right,
height + heightWin - rectClient.bottom,
TRUE) )
{
wxLogLastError(_T("MoveWindow"));
}
}
}