]> git.saurik.com Git - wxWidgets.git/commitdiff
update the disabled buttons appearance when system colours change (followup to patch...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 3 Oct 2004 13:46:11 +0000 (13:46 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 3 Oct 2004 13:46:11 +0000 (13:46 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29620 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/bmpbuttn.h
src/msw/bmpbuttn.cpp

index fc92a3136339b2455e855086af992ba3794069e9..c7e2113a74afc9db9e9003477beac3e387ce96ff 100644 (file)
@@ -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)
 };
 
index 8a7ff239e0646a16a75a33c9b74551cbb6b5504e..d40d422eda00b0982cedd213a304a16e114b101a 100644 (file)
@@ -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