+void wxRadioBox::ChangeFont(bool keepOriginalSize)
+{
+ wxWindow::ChangeFont(keepOriginalSize);
+
+ WXFontType fontType =
+ m_font.GetFontType(XtDisplay((Widget) GetTopWidget()));
+
+ int i;
+ for (i = 0; i < m_noItems; i++)
+ {
+ WXWidget radioButton = m_radioButtons[i];
+
+ XtVaSetValues ((Widget) radioButton,
+ wxFont::GetFontTag(), fontType,
+ NULL);
+ }
+}
+
+void wxRadioBox::ChangeBackgroundColour()
+{
+ wxWindow::ChangeBackgroundColour();
+
+ int selectPixel = wxBLACK->AllocColour(XtDisplay((Widget)m_mainWidget));
+
+ int i;
+ for (i = 0; i < m_noItems; i++)
+ {
+ WXWidget radioButton = m_radioButtons[i];
+
+ wxDoChangeBackgroundColour(radioButton, m_backgroundColour, TRUE);
+
+ XtVaSetValues ((Widget) radioButton,
+ XmNselectColor, selectPixel,
+ NULL);
+ }
+}
+
+void wxRadioBox::ChangeForegroundColour()
+{
+ wxWindow::ChangeForegroundColour();
+
+ int i;
+ for (i = 0; i < m_noItems; i++)
+ {
+ WXWidget radioButton = m_radioButtons[i];
+
+ wxDoChangeForegroundColour(radioButton, m_foregroundColour);
+ }
+}
+
+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)
+{
+ if (!cbs->set)
+ return;
+
+ wxRadioBox *item = (wxRadioBox *) clientData;
+ int sel = -1;
+ int i;
+ const wxWidgetArray& buttons = item->GetRadioButtons();
+ for (i = 0; i < item->GetCount(); i++)
+ if (((Widget)buttons[i]) == w)
+ sel = i;
+ item->SetSel(sel);
+
+ if (item->InSetValue())
+ return;
+
+ wxCommandEvent event (wxEVT_COMMAND_RADIOBOX_SELECTED, item->GetId());
+ event.SetInt(sel);
+ event.SetString(item->GetStringSelection());
+ event.SetEventObject(item);
+ item->ProcessCommand (event);
+}