- if (!rb->HasVMT()) return;
- if (g_blockEventsOnDrag) return;
-
- wxCommandEvent event( wxEVT_COMMAND_RADIOBUTTON_SELECTED, rb->GetId());
- event.SetInt( rb->GetValue() );
- event.SetEventObject( rb );
- rb->GetEventHandler()->ProcessEvent( event );
+ m_acceptsFocus = TRUE;
+ m_needParent = TRUE;
+
+ m_blockEvent = FALSE;
+
+ if (!PreCreation( parent, pos, size ) ||
+ !CreateBase( parent, id, pos, size, style, validator, name ))
+ {
+ wxFAIL_MSG( wxT("wxRadioButton creation failed") );
+ return FALSE;
+ }
+
+ GSList* radioButtonGroup = NULL;
+ if (!HasFlag(wxRB_GROUP))
+ {
+ // search backward for last group start
+ wxRadioButton *chief = NULL;
+ wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast();
+ while (node)
+ {
+ wxWindow *child = node->GetData();
+ if (child->IsRadioButton())
+ {
+ chief = (wxRadioButton*) child;
+ if (child->HasFlag(wxRB_GROUP))
+ break;
+ }
+ node = node->GetPrevious();
+ }
+ if (chief)
+ {
+ // we are part of the group started by chief
+ radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) );
+ }
+ }
+
+ m_widget = gtk_radio_button_new_with_label( radioButtonGroup, wxGTK_CONV( label ) );
+
+ SetLabel(label);
+
+ gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
+ GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
+
+ m_parent->DoAddChild( this );
+
+ PostCreation(size);
+
+ return TRUE;