diff --git a/include/wx/colour.h b/include/wx/colour.h index eac59a6bd7..e421e19613 100644 --- a/include/wx/colour.h +++ b/include/wx/colour.h @@ -167,6 +167,7 @@ public: static void ChangeLightness(unsigned char* r, unsigned char* g, unsigned char* b, int ialpha); wxColour ChangeLightness(int ialpha) const; + wxColour& MakeDisabled(unsigned char brightness = 255); // old, deprecated // --------------- diff --git a/interface/wx/colour.h b/interface/wx/colour.h index bf051c3ff1..886b65adc6 100644 --- a/interface/wx/colour.h +++ b/interface/wx/colour.h @@ -235,7 +235,16 @@ public: @since 2.9.0 */ static void MakeDisabled(unsigned char* r, unsigned char* g, unsigned char* b, unsigned char brightness = 255); - + + /** + Make a disabled version of this colour. + + This method modifies the object in place and returns the object itself. + + @since 2.9.5 + */ + wxColour& MakeDisabled(unsigned char brightness = 255); + /** Create a grey colour from (in/out) rgb parameters using integer arithmetic. @since 2.9.0 diff --git a/src/common/colourcmn.cpp b/src/common/colourcmn.cpp index 013b17cee3..70e4a1d9ca 100644 --- a/src/common/colourcmn.cpp +++ b/src/common/colourcmn.cpp @@ -273,6 +273,16 @@ void wxColourBase::MakeDisabled(unsigned char* r, unsigned char* g, unsigned cha *b = AlphaBlend(*b, brightness, 0.4); } +wxColour& wxColourBase::MakeDisabled(unsigned char brightness) +{ + unsigned char r = Red(), + g = Green(), + b = Blue(); + MakeDisabled(&r, &g, &b, brightness); + Set(r, g, b, Alpha()); + return static_cast(*this); +} + // AlphaBlend is used by ChangeLightness and MakeDisabled // static