X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8e44f3caabe53f60a2335a14cf9b57187fe39b1e..7dab17dd7aa966d558733ada7edecb96a4f40a7a:/src/msw/radiobox.cpp diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 82c3471b21..35860e2313 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -17,10 +17,6 @@ // headers // --------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "radiobox.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -40,8 +36,6 @@ #include "wx/msw/subwin.h" -#define USE_DEFERRED_SIZING 1 - #if wxUSE_TOOLTIPS #if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__) #include @@ -371,6 +365,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 +421,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 +494,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. @@ -547,17 +548,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) height = heightOld; } - // 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); + DoMoveWindow(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 @@ -654,22 +645,6 @@ 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; - - // hdwp must be updated as it may have been changed - parent->m_hDWP = (WXHANDLE)hdwp; - } } // ---------------------------------------------------------------------------- @@ -698,28 +673,11 @@ WXHRGN wxRadioBox::MSWGetRegionWithoutChildren() 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 && IsKindOf(CLASSINFO(wxRadioBox))) + if ( nMsg == WM_MOVE ) { WXLRESULT res = wxControl::MSWWindowProc(nMsg, wParam, lParam); wxRect rect = GetRect();