]>
Commit | Line | Data |
---|---|---|
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 | virtual bool DoUnionWithRect(const wxRect& rect); | |
59 | ||
60 | private: | |
61 | DECLARE_DYNAMIC_CLASS(wxRegion) | |
62 | friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator; | |
63 | }; | |
64 | ||
65 | class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject | |
66 | { | |
67 | public: | |
68 | wxRegionIterator(); | |
69 | wxRegionIterator(const wxRegion& region); | |
70 | wxRegionIterator(const wxRegionIterator& iterator); | |
71 | virtual ~wxRegionIterator(); | |
72 | ||
73 | wxRegionIterator& operator=(const wxRegionIterator& iterator); | |
74 | ||
75 | void Reset() { m_current = 0; } | |
76 | void Reset(const wxRegion& region); | |
77 | ||
78 | operator bool () const { return m_current < m_numRects; } | |
79 | bool HaveRects() const { return m_current < m_numRects; } | |
80 | ||
81 | wxRegionIterator& operator++(); | |
82 | wxRegionIterator operator++(int); | |
83 | ||
84 | long GetX() const; | |
85 | long GetY() const; | |
86 | long GetW() const; | |
87 | long GetWidth() const { return GetW(); } | |
88 | long GetH() const; | |
89 | long GetHeight() const { return GetH(); } | |
90 | wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); } | |
91 | ||
92 | private: | |
93 | void SetRects(long numRects, wxRect *rects); | |
94 | ||
95 | long m_current; | |
96 | long m_numRects; | |
97 | wxRegion m_region; | |
98 | wxRect* m_rects; | |
99 | ||
100 | DECLARE_DYNAMIC_CLASS(wxRegionIterator) | |
101 | }; | |
102 | ||
103 | #endif // _WX_MAC_CARBON_REGION_H_ |