#pragma implementation "radiobox.h"
#endif
+#ifdef __VMS
+#define XtDisplay XTDISPLAY
+#endif
+
+#include "wx/defs.h"
+
#include "wx/radiobox.h"
#include "wx/utils.h"
#endif
XmNfontList, fontList,
NULL);
-#ifdef __VMS__
-#pragma message disable voiincconext
- // VMS gives here the compiler warning:
- // conversion from pointer to function to void* permitted
- // as an extension
-#endif
XtAddCallback ((Widget) m_radioButtons[i], XmNvalueChangedCallback, (XtCallbackProc) wxRadioBoxCallback,
- (XtCallbackProc) this);
-#ifdef __VMS__
-#pragma message enable voiincconext
-#endif
-
+ (XtPointer) this);
}
SetSelection (0);
m_labelWidget = (WXWidget) 0;
}
-wxString wxRadioBox::GetLabel(int item) const
-{
- if (item < 0 || item >= m_noItems)
- return wxEmptyString;
-
- Widget widget = (Widget) m_radioButtons[item];
- XmString text;
- char *s;
- XtVaGetValues (widget,
- XmNlabelString, &text,
- NULL);
-
- if (XmStringGetLtoR (text, XmSTRING_DEFAULT_CHARSET, &s))
- {
- // Should we free 'text'???
- XmStringFree(text);
- wxString str(s);
- XtFree (s);
- return str;
- }
- else
- {
- XmStringFree(text);
- return wxEmptyString;
- }
-}
-
-void wxRadioBox::SetLabel(int item, const wxString& label)
+void wxRadioBox::SetString(int item, const wxString& label)
{
if (item < 0 || item >= m_noItems)
return;
// Please note that this is all we can do: removing the label
// if switching to unshow state. However, when switching
- // to the on state, it's the prog. resp. to call SetLabel(item,...)
+ // to the on state, it's the prog. resp. to call SetString(item,...)
// after this call!!
if (!show)
- wxRadioBox::SetLabel (n, " ");
+ wxRadioBox::SetString (n, " ");
}
// For single selection items only
}
}
+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;
- for (i = 0; i < item->Number(); i++)
+ for (i = 0; i < item->GetCount(); i++)
if (item->GetRadioButtons() && ((Widget) (item->GetRadioButtons()[i]) == w))
sel = i;
item->SetSel(sel);