X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ef0e92205a01c7d0ca6f381cc690cb5d4fa595c9..aa3fcb2f830f50218a6003710b959eb33d3b7088:/include/wx/brush.h?ds=inline diff --git a/include/wx/brush.h b/include/wx/brush.h index fa0103cf4d..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__) @@ -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_