const wxValidator& val,
const wxString& name)
{
- // initialize members
- SetMajorDim(majorDim == 0 ? n : majorDim, style);
-
// common initialization
if ( !wxStaticBox::Create(parent, id, title, pos, size, style, name) )
return false;
choices[i],
styleBtn,
0, 0, 0, 0, // will be set in SetSize()
- GetHwnd(),
+ GetHwndOf(parent),
(HMENU)newId,
wxGetInstance(),
NULL);
(void)::CreateWindow(_T("BUTTON"),
wxEmptyString,
WS_GROUP | BS_AUTORADIOBUTTON | WS_CHILD,
- 0, 0, 0, 0, GetHwnd(),
+ 0, 0, 0, 0, GetHwndOf(parent),
(HMENU)NewControlId(), wxGetInstance(), NULL);
m_radioButtons->SetFont(GetFont());
SetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
#endif
+ SetMajorDim(majorDim == 0 ? n : majorDim, style);
SetSelection(0);
SetSize(pos.x, pos.y, size.x, size.y);
int selectedButton = wxNOT_FOUND;
- int count = GetCount();
- for ( int i = 0; i < count; i++ )
+ const unsigned int count = GetCount();
+ for ( unsigned int i = 0; i < count; i++ )
{
if ( id == wxGetWindowId((*m_radioButtons)[i]) )
{
{
wxCommandEvent event(wxEVT_COMMAND_RADIOBOX_SELECTED, m_windowId);
event.SetInt( m_selectedButton );
- event.SetString( GetString(m_selectedButton) );
+ event.SetString(GetString(m_selectedButton));
event.SetEventObject( this );
ProcessCommand(event);
}
// simple accessors
// ----------------------------------------------------------------------------
-int wxRadioBox::GetCount() const
+unsigned int wxRadioBox::GetCount() const
{
return m_radioButtons->GetCount();
}
-void wxRadioBox::SetString(int item, const wxString& label)
+void wxRadioBox::SetString(unsigned int item, const wxString& label)
{
wxCHECK_RET( IsValid(item), wxT("invalid radiobox index") );
}
// Find string for position
-wxString wxRadioBox::GetString(int item) const
+wxString wxRadioBox::GetString(unsigned int item) const
{
wxCHECK_MSG( IsValid(item), wxEmptyString,
wxT("invalid radiobox index") );
}
// Enable a specific button
-bool wxRadioBox::Enable(int item, bool enable)
+bool wxRadioBox::Enable(unsigned int item, bool enable)
{
wxCHECK_MSG( IsValid(item), false,
wxT("invalid item in wxRadioBox::Enable()") );
return (ret == 0) != enable;
}
-bool wxRadioBox::IsItemEnabled(int item) const
+bool wxRadioBox::IsItemEnabled(unsigned int item) const
{
wxCHECK_MSG( IsValid(item), false,
- wxT("invalid item in wxRadioBox::Enable()") );
+ wxT("invalid item in wxRadioBox::IsItemEnabled()") );
return ::IsWindowEnabled((*m_radioButtons)[item]) != 0;
}
// Show a specific button
-bool wxRadioBox::Show(int item, bool show)
+bool wxRadioBox::Show(unsigned int item, bool show)
{
wxCHECK_MSG( IsValid(item), false,
wxT("invalid item in wxRadioBox::Show()") );
return changed;
}
-bool wxRadioBox::IsItemShown(int item) const
+bool wxRadioBox::IsItemShown(unsigned int item) const
{
wxCHECK_MSG( IsValid(item), false,
- wxT("invalid item in wxRadioBox::Enable()") );
+ wxT("invalid item in wxRadioBox::IsItemShown()") );
// don't use IsWindowVisible() here because it would return false if the
// radiobox itself is hidden while we want to only return false if this
// calculate the max button size
int widthMax = 0,
heightMax = 0;
- const int count = GetCount();
- for ( int i = 0 ; i < count; i++ )
+ const unsigned int count = GetCount();
+ for ( unsigned int i = 0 ; i < count; i++ )
{
int width, height;
if ( m_radioWidth[i] < 0 )
// and also wide enough for its label
int widthLabel;
- GetTextExtent(GetLabel(), &widthLabel, NULL);
+ GetTextExtent(wxStripMenuCodes(GetLabel()), &widthLabel, NULL);
widthLabel += RADIO_SIZE; // FIXME this is bogus too
if ( widthLabel > width )
width = widthLabel;
if (y == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
yy = currentY;
- int y_offset = 0;
- int x_offset = 0;
+ int y_offset = yy;
+ int x_offset = xx;
int cx1, cy1;
wxGetCharSize(m_hWnd, &cx1, &cy1, GetFont());
int startX = x_offset;
int startY = y_offset;
- const int count = GetCount();
- for ( int i = 0; i < count; i++ )
+ const unsigned int count = GetCount();
+ for (unsigned int i = 0; i < count; i++)
{
// the last button in the row may be wider than the other ones as the
// radiobox may be wider than the sum of the button widths (as it
{
// item is the last in its row if it is a multiple of the number of
// columns or if it is just the last item
- int n = i + 1;
+ unsigned int n = i + 1;
isLastInTheRow = ((n % GetMajorDim()) == 0) || (n == count);
}
else // wxRA_SPECIFY_ROWS
// the radiobox entirely and the radiobox tooltips are always shown
// (otherwise they are not when the mouse pointer is in the radiobox
// part not belonging to any radiobutton)
- ::MoveWindow((*m_radioButtons)[i],
- x_offset, y_offset, widthBtn, maxHeight,
- TRUE);
+ DoMoveSibling((*m_radioButtons)[i], x_offset, y_offset, widthBtn, maxHeight);
// where do we put the next button?
if ( m_windowStyle & wxRA_SPECIFY_ROWS )
::GetWindowRect(GetHwnd(), &rc);
HRGN hrgn = ::CreateRectRgn(rc.left, rc.top, rc.right + 1, rc.bottom + 1);
- const size_t count = GetCount();
- for ( size_t i = 0; i < count; ++i )
+ const unsigned int count = GetCount();
+ for ( unsigned int i = 0; i < count; ++i )
{
// don't clip out hidden children
if ( !IsItemShown(i) )
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__
// ---------------------------------------------------------------------------