]>
Commit | Line | Data |
---|---|---|
8cf73271 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: 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 | |
65571936 | 9 | // Licence: wxWindows licence |
8cf73271 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
8a16d737 VZ |
12 | #ifndef _WX_MAC_CARBON_REGION_H_ |
13 | #define _WX_MAC_CARBON_REGION_H_ | |
8cf73271 | 14 | |
8cf73271 | 15 | #include "wx/list.h" |
8cf73271 | 16 | |
8a16d737 VZ |
17 | class WXDLLEXPORT wxRegion : public wxRegionWithCombine |
18 | { | |
8cf73271 SC |
19 | public: |
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 ); | |
564cb9de | 24 | wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE ); |
8cf73271 | 25 | wxRegion(); |
85f6b408 VS |
26 | wxRegion(const wxBitmap& bmp) |
27 | { | |
28 | Union(bmp); | |
29 | } | |
30 | wxRegion(const wxBitmap& bmp, | |
31 | const wxColour& transColour, int tolerance = 0) | |
8cf73271 SC |
32 | { |
33 | Union(bmp, transColour, tolerance); | |
34 | } | |
35 | ||
d3c7fc99 | 36 | virtual ~wxRegion(); |
8cf73271 | 37 | |
8a16d737 VZ |
38 | // wxRegionBase methods |
39 | virtual void Clear(); | |
40 | virtual bool IsEmpty() const; | |
8cf73271 SC |
41 | |
42 | // Internal | |
8cf73271 | 43 | const WXHRGN GetWXHRGN() const ; |
8a16d737 VZ |
44 | |
45 | protected: | |
8f884a0d VZ |
46 | virtual wxGDIRefData *CreateGDIRefData() const; |
47 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
48 | ||
8a16d737 VZ |
49 | virtual bool DoIsEqual(const wxRegion& region) const; |
50 | virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const; | |
51 | virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const; | |
52 | virtual wxRegionContain DoContainsRect(const wxRect& rect) const; | |
53 | ||
54 | virtual bool DoOffset(wxCoord x, wxCoord y); | |
55 | virtual bool DoCombine(const wxRegion& region, wxRegionOp op); | |
56 | ||
57 | private: | |
58 | DECLARE_DYNAMIC_CLASS(wxRegion) | |
b5dbe15d | 59 | friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator; |
8cf73271 SC |
60 | }; |
61 | ||
62 | class WXDLLEXPORT wxRegionIterator : public wxObject | |
63 | { | |
8cf73271 SC |
64 | public: |
65 | wxRegionIterator(); | |
66 | wxRegionIterator(const wxRegion& region); | |
67 | wxRegionIterator(const wxRegionIterator& iterator); | |
d3c7fc99 | 68 | virtual ~wxRegionIterator(); |
8cf73271 SC |
69 | |
70 | wxRegionIterator& operator=(const wxRegionIterator& iterator); | |
71 | ||
72 | void Reset() { m_current = 0; } | |
73 | void Reset(const wxRegion& region); | |
74 | ||
75 | operator bool () const { return m_current < m_numRects; } | |
76 | bool HaveRects() const { return m_current < m_numRects; } | |
77 | ||
78 | wxRegionIterator& operator++(); | |
79 | wxRegionIterator operator++(int); | |
80 | ||
81 | long GetX() const; | |
82 | long GetY() const; | |
83 | long GetW() const; | |
84 | long GetWidth() const { return GetW(); } | |
85 | long GetH() const; | |
86 | long GetHeight() const { return GetH(); } | |
87 | wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); } | |
8a16d737 | 88 | |
8cf73271 SC |
89 | private: |
90 | void SetRects(long numRects, wxRect *rects); | |
91 | ||
92 | long m_current; | |
93 | long m_numRects; | |
94 | wxRegion m_region; | |
95 | wxRect* m_rects; | |
8a16d737 VZ |
96 | |
97 | DECLARE_DYNAMIC_CLASS(wxRegionIterator) | |
8cf73271 SC |
98 | }; |
99 | ||
8a16d737 | 100 | #endif // _WX_MAC_CARBON_REGION_H_ |