X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c71ab7c15cbfa018a549691a4ec407334a2c0132..54f11060867c4c97ebbe7954353f5c311262fc4b:/src/gtk/tglbtn.cpp diff --git a/src/gtk/tglbtn.cpp b/src/gtk/tglbtn.cpp index 450e37bec7..97306a9a04 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 @@ -278,11 +285,18 @@ void wxToggleButton::SetLabel(const wxString& label) 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; }