by refreshing parent when the radio box moves.
- Added ability set the system option "msw.staticbox.optimized-paint" to 0 to
allow a panel to paint graphics around controls within a static box.
+- Worked around an apparent bug in deferred window positioning (moving a
+ window from (x, y) to (a, b) and back to (x, y) misses the last step) by
+ checking window positions against corresponding sizer state, if any.
wxMac:
extern wxWinHashTable *wxWinHandleHash;
-// ----------------------------------------------------------------------------
-// extra data needed for correcting problems with deferred positioning
-// ----------------------------------------------------------------------------
-
-struct wxExtraWindowData
-{
- // Stored during deferred positioning
- wxPoint m_pos;
- wxSize m_size;
- bool m_deferring:1;
-};
-
#endif
// _WX_WINDOW_H_
x_offset += widthBtn + cx1;
}
}
- if (hdwp)
- {
- // Store the size so we can report it accurately
- wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved;
- if (!extraData)
- {
- extraData = new wxExtraWindowData;
- m_windowReserved = (void*) extraData;
- }
- extraData->m_pos = wxPoint(xx, yy);
- extraData->m_size = wxSize(width, height);
- extraData->m_deferring = true;
+#if USE_DEFERRED_SIZING
+ if (parent)
+ {
// hdwp must be updated as it may have been changed
parent->m_hDWP = (WXHANDLE)hdwp;
}
+#endif
}
// ----------------------------------------------------------------------------
#endif
#define USE_DEFERRED_SIZING 1
-#define USE_DEFER_BUG_WORKAROUND 0
// ----------------------------------------------------------------------------
// constants
width,
height - hLabel);
}
- if ( hdwp )
- {
- // Store the size so we can report it accurately
- wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved;
- if (!extraData)
- {
- extraData = new wxExtraWindowData;
- m_windowReserved = (void*) extraData;
- }
- extraData->m_pos = wxPoint(x, y);
- extraData->m_size = wxSize(width, height);
- extraData->m_deferring = true;
+#if USE_DEFERRED_SIZING
+ if ( parent )
+ {
// hdwp must be updated as it may have been changed
parent->m_hDWP = (WXHANDLE)hdwp;
}
+#endif
}
wxSize wxSlider::DoGetBestSize() const
wxMoveWindowDeferred(hdwp, this, GetHwnd(),
x, y, widthBtn, height);
- if (hdwp)
+#if USE_DEFERRED_SIZING
+ if (parent)
{
- // Store the size so we can report it accurately
- wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved;
- if (!extraData)
- {
- extraData = new wxExtraWindowData;
- m_windowReserved = (void*) extraData;
- }
- extraData->m_pos = wxPoint(originalX, y);
- extraData->m_size = wxSize(width, height);
- extraData->m_deferring = true;
-
// hdwp must be updated as it may have been changed
parent->m_hDWP = (WXHANDLE)hdwp;
}
+#endif
}
// get total size of the control
void wxSpinCtrl::DoGetSize(int *x, int *y) const
{
-#if USE_DEFER_BUG_WORKAROUND
- wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved;
- if (extraData && extraData->m_deferring && GetParent() && GetParent()->m_hDWP)
- {
- *x = extraData->m_size.x;
- *y = extraData->m_size.y;
- return;
- }
-#endif
-
RECT spinrect, textrect, ctrlrect;
GetWindowRect(GetHwnd(), &spinrect);
GetWindowRect(GetBuddyHwnd(), &textrect);
void wxSpinCtrl::DoGetPosition(int *x, int *y) const
{
-#if USE_DEFER_BUG_WORKAROUND
- wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved;
- if (extraData && extraData->m_deferring && GetParent() && GetParent()->m_hDWP)
- {
- *x = extraData->m_pos.x;
- *y = extraData->m_pos.y;
- return;
- }
-#endif
-
// hack: pretend that our HWND is the text control just for a moment
WXHWND hWnd = GetHWND();
wxConstCast(this, wxSpinCtrl)->m_hWnd = m_hwndBuddy;
#endif // everything needed for TrackMouseEvent()
#define USE_DEFERRED_SIZING 1
-#define USE_DEFER_BUG_WORKAROUND 0
+#define USE_DEFER_BUG_WORKAROUND 1
// ---------------------------------------------------------------------------
// global variables
{
m_isBeingDeleted = true;
- if (m_windowReserved)
- {
- delete (wxExtraWindowData*) m_windowReserved;
- m_windowReserved = NULL;
- }
-
#ifndef __WXUNIVERSAL__
// VS: make sure there's no wxFrame with last focus set to us:
for ( wxWindow *win = GetParent(); win; win = win->GetParent() )
// Get total size
void wxWindowMSW::DoGetSize(int *x, int *y) const
{
-#if USE_DEFER_BUG_WORKAROUND
- wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved;
- if (extraData && extraData->m_deferring && GetParent() && GetParent()->m_hDWP)
- {
- *x = extraData->m_size.x;
- *y = extraData->m_size.y;
- return;
- }
-#endif
-
RECT rect = wxGetWindowRect(GetHwnd());
if ( x )
void wxWindowMSW::DoGetPosition(int *x, int *y) const
{
-#if USE_DEFER_BUG_WORKAROUND
- wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved;
- if (extraData && extraData->m_deferring && GetParent() && GetParent()->m_hDWP)
- {
- *x = extraData->m_pos.x;
- *y = extraData->m_pos.y;
- return;
- }
-#endif
-
RECT rect = wxGetWindowRect(GetHwnd());
POINT point;
wxMoveWindowDeferred(hdwp, this, GetHwnd(), x, y, width, height);
- if ( hdwp )
- {
- // Store the size so we can report it accurately
- wxExtraWindowData* extraData = (wxExtraWindowData*) m_windowReserved;
- if (!extraData)
- {
- extraData = new wxExtraWindowData;
- m_windowReserved = (void*) extraData;
- }
- extraData->m_pos = wxPoint(x, y);
- extraData->m_size = wxSize(width, height);
- extraData->m_deferring = true;
-
+#if USE_DEFERRED_SIZING
+ if ( parent )
// hdwp must be updated as it may have been changed
parent->m_hDWP = (WXHANDLE)hdwp;
- }
+#endif
}
// set the size of the window: if the dimensions are positive, just use them,
node = node->GetNext() )
{
wxWindow *child = node->GetData();
- wxExtraWindowData* extraData = (wxExtraWindowData*) child->m_windowReserved;
- if (extraData && extraData->m_deferring)
+ wxSizer* sizer = child->GetContainingSizer();
+ if (sizer)
{
- wxPoint pos = child->GetPosition();
-
- if (extraData->m_pos != pos)
- child->Move(extraData->m_pos);
-
- extraData->m_deferring = false;
+ wxSizerItem* item = sizer->GetItem(child, true);
+ if (item->GetRect().GetPosition() != child->GetPosition())
+ {
+ child->Move(item->GetRect().GetPosition());
+ }
}
}
#endif