X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8a16d7370e3cdc7d583a6f14ab11b3a1d27b73df..f6669958924c3c3833e2932b65598b06073d2e65:/include/wx/region.h diff --git a/include/wx/region.h b/include/wx/region.h index e5549cf254..c81d1cddaf 100644 --- a/include/wx/region.h +++ b/include/wx/region.h @@ -12,12 +12,12 @@ #ifndef _WX_REGION_H_BASE_ #define _WX_REGION_H_BASE_ -#include "wx/bitmap.h" #include "wx/gdiobj.h" #include "wx/gdicmn.h" -class WXDLLEXPORT wxColour; -class WXDLLEXPORT wxRegion; +class WXDLLIMPEXP_FWD_CORE wxBitmap; +class WXDLLIMPEXP_FWD_CORE wxColour; +class WXDLLIMPEXP_FWD_CORE wxRegion; // ---------------------------------------------------------------------------- // constants @@ -55,7 +55,7 @@ enum wxRegionOp // wxRegionBase defines wxRegion API // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxRegionBase : public wxGDIObject +class WXDLLIMPEXP_CORE wxRegionBase : public wxGDIObject { public: // ctors @@ -67,7 +67,7 @@ public: wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h); wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); wxRegion(const wxRect& rect); - wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE); + wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE); wxRegion(const wxBitmap& bmp); wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0); #endif // 0 @@ -82,8 +82,6 @@ public: // accessors // --------- - bool Ok() const { return m_refData != NULL; } - // Is region empty? virtual bool IsEmpty() const = 0; bool Empty() const { return IsEmpty(); } @@ -141,23 +139,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); } @@ -186,14 +181,13 @@ protected: // some ports implement a generic Combine() function while others only // implement individual wxRegion operations, factor out the common code for the // ports with Combine() in this class -#if defined(__WXPALMOS__) || \ - defined(__WXMSW__) || \ - defined(__WXMAC__) || \ +#if defined(__WXMSW__) || \ + ( defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON ) || \ defined(__WXPM__) #define wxHAS_REGION_COMBINE -class wxRegionWithCombine : public wxRegionBase +class WXDLLIMPEXP_CORE wxRegionWithCombine : public wxRegionBase { public: // these methods are not part of public API as they're not implemented on @@ -209,24 +203,16 @@ 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() -#if defined(__WXPALMOS__) - #include "wx/palmos/region.h" -#elif defined(__WXMSW__) +#if defined(__WXMSW__) #include "wx/msw/region.h" #elif defined(__WXGTK20__) #include "wx/gtk/region.h" @@ -234,12 +220,10 @@ protected: #include "wx/gtk1/region.h" #elif defined(__WXMOTIF__) || defined(__WXX11__) #include "wx/x11/region.h" -#elif defined(__WXMGL__) - #include "wx/mgl/region.h" #elif defined(__WXDFB__) #include "wx/dfb/region.h" #elif defined(__WXMAC__) - #include "wx/mac/region.h" + #include "wx/osx/region.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/region.h" #elif defined(__WXPM__) @@ -269,6 +253,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,