// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
+#if wxUSE_RADIOBOX
+
#ifdef __VMS
#define XtDisplay XTDISPLAY
#endif
-#include "wx/defs.h"
-
#include "wx/radiobox.h"
#include "wx/utils.h"
#include "wx/arrstr.h"
m_selectedButton = -1;
m_noItems = 0;
m_noRowsOrCols = 0;
- m_majorDim = 0 ;
}
bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
if( !CreateControl( parent, id, pos, size, style, val, name ) )
return false;
- m_noItems = n;
+ m_noItems = (size_t)n;
m_noRowsOrCols = majorDim;
- if (majorDim==0)
- m_majorDim = n ;
- else
- m_majorDim = majorDim ;
+ SetMajorDim(majorDim == 0 ? n : majorDim, style);
Widget parentWidget = (Widget) parent->GetClientWidget();
Display* dpy = XtDisplay(parentWidget);
Arg args[3];
- m_majorDim = (n + m_majorDim - 1) / m_majorDim;
-
XtSetArg (args[0], XmNorientation, ((style & wxHORIZONTAL) == wxHORIZONTAL ?
XmHORIZONTAL : XmVERTICAL));
- XtSetArg (args[1], XmNnumColumns, m_majorDim);
+ XtSetArg (args[1], XmNnumColumns, GetMajorDim());
XtSetArg (args[2], XmNadjustLast, False);
Widget radioBoxWidget =
XmToggleButtonSetState ((Widget) m_radioButtons[n], True, False);
- int i;
- for (i = 0; i < m_noItems; i++)
- if (i != n)
+ for (size_t i = 0; i < m_noItems; i++)
+ if (i != (size_t)n)
XmToggleButtonSetState ((Widget) m_radioButtons[i], False, False);
m_inSetValue = false;
if ( !wxControl::Enable(enable) )
return false;
- int i;
- for (i = 0; i < m_noItems; i++)
+ for (size_t i = 0; i < m_noItems; i++)
XtSetSensitive ((Widget) m_radioButtons[i], (Boolean) enable);
return true;
{
wxWindow::ChangeFont(keepOriginalSize);
- int i;
- for (i = 0; i < m_noItems; i++)
+ for (size_t i = 0; i < m_noItems; i++)
{
WXWidget radioButton = m_radioButtons[i];
int selectPixel = wxBLACK->AllocColour(XtDisplay((Widget)m_mainWidget));
- int i;
- for (i = 0; i < m_noItems; i++)
+ for (size_t i = 0; i < m_noItems; i++)
{
WXWidget radioButton = m_radioButtons[i];
{
wxWindow::ChangeForegroundColour();
- int i;
- for (i = 0; i < m_noItems; i++)
+ for (size_t i = 0; i < m_noItems; i++)
{
WXWidget radioButton = m_radioButtons[i];
}
}
-static int CalcOtherDim( int items, int dim )
-{
- return items / dim + ( items % dim ? 1 : 0 );
-}
-
-int wxRadioBox::GetRowCount() const
-{
- return m_windowStyle & wxRA_SPECIFY_ROWS ? m_noRowsOrCols
- : CalcOtherDim( GetCount(), m_noRowsOrCols );
-}
-
-int wxRadioBox::GetColumnCount() const
-{
- return m_windowStyle & wxRA_SPECIFY_COLS ? m_noRowsOrCols
- : CalcOtherDim( GetCount(), m_noRowsOrCols );
-}
-
void wxRadioBoxCallback (Widget w, XtPointer clientData,
XmToggleButtonCallbackStruct * cbs)
{
wxRadioBox *item = (wxRadioBox *) clientData;
int sel = -1;
- int i;
+ size_t i;
const wxWidgetArray& buttons = item->GetRadioButtons();
for (i = 0; i < item->GetCount(); i++)
if (((Widget)buttons[i]) == w)
- sel = i;
+ sel = (int)i;
item->SetSel(sel);
if (item->InSetValue())
event.SetEventObject(item);
item->ProcessCommand (event);
}
+
+#endif // wxUSE_RADIOBOX