return pending position/size if any, not the current one

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35008 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-07-30 00:02:55 +00:00
parent 7d86a2d45c
commit 11cfa8ef8d

View File

@@ -1453,17 +1453,32 @@ void wxWindowMSW::DoSetToolTip(wxToolTip *tooltip)
// Get total size // Get total size
void wxWindowMSW::DoGetSize(int *x, int *y) const void wxWindowMSW::DoGetSize(int *x, int *y) const
{ {
RECT rect = wxGetWindowRect(GetHwnd()); // if SetSize() had been called at wx level but not realized at Windows
// level yet (i.e. EndDeferWindowPos() not called), we still should return
// the new and not the old position to the other wx code
if ( m_pendingSize != wxDefaultSize )
{
if ( x )
*x = m_pendingSize.x;
if ( y )
*y = m_pendingSize.y;
}
else // use current size
{
RECT rect = wxGetWindowRect(GetHwnd());
if ( x ) if ( x )
*x = rect.right - rect.left; *x = rect.right - rect.left;
if ( y ) if ( y )
*y = rect.bottom - rect.top; *y = rect.bottom - rect.top;
}
} }
// Get size *available for subwindows* i.e. excluding menu bar etc. // Get size *available for subwindows* i.e. excluding menu bar etc.
void wxWindowMSW::DoGetClientSize(int *x, int *y) const void wxWindowMSW::DoGetClientSize(int *x, int *y) const
{ {
// this is only for top level windows whose resizing is never deferred, so
// we can safely use the current size here
RECT rect = wxGetClientRect(GetHwnd()); RECT rect = wxGetClientRect(GetHwnd());
if ( x ) if ( x )
@@ -1474,42 +1489,52 @@ void wxWindowMSW::DoGetClientSize(int *x, int *y) const
void wxWindowMSW::DoGetPosition(int *x, int *y) const void wxWindowMSW::DoGetPosition(int *x, int *y) const
{ {
RECT rect = wxGetWindowRect(GetHwnd()); if ( m_pendingPosition != wxDefaultPosition )
POINT point;
point.x = rect.left;
point.y = rect.top;
// we do the adjustments with respect to the parent only for the "real"
// children, not for the dialogs/frames
if ( !IsTopLevel() )
{ {
HWND hParentWnd = 0; if ( x )
wxWindow *parent = GetParent(); *x = m_pendingPosition.x;
if ( parent ) if ( y )
hParentWnd = GetWinHwnd(parent); *y = m_pendingPosition.y;
// Since we now have the absolute screen coords, if there's a
// parent we must subtract its top left corner
if ( hParentWnd )
{
::ScreenToClient(hParentWnd, &point);
}
if ( parent )
{
// 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).
wxPoint pt(parent->GetClientAreaOrigin());
point.x -= pt.x;
point.y -= pt.y;
}
} }
else // use current position
{
RECT rect = wxGetWindowRect(GetHwnd());
if ( x ) POINT point;
*x = point.x; point.x = rect.left;
if ( y ) point.y = rect.top;
*y = point.y;
// we do the adjustments with respect to the parent only for the "real"
// children, not for the dialogs/frames
if ( !IsTopLevel() )
{
HWND hParentWnd = 0;
wxWindow *parent = GetParent();
if ( parent )
hParentWnd = GetWinHwnd(parent);
// Since we now have the absolute screen coords, if there's a
// parent we must subtract its top left corner
if ( hParentWnd )
{
::ScreenToClient(hParentWnd, &point);
}
if ( parent )
{
// 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).
wxPoint pt(parent->GetClientAreaOrigin());
point.x -= pt.x;
point.y -= pt.y;
}
}
if ( x )
*x = point.x;
if ( y )
*y = point.y;
}
} }
void wxWindowMSW::DoScreenToClient(int *x, int *y) const void wxWindowMSW::DoScreenToClient(int *x, int *y) const