From d0ed90075c312a58773c83e8a61e01c7da9142ad Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Tue, 2 Jun 2020 12:16:57 -0700 Subject: [PATCH] Fix wxToggleButton image when state is changed programmatically See #18779 --- include/wx/gtk/anybutton.h | 6 +++--- src/gtk/tglbtn.cpp | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/wx/gtk/anybutton.h b/include/wx/gtk/anybutton.h index 0b149ec085..a49759d2e0 100644 --- a/include/wx/gtk/anybutton.h +++ b/include/wx/gtk/anybutton.h @@ -45,15 +45,15 @@ protected: virtual void DoSetBitmap(const wxBitmap& bitmap, State which) wxOVERRIDE; virtual void DoSetBitmapPosition(wxDirection dir) wxOVERRIDE; + // update the bitmap to correspond to the current button state + void GTKUpdateBitmap(); + private: typedef wxAnyButtonBase base_type; // focus event handler: calls GTKUpdateBitmap() void GTKOnFocus(wxFocusEvent& event); - // update the bitmap to correspond to the current button state - void GTKUpdateBitmap(); - // return the state whose bitmap is being currently shown (so this is // different from the real current state, e.g. it could be State_Normal // even if the button is pressed if no button was set for State_Pressed) diff --git a/src/gtk/tglbtn.cpp b/src/gtk/tglbtn.cpp index bb27f5c234..f386dfc9a6 100644 --- a/src/gtk/tglbtn.cpp +++ b/src/gtk/tglbtn.cpp @@ -148,6 +148,7 @@ void wxToggleButton::SetValue(bool state) wxGtkEventsDisabler noEvents(this); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_widget), state); + GTKUpdateBitmap(); } // bool GetValue() const