Remove all lines containing cvs/svn "$Id$" keyword.
[wxWidgets.git] / include / wx / osx / carbon / region.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/carbon/region.h
3 // Purpose: wxRegion class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_MAC_CARBON_REGION_H_
12 #define _WX_MAC_CARBON_REGION_H_
13
14 #include "wx/list.h"
15
16 class WXDLLIMPEXP_CORE wxRegion : public wxRegionWithCombine
17 {
18 public:
19 wxRegion() { }
20 wxRegion(long x, long y, long w, long h);
21 wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
22 wxRegion(const wxRect& rect);
23 wxRegion( WXHRGN hRegion );
24 wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
25 #if wxUSE_IMAGE
26 wxRegion(const wxBitmap& bmp)
27 {
28 Union(bmp);
29 }
30 wxRegion(const wxBitmap& bmp,
31 const wxColour& transColour, int tolerance = 0)
32 {
33 Union(bmp, transColour, tolerance);
34 }
35 #endif
36
37 virtual ~wxRegion();
38
39 // wxRegionBase methods
40 virtual void Clear();
41 virtual bool IsEmpty() const;
42
43 // Internal
44 WXHRGN GetWXHRGN() const ;
45
46 protected:
47 virtual wxGDIRefData *CreateGDIRefData() const;
48 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
49
50 virtual bool DoIsEqual(const wxRegion& region) const;
51 virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
52 virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
53 virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
54
55 virtual bool DoOffset(wxCoord x, wxCoord y);
56 virtual bool DoCombine(const wxRegion& region, wxRegionOp op);
57 virtual bool DoUnionWithRect(const wxRect& rect);
58
59 private:
60 DECLARE_DYNAMIC_CLASS(wxRegion)
61 friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator;
62 };
63
64 class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject
65 {
66 public:
67 wxRegionIterator();
68 wxRegionIterator(const wxRegion& region);
69 wxRegionIterator(const wxRegionIterator& iterator);
70 virtual ~wxRegionIterator();
71
72 wxRegionIterator& operator=(const wxRegionIterator& iterator);
73
74 void Reset() { m_current = 0; }
75 void Reset(const wxRegion& region);
76
77 operator bool () const { return m_current < m_numRects; }
78 bool HaveRects() const { return m_current < m_numRects; }
79
80 wxRegionIterator& operator++();
81 wxRegionIterator operator++(int);
82
83 long GetX() const;
84 long GetY() const;
85 long GetW() const;
86 long GetWidth() const { return GetW(); }
87 long GetH() const;
88 long GetHeight() const { return GetH(); }
89 wxRect GetRect() const { return wxRect((int)GetX(), (int)GetY(), (int)GetWidth(), (int)GetHeight()); }
90
91 private:
92 void SetRects(long numRects, wxRect *rects);
93
94 long m_current;
95 long m_numRects;
96 wxRegion m_region;
97 wxRect* m_rects;
98
99 DECLARE_DYNAMIC_CLASS(wxRegionIterator)
100 };
101
102 #endif // _WX_MAC_CARBON_REGION_H_