+ m_widget = GTKCreateFrame(title);
+ wxControl::SetLabel(title);
+ if ( HasFlag(wxNO_BORDER) )
+ {
+ // If we don't do this here, the wxNO_BORDER style is ignored in Show()
+ gtk_frame_set_shadow_type(GTK_FRAME(m_widget), GTK_SHADOW_NONE);
+ }
+
+
+ // majorDim may be 0 if all trailing parameters were omitted, so don't
+ // assert here but just use the correct value for it
+ SetMajorDim(majorDim == 0 ? n : majorDim, style);
+
+
+ unsigned int num_of_cols = GetColumnCount();
+ unsigned int num_of_rows = GetRowCount();
+
+ GtkRadioButton *rbtn = (GtkRadioButton*) NULL;
+
+ GtkWidget *table = gtk_table_new( num_of_rows, num_of_cols, FALSE );
+ gtk_table_set_col_spacings( GTK_TABLE(table), 1 );
+ gtk_table_set_row_spacings( GTK_TABLE(table), 1 );
+ gtk_widget_show( table );
+ gtk_container_add( GTK_CONTAINER(m_widget), table );
+
+ wxString label;
+ GSList *radio_button_group = (GSList *) NULL;
+ for (unsigned int i = 0; i < (unsigned int)n; i++)
+ {
+ if ( i != 0 )
+ radio_button_group = gtk_radio_button_get_group( GTK_RADIO_BUTTON(rbtn) );
+
+ label.Empty();
+ for ( wxString::const_iterator pc = choices[i].begin();
+ pc != choices[i].end(); ++pc )
+ {
+ if ( *pc != wxT('&') )
+ label += *pc;
+ }
+
+ rbtn = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, wxGTK_CONV( label ) ) );
+ gtk_widget_show( GTK_WIDGET(rbtn) );
+
+ g_signal_connect (rbtn, "key_press_event",
+ G_CALLBACK (gtk_radiobox_keypress_callback), this);
+
+ m_buttonsInfo.Append( new wxGTKRadioButtonInfo( rbtn, wxRect() ) );
+
+ if (HasFlag(wxRA_SPECIFY_COLS))
+ {
+ int left = i%num_of_cols;
+ int right = (i%num_of_cols) + 1;
+ int top = i/num_of_cols;
+ int bottom = (i/num_of_cols)+1;
+ gtk_table_attach( GTK_TABLE(table), GTK_WIDGET(rbtn), left, right, top, bottom,
+ GTK_FILL, GTK_FILL, 1, 1 );
+ }
+ else
+ {
+ int left = i/num_of_rows;
+ int right = (i/num_of_rows) + 1;
+ int top = i%num_of_rows;
+ int bottom = (i%num_of_rows)+1;
+ gtk_table_attach( GTK_TABLE(table), GTK_WIDGET(rbtn), left, right, top, bottom,
+ GTK_FILL, GTK_FILL, 1, 1 );
+ }
+
+ ConnectWidget( GTK_WIDGET(rbtn) );
+
+ if (!i)
+ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(rbtn), TRUE );
+
+ g_signal_connect (rbtn, "clicked",
+ G_CALLBACK (gtk_radiobutton_clicked_callback), this);
+ g_signal_connect (rbtn, "focus_in_event",
+ G_CALLBACK (gtk_radiobutton_focus_in), this);
+ g_signal_connect (rbtn, "focus_out_event",
+ G_CALLBACK (gtk_radiobutton_focus_out), this);
+ g_signal_connect (rbtn, "size_allocate",
+ G_CALLBACK (gtk_radiobutton_size_allocate), this);
+ }
+
+ m_parent->DoAddChild( this );
+
+ PostCreation(size);
+
+ return true;
+}
+
+wxRadioBox::~wxRadioBox()
+{
+ wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
+ while (node)
+ {
+ GtkWidget *button = GTK_WIDGET( node->GetData()->button );
+ gtk_widget_destroy( button );
+ node = node->GetNext();
+ }
+ WX_CLEAR_LIST( wxRadioBoxButtonsInfoList, m_buttonsInfo );