X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bc735a68b18cddb825197dca55eb51ca8c72928d..aa3fcb2f830f50218a6003710b959eb33d3b7088:/include/wx/brush.h diff --git a/include/wx/brush.h b/include/wx/brush.h index 7ad451927c..89ae912fa1 100644 --- a/include/wx/brush.h +++ b/include/wx/brush.h @@ -55,6 +55,19 @@ public: virtual bool IsHatch() const { return (GetStyle()>=wxBRUSHSTYLE_FIRST_HATCH) && (GetStyle()<=wxBRUSHSTYLE_LAST_HATCH); } + + // 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__) @@ -106,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) @@ -116,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_