X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/283587a491a718c8f568f70a143c9b1b2992306b..3c203a185145a1aa720faf53e7f6fbebb35bce7a:/src/msw/radiobox.cpp diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index dcbbe09151..b5cdc6eeda 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -40,7 +40,10 @@ #include "wx/msw/subwin.h" -#define USE_DEFERRED_SIZING 1 +// 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__) @@ -371,6 +374,8 @@ void wxRadioBox::SetString(int item, const wxString& label) m_radioHeight[item] = wxDefaultCoord; ::SetWindowText((*m_radioButtons)[item], label.c_str()); + + InvalidateBestSize(); } void wxRadioBox::SetSelection(int N) @@ -425,7 +430,10 @@ bool wxRadioBox::Show(int item, bool show) BOOL ret = ::ShowWindow((*m_radioButtons)[item], show ? SW_SHOW : SW_HIDE); - return (ret != 0) == show; + bool changed = (ret != 0) == show; + if( changed ) + InvalidateBestSize(); + return changed; } WX_FORWARD_STD_METHODS_TO_SUBWINDOWS(wxRadioBox, wxStaticBox, m_radioButtons) @@ -495,7 +503,9 @@ wxSize wxRadioBox::GetTotalButtonSize(const wxSize& sizeBtn) const wxSize wxRadioBox::DoGetBestSize() const { - return GetTotalButtonSize(GetMaxButtonSize()); + wxSize best = GetTotalButtonSize(GetMaxButtonSize()); + CacheBestSize(best); + return best; } // Restored old code. @@ -549,13 +559,13 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) // 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 + wxWindowMSW *parent = GetParent(); HDWP hdwp = parent && !IsTopLevel() ? (HDWP)parent->m_hDWP : NULL; #else HDWP hdwp = 0; -#endif +#endif wxMoveWindowDeferred(hdwp, this, GetHwnd(), xx, yy, width, height); @@ -654,22 +664,14 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) 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 } // ----------------------------------------------------------------------------