diff --git a/include/wx/msw/bmpbuttn.h b/include/wx/msw/bmpbuttn.h index fc92a31363..c7e2113a74 100644 --- a/include/wx/msw/bmpbuttn.h +++ b/include/wx/msw/bmpbuttn.h @@ -59,8 +59,15 @@ public: protected: virtual wxSize DoGetBestSize() const; + // invalidate m_brushDisabled when system colours change + void OnSysColourChanged(wxSysColourChangedEvent& event); + + + // the brush we use to draw disabled buttons wxBrush m_brushDisabled; + + DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapButton) }; diff --git a/src/msw/bmpbuttn.cpp b/src/msw/bmpbuttn.cpp index 8a7ff239e0..d40d422eda 100644 --- a/src/msw/bmpbuttn.cpp +++ b/src/msw/bmpbuttn.cpp @@ -89,6 +89,10 @@ wxCONSTRUCTOR_5( wxBitmapButton , wxWindow* , Parent , wxWindowID , Id , wxBitma IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton) #endif +BEGIN_EVENT_TABLE(wxBitmapButton, wxBitmapButtonBase) + EVT_SYS_COLOUR_CHANGED(wxBitmapButton::OnSysColourChanged) +END_EVENT_TABLE() + /* TODO PROPERTIES : @@ -183,6 +187,19 @@ bool wxBitmapButton::SetBackgroundColour(const wxColour& colour) return true; } +void wxBitmapButton::OnSysColourChanged(wxSysColourChangedEvent& event) +{ + m_brushDisabled = wxNullBrush; + + if ( !IsEnabled() ) + { + // this change affects our current state + Refresh(); + } + + event.Skip(); +} + // VZ: should be at the very least less than wxDEFAULT_BUTTON_MARGIN #define FOCUS_MARGIN 3