X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/231b9591aac1d6a507aa1ecfeb5f57e720003391..7bd30a12ade503fd135c686ecc98a6f6d5fecbeb:/include/wx/brush.h diff --git a/include/wx/brush.h b/include/wx/brush.h index acddcd314c..89ae912fa1 100644 --- a/include/wx/brush.h +++ b/include/wx/brush.h @@ -56,10 +56,18 @@ public: virtual bool IsHatch() const { return (GetStyle()>=wxBRUSHSTYLE_FIRST_HATCH) && (GetStyle()<=wxBRUSHSTYLE_LAST_HATCH); } -#if FUTURE_WXWIN_COMPATIBILITY_3_0 - wxDEPRECATED_FUTURE( void SetStyle(int style) ) - { SetStyle((wxBrushStyle)style); } -#endif + // Convenient helpers for testing whether the brush is a transparent one: + // unlike GetStyle() == wxBRUSHSTYLE_TRANSPARENT, they work correctly even + // if the brush is invalid (they both return false in this case). + bool IsTransparent() const + { + return IsOk() && GetStyle() == wxBRUSHSTYLE_TRANSPARENT; + } + + bool IsNonTransparent() const + { + return IsOk() && GetStyle() != wxBRUSHSTYLE_TRANSPARENT; + } }; #if defined(__WXPALMOS__) @@ -77,7 +85,7 @@ public: #elif defined(__WXDFB__) #include "wx/dfb/brush.h" #elif defined(__WXMAC__) - #include "wx/mac/brush.h" + #include "wx/osx/brush.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/brush.h" #elif defined(__WXPM__) @@ -111,9 +119,14 @@ extern WXDLLIMPEXP_DATA_CORE(wxBrushList*) wxTheBrushList; // compilers as it compares elements of different enums #if FUTURE_WXWIN_COMPATIBILITY_3_0 +// Unfortunately some compilers have ambiguity issues when enum comparisons are +// overloaded so we have to disable the overloads in this case, see +// wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details. +#ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM + inline bool operator==(wxBrushStyle s, wxDeprecatedGUIConstants t) { - return wx_static_cast(int, s) == wx_static_cast(int, t); + return static_cast(s) == static_cast(t); } inline bool operator!=(wxBrushStyle s, wxDeprecatedGUIConstants t) @@ -121,6 +134,8 @@ inline bool operator!=(wxBrushStyle s, wxDeprecatedGUIConstants t) return !(s == t); } +#endif // wxCOMPILER_NO_OVERLOAD_ON_ENUM + #endif // FUTURE_WXWIN_COMPATIBILITY_3_0 #endif // _WX_BRUSH_H_BASE_