/////////////////////////////////////////////////////////////////////////////
-// Name: msw/radiobox.cpp
+// Name: src/msw/radiobox.cpp
// Purpose: wxRadioBox implementation
// Author: Julian Smart
// Modified by:
// 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"
m_radioHeight[item] = wxDefaultCoord;
::SetWindowText((*m_radioButtons)[item], label.c_str());
+
+ InvalidateBestSize();
}
void wxRadioBox::SetSelection(int N)
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)
// and also wide enough for its label
int widthLabel;
- GetTextExtent(GetTitle(), &widthLabel, NULL);
+ GetTextExtent(GetLabel(), &widthLabel, NULL);
widthLabel += RADIO_SIZE; // FIXME this is bogus too
if ( widthLabel > width )
width = widthLabel;
wxSize wxRadioBox::DoGetBestSize() const
{
- return GetTotalButtonSize(GetMaxButtonSize());
+ wxSize best = GetTotalButtonSize(GetMaxButtonSize());
+ CacheBestSize(best);
+ return best;
}
// Restored old code.
height = heightOld;
}
- ::MoveWindow(GetHwnd(), xx, yy, width, height, TRUE);
+ 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
return (WXHRGN)hrgn;
}
+WXLRESULT
+wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
+{
+ // 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?)
+ 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__
// ---------------------------------------------------------------------------
}
#endif // wxUSE_RADIOBOX
-