]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/carbon/region.h
Use /bin/echo for creation of Mac OS X PkgInfo files.
[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 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MAC_CARBON_REGION_H_
13 #define _WX_MAC_CARBON_REGION_H_
14
15 #include "wx/list.h"
16
17 class WXDLLIMPEXP_CORE wxRegion : public wxRegionWithCombine
18 {
19 public:
20 wxRegion() { }
21 wxRegion(long x, long y, long w, long h);
22 wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
23 wxRegion(const wxRect& rect);
24 wxRegion( WXHRGN hRegion );
25 wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
26 #if wxUSE_IMAGE
27 wxRegion(const wxBitmap& bmp)
28 {
29 Union(bmp);
30 }
31 wxRegion(const wxBitmap& bmp,
32 const wxColour& transColour, int tolerance = 0)
33 {
34 Union(bmp, transColour, tolerance);
35 }
36 #endif
37
38 virtual ~wxRegion();
39
40 // wxRegionBase methods
41 virtual void Clear();
42 virtual bool IsEmpty() const;
43
44 // Internal
45 WXHRGN GetWXHRGN() const ;
46
47 protected:
48 virtual wxGDIRefData *CreateGDIRefData() const;
49 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
50
51 virtual bool DoIsEqual(const wxRegion& region) const;
52 virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
53 virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
54 virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
55
56 virtual bool DoOffset(wxCoord x, wxCoord y);
57 virtual bool DoCombine(const wxRegion& region, wxRegionOp op);
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(GetX(), GetY(), GetWidth(), 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_