X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c71ab7c15cbfa018a549691a4ec407334a2c0132..059d234d4176165d975048eaa5436ef40af7d037:/src/gtk/tglbtn.cpp diff --git a/src/gtk/tglbtn.cpp b/src/gtk/tglbtn.cpp index 450e37bec7..503382712c 100644 --- a/src/gtk/tglbtn.cpp +++ b/src/gtk/tglbtn.cpp @@ -39,7 +39,7 @@ static void gtk_togglebutton_clicked_callback(GtkWidget *WXUNUSED(widget), wxTog } } -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED) +wxDEFINE_EVENT( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEvent ); // ------------------------------------------------------------------------ // wxBitmapToggleButton @@ -146,11 +146,18 @@ void wxBitmapToggleButton::OnSetBitmap() bool wxBitmapToggleButton::Enable(bool enable /*=true*/) { + bool isEnabled = IsEnabled(); + if (!wxControl::Enable(enable)) return false; gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable); + if (!isEnabled && enable) + { + GTKFixSensitivity(); + } + return true; } @@ -247,11 +254,11 @@ void wxToggleButton::SetValue(bool state) if (state == GetValue()) return; - GTKEnableEvents(); + GTKDisableEvents(); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), state); - GTKDisableEvents(); + GTKEnableEvents(); } // bool GetValue() const @@ -273,16 +280,23 @@ void wxToggleButton::SetLabel(const wxString& label) gtk_button_set_label(GTK_BUTTON(m_widget), wxGTK_CONV(labelGTK)); - ApplyWidgetStyle( false ); + GTKApplyWidgetStyle( false ); } bool wxToggleButton::Enable(bool enable /*=true*/) { + bool isEnabled = IsEnabled(); + if (!wxControl::Enable(enable)) return false; gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable); + if (!isEnabled && enable) + { + GTKFixSensitivity(); + } + return true; }