X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8a16d7370e3cdc7d583a6f14ab11b3a1d27b73df..533bedbf307fd324ebc864ad1b5292977c4fa7bc:/include/wx/region.h?ds=sidebyside diff --git a/include/wx/region.h b/include/wx/region.h index e5549cf254..1d038a6cbf 100644 --- a/include/wx/region.h +++ b/include/wx/region.h @@ -12,10 +12,10 @@ #ifndef _WX_REGION_H_BASE_ #define _WX_REGION_H_BASE_ -#include "wx/bitmap.h" #include "wx/gdiobj.h" #include "wx/gdicmn.h" +class WXDLLIMPEXP_CORE wxBitmap; class WXDLLEXPORT wxColour; class WXDLLEXPORT wxRegion; @@ -82,7 +82,8 @@ public: // accessors // --------- - bool Ok() const { return m_refData != NULL; } + bool Ok() const { return IsOk(); } + bool IsOk() const { return m_refData != NULL; } // Is region empty? virtual bool IsEmpty() const = 0; @@ -141,23 +142,20 @@ public: #endif // wxUSE_IMAGE // Intersect rectangle or region with this one. - bool Intersect(wxCoord x, wxCoord y, wxCoord w, wxCoord h) - { return Intersect(wxRect(x, y, w, h)); } + bool Intersect(wxCoord x, wxCoord y, wxCoord w, wxCoord h); bool Intersect(const wxRect& rect); bool Intersect(const wxRegion& region) { return DoIntersect(region); } // Subtract rectangle or region from this: // Combines the parts of 'this' that are not part of the second region. - bool Subtract(wxCoord x, wxCoord y, wxCoord w, wxCoord h) - { return Subtract(wxRect(x, y, w, h)); } + bool Subtract(wxCoord x, wxCoord y, wxCoord w, wxCoord h); bool Subtract(const wxRect& rect); bool Subtract(const wxRegion& region) { return DoSubtract(region); } // XOR: the union of two combined regions except for any overlapping areas. - bool Xor(wxCoord x, wxCoord y, wxCoord w, wxCoord h) - { return Xor(wxRect(x, y, w, h)); } + bool Xor(wxCoord x, wxCoord y, wxCoord w, wxCoord h); bool Xor(const wxRect& rect); bool Xor(const wxRegion& region) { return DoXor(region); } @@ -193,7 +191,7 @@ protected: #define wxHAS_REGION_COMBINE -class wxRegionWithCombine : public wxRegionBase +class WXDLLEXPORT wxRegionWithCombine : public wxRegionBase { public: // these methods are not part of public API as they're not implemented on @@ -209,17 +207,11 @@ protected: virtual bool DoCombine(const wxRegion& region, wxRegionOp op) = 0; // implement some wxRegionBase pure virtuals in terms of Combine() - virtual bool DoUnionWithRect(const wxRect& rect) - { return Combine(rect, wxRGN_OR); } - virtual bool DoUnionWithRegion(const wxRegion& region) - { return Combine(region, wxRGN_OR); } - - virtual bool DoIntersect(const wxRegion& region) - { return Combine(region, wxRGN_AND); } - virtual bool DoSubtract(const wxRegion& region) - { return Combine(region, wxRGN_DIFF); } - virtual bool DoXor(const wxRegion& region) - { return Combine(region, wxRGN_XOR); } + virtual bool DoUnionWithRect(const wxRect& rect); + virtual bool DoUnionWithRegion(const wxRegion& region); + virtual bool DoIntersect(const wxRegion& region); + virtual bool DoSubtract(const wxRegion& region); + virtual bool DoXor(const wxRegion& region); }; #endif // ports with wxRegion::Combine() @@ -269,6 +261,24 @@ inline bool wxRegionBase::Xor(const wxRect& rect) return DoXor(wxRegion(rect)); } +// ...and these functions are here because they call the ones above, and its +// not really proper to call an inline function before its defined inline. + +inline bool wxRegionBase::Intersect(wxCoord x, wxCoord y, wxCoord w, wxCoord h) +{ + return Intersect(wxRect(x, y, w, h)); +} + +inline bool wxRegionBase::Subtract(wxCoord x, wxCoord y, wxCoord w, wxCoord h) +{ + return Subtract(wxRect(x, y, w, h)); +} + +inline bool wxRegionBase::Xor(wxCoord x, wxCoord y, wxCoord w, wxCoord h) +{ + return Xor(wxRect(x, y, w, h)); +} + #ifdef wxHAS_REGION_COMBINE inline bool wxRegionWithCombine::Combine(wxCoord x,