X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5c33522fca7cddc441a316f5b9fb50d7685435ba..f2b099261f9e46d65f1fbcfd2a35aa816d5a2818:/include/wx/brush.h diff --git a/include/wx/brush.h b/include/wx/brush.h index 9eb0a4c7e1..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,6 +119,11 @@ 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 static_cast(s) == static_cast(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_