+void wxRadioButton::ChangeBackgroundColour()
+{
+ wxWindow::ChangeBackgroundColour();
+
+ // What colour should this be?
+ int selectPixel = wxBLACK->AllocColour(XtDisplay((Widget)m_mainWidget));
+
+ XtVaSetValues ((Widget) GetMainWidget(),
+ XmNselectColor, selectPixel,
+ NULL);
+}
+
+void wxRadioButtonCallback (Widget WXUNUSED(w), XtPointer clientData,
+ XmToggleButtonCallbackStruct * cbs)
+{
+ if (!cbs->set)
+ return;
+
+ wxRadioButton *item = (wxRadioButton *) clientData;
+ if (item->InSetValue())
+ return;
+
+ //based on mac/radiobut.cpp
+ wxRadioButton* old = item->ClearSelections();
+ item->SetValue(true);
+
+ if ( old )
+ {
+ wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED,
+ old->GetId() );
+ event.SetEventObject(old);
+ event.SetInt( false );
+ old->ProcessCommand(event);
+ }
+ wxCommandEvent event2(wxEVT_COMMAND_RADIOBUTTON_SELECTED, item->GetId() );
+ event2.SetEventObject(item);
+ event2.SetInt( true );
+ item->ProcessCommand(event2);
+}
+
+wxRadioButton* wxRadioButton::AddInCycle(wxRadioButton *cycle)
+{
+ if (cycle == NULL)
+ {
+ m_cycle = this;
+ }
+ else
+ {
+ wxRadioButton* current = cycle;
+ while ( current->m_cycle != cycle )
+ current = current->m_cycle;
+ m_cycle = cycle;
+ current->m_cycle = this;
+ }
+
+ return cycle;
+}
+
+wxRadioButton* wxRadioButton::ClearSelections()
+{
+ wxRadioButton* cycle = NextInCycle();
+ wxRadioButton* old = 0;
+
+ if (cycle)
+ {
+ while (cycle != this)
+ {
+ if ( cycle->GetValue() )
+ {
+ old = cycle;
+ cycle->SetValue(false);
+ }
+ cycle = cycle->NextInCycle();
+ }
+ }