]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/radiobut.cpp
Disable some wxWebView tests that fail on the buildbot but not locally.
[wxWidgets.git] / src / gtk / radiobut.cpp
index 649a520830c38758c5cbe62e89db960369cb2aff..a8c0a8b8a6f7d1a79c5e4a2bd21f3d30aa2fa302 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        radiobut.cpp
+// Name:        src/gtk/radiobut.cpp
 // Purpose:
 // Author:      Robert Roebling
 // Id:          $Id$
@@ -34,7 +34,7 @@ void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioButton *r
 
     if (g_blockEventsOnDrag) return;
 
-    if (!button->active) return;
+    if (!gtk_toggle_button_get_active(button)) return;
 
     wxCommandEvent event( wxEVT_COMMAND_RADIOBUTTON_SELECTED, rb->GetId());
     event.SetInt( rb->GetValue() );
@@ -47,8 +47,6 @@ void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioButton *r
 // wxRadioButton
 //-----------------------------------------------------------------------------
 
-IMPLEMENT_DYNAMIC_CLASS(wxRadioButton,wxControl)
-
 bool wxRadioButton::Create( wxWindow *parent,
                             wxWindowID id,
                             const wxString& label,
@@ -66,7 +64,7 @@ bool wxRadioButton::Create( wxWindow *parent,
     }
 
     GSList* radioButtonGroup = NULL;
-    if (!HasFlag(wxRB_GROUP))
+    if (!HasFlag(wxRB_GROUP) && !HasFlag(wxRB_SINGLE))
     {
         // search backward for last group start
         wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast();
@@ -83,11 +81,12 @@ bool wxRadioButton::Create( wxWindow *parent,
     }
 
     m_widget = gtk_radio_button_new_with_label( radioButtonGroup, wxGTK_CONV( label ) );
+    g_object_ref(m_widget);
 
     SetLabel(label);
 
-    g_signal_connect (m_widget, "clicked",
-                      G_CALLBACK (gtk_radiobutton_clicked_callback), this);
+    g_signal_connect_after (m_widget, "clicked",
+                            G_CALLBACK (gtk_radiobutton_clicked_callback), this);
 
     m_parent->DoAddChild( this );
 
@@ -100,7 +99,10 @@ void wxRadioButton::SetLabel( const wxString& label )
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid radiobutton") );
 
-    GTKSetLabelForLabel(GTK_LABEL(GTK_BIN(m_widget)->child), label);
+    // save the original label
+    wxControlBase::SetLabel(label);
+
+    GTKSetLabelForLabel(GTK_LABEL(gtk_bin_get_child(GTK_BIN(m_widget))), label);
 }
 
 void wxRadioButton::SetValue( bool val )
@@ -132,15 +134,18 @@ bool wxRadioButton::GetValue() const
 {
     wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobutton") );
 
-    return GTK_TOGGLE_BUTTON(m_widget)->active;
+    return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_widget)) != 0;
 }
 
 bool wxRadioButton::Enable( bool enable )
 {
-    if ( !wxControl::Enable( enable ) )
+    if (!base_type::Enable(enable))
         return false;
 
-    gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
+    gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(m_widget)), enable);
+
+    if (enable)
+        GTKFixSensitivity();
 
     return true;
 }
@@ -148,7 +153,7 @@ bool wxRadioButton::Enable( bool enable )
 void wxRadioButton::DoApplyWidgetStyle(GtkRcStyle *style)
 {
     gtk_widget_modify_style(m_widget, style);
-    gtk_widget_modify_style(GTK_BIN(m_widget)->child, style);
+    gtk_widget_modify_style(gtk_bin_get_child(GTK_BIN(m_widget)), style);
 }
 
 GdkWindow *