X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5366ff46b8631f4f353606a425cebbb2b7ebbf0b..4776c0b783a9776f94b049aecdc253d379686b6b:/src/gtk/button.cpp?ds=sidebyside diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index 807facea1c..88e29ac4f3 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -266,17 +266,13 @@ void wxButton::SetLabel( const wxString &lbl ) bool wxButton::Enable( bool enable ) { - bool isEnabled = IsEnabled(); - - if ( !wxControl::Enable( enable ) ) + if (!base_type::Enable(enable)) return false; gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable); - if (!isEnabled && enable) - { + if (enable) GTKFixSensitivity(); - } GTKUpdateBitmap(); @@ -409,9 +405,15 @@ wxButton::State wxButton::GTKGetCurrentState() const void wxButton::GTKUpdateBitmap() { - State state = GTKGetCurrentState(); + // if we don't show bitmaps at all, there is nothing to update + if ( m_bitmaps[State_Normal].IsOk() ) + { + // if we do show them, this will return a state for which we do have a + // valid bitmap + State state = GTKGetCurrentState(); - GTKDoShowBitmap(m_bitmaps[state]); + GTKDoShowBitmap(m_bitmaps[state]); + } } void wxButton::GTKDoShowBitmap(const wxBitmap& bitmap) @@ -662,6 +664,7 @@ void wxButton::DoSetBitmapPosition(wxDirection dir) } gtk_button_set_image_position(GTK_BUTTON(m_widget), gtkpos); + InvalidateBestSize(); } #endif // GTK+ 2.10+ }