#include "wx/msw/subwin.h"
+// This is switched off because in some situations, the radiobox
+// buttons simply don't appear when deferred sizing is on.
+// Instead, refreshing on WM_MOVE seems to at least cure the droppings.
+#define USE_DEFERRED_SIZING 0
+
#if wxUSE_TOOLTIPS
#if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__)
#include <commctrl.h>
height = heightOld;
}
- ::MoveWindow(GetHwnd(), xx, yy, width, height, TRUE);
+ // if our parent had prepared a defer window handle for us, use it (unless
+ // we are a top level window)
+ wxWindowMSW *parent = GetParent();
+
+#if USE_DEFERRED_SIZING
+ HDWP hdwp = parent && !IsTopLevel() ? (HDWP)parent->m_hDWP : NULL;
+#else
+ HDWP hdwp = 0;
+#endif
+
+ wxMoveWindowDeferred(hdwp, this, GetHwnd(), xx, yy, width, height);
// Now position all the buttons: the current button will be put at
// wxPoint(x_offset, y_offset) and the new row/column will start at
x_offset += widthBtn + cx1;
}
}
+
+#if USE_DEFERRED_SIZING
+ if (parent)
+ {
+ // hdwp must be updated as it may have been changed
+ parent->m_hDWP = (WXHANDLE)hdwp;
+ }
+#endif
}
// ----------------------------------------------------------------------------
return (WXHRGN)hrgn;
}
+WXLRESULT
+wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
+{
+ if ( nMsg == WM_PRINTCLIENT )
+ {
+ // we have to process WM_PRINTCLIENT ourselves as otherwise the radio
+ // buttons background would never be drawn unless we have a parent with
+ // non default background
+
+ // so check first if we have one
+ if ( !HandlePrintClient((WXHDC)wParam) )
+ {
+ // no, we don't, erase the background ourselves (don't use our own
+ // colour as with static box, see comments there)
+ wxBrush brush(GetParent()->GetBackgroundColour());
+ wxFillRect(GetHwnd(), (HDC)wParam, GetHbrushOf(brush));
+ }
+
+ return 0;
+ }
+ // FIXME: Without this, the radiobox corrupts other controls as it moves
+ // in a dynamic layout. Refreshing causes flicker, but it's better than
+ // leaving droppings. Note that for some reason, wxStaticBox doesn't need
+ // this (perhaps because it has no real children?)
+ else if (nMsg == WM_MOVE)
+ {
+ WXLRESULT res = wxControl::MSWWindowProc(nMsg, wParam, lParam);
+ wxRect rect = GetRect();
+ GetParent()->Refresh(true, & rect);
+ return res;
+ }
+
+ return wxStaticBox::MSWWindowProc(nMsg, wParam, lParam);
+}
+
#endif // __WXWINCE__
// ---------------------------------------------------------------------------