+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/region.h
+// Purpose: Base header for wxRegion
+// Author: Julian Smart
+// Modified by:
+// Created:
+// RCS-ID: $Id$
+// Copyright: (c) Julian Smart
+// Licence: wxWindows Licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_REGION_H_BASE_
+#define _WX_REGION_H_BASE_
+
+#include "wx/gdiobj.h"
+#include "wx/gdicmn.h"
+
+class WXDLLIMPEXP_FWD_CORE wxBitmap;
+class WXDLLIMPEXP_FWD_CORE wxColour;
+class WXDLLIMPEXP_FWD_CORE wxRegion;
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// result of wxRegion::Contains() call
+enum wxRegionContain
+{
+ wxOutRegion = 0,
+ wxPartRegion = 1,
+ wxInRegion = 2
+};
+
+// these constants are used with wxRegion::Combine() in the ports which have
+// this method
+enum wxRegionOp
+{
+ // Creates the intersection of the two combined regions.
+ wxRGN_AND,
+
+ // Creates a copy of the region
+ wxRGN_COPY,
+
+ // Combines the parts of first region that are not in the second one
+ wxRGN_DIFF,
+
+ // Creates the union of two combined regions.
+ wxRGN_OR,
+
+ // Creates the union of two regions except for any overlapping areas.
+ wxRGN_XOR
+};
+
+// ----------------------------------------------------------------------------
+// wxRegionBase defines wxRegion API
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxRegionBase : public wxGDIObject
+{
+public:
+ // ctors
+ // -----
+
+ // none are defined here but the following should be available:
+#if 0
+ wxRegion();
+ 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, wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
+ wxRegion(const wxBitmap& bmp);
+ wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0);
+#endif // 0
+
+ // operators
+ // ---------
+
+ bool operator==(const wxRegion& region) const { return IsEqual(region); }
+ bool operator!=(const wxRegion& region) const { return !(*this == region); }
+
+
+ // accessors
+ // ---------
+
+ // Is region empty?
+ virtual bool IsEmpty() const = 0;
+ bool Empty() const { return IsEmpty(); }
+
+ // Is region equal (i.e. covers the same area as another one)?
+ bool IsEqual(const wxRegion& region) const;
+
+ // Get the bounding box
+ bool GetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const
+ { return DoGetBox(x, y, w, h); }
+ wxRect GetBox() const
+ {
+ wxCoord x, y, w, h;
+ return DoGetBox(x, y, w, h) ? wxRect(x, y, w, h) : wxRect();
+ }
+
+ // Test if the given point or rectangle is inside this region
+ wxRegionContain Contains(wxCoord x, wxCoord y) const
+ { return DoContainsPoint(x, y); }
+ wxRegionContain Contains(const wxPoint& pt) const
+ { return DoContainsPoint(pt.x, pt.y); }
+ wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const
+ { return DoContainsRect(wxRect(x, y, w, h)); }
+ wxRegionContain Contains(const wxRect& rect) const
+ { return DoContainsRect(rect); }
+
+
+ // operations
+ // ----------
+
+ virtual void Clear() = 0;
+
+ // Move the region
+ bool Offset(wxCoord x, wxCoord y)
+ { return DoOffset(x, y); }
+ bool Offset(const wxPoint& pt)
+ { return DoOffset(pt.x, pt.y); }
+
+ // Union rectangle or region with this region.
+ bool Union(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
+ { return DoUnionWithRect(wxRect(x, y, w, h)); }
+ bool Union(const wxRect& rect)
+ { return DoUnionWithRect(rect); }
+ bool Union(const wxRegion& region)
+ { return DoUnionWithRegion(region); }
+
+#if wxUSE_IMAGE
+ // Use the non-transparent pixels of a wxBitmap for the region to combine
+ // with this region. First version takes transparency from bitmap's mask,
+ // second lets the user specify the colour to be treated as transparent
+ // along with an optional tolerance value.
+ // NOTE: implemented in common/rgncmn.cpp
+ bool Union(const wxBitmap& bmp);
+ bool Union(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0);
+#endif // wxUSE_IMAGE
+
+ // Intersect rectangle or region with this one.
+ bool Intersect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
+ bool Intersect(const wxRect& rect);
+ bool Intersect(const wxRegion& region)
+ { return DoIntersect(region); }