]>
Commit | Line | Data |
---|---|---|
83df96d6 | 1 | ///////////////////////////////////////////////////////////////////////////// |
8a16d737 | 2 | // Name: wx/x11/region.h |
83df96d6 JS |
3 | // Purpose: wxRegion class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
1934d291 | 7 | // Copyright: (c) Julian Smart, Robert Roebling |
8a16d737 | 8 | // Licence: wxWindows licence |
83df96d6 JS |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef _WX_REGION_H_ | |
12 | #define _WX_REGION_H_ | |
13 | ||
83df96d6 | 14 | #include "wx/list.h" |
83df96d6 | 15 | |
1934d291 RR |
16 | // ---------------------------------------------------------------------------- |
17 | // wxRegion | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
8a16d737 | 20 | class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase |
1934d291 | 21 | { |
83df96d6 | 22 | public: |
1934d291 RR |
23 | wxRegion() { } |
24 | ||
25 | wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) | |
26 | { | |
27 | InitRect(x, y, w, h); | |
28 | } | |
29 | ||
30 | wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight ) | |
31 | { | |
32 | InitRect(topLeft.x, topLeft.y, | |
33 | bottomRight.x - topLeft.x, bottomRight.y - topLeft.y); | |
34 | } | |
35 | ||
36 | wxRegion( const wxRect& rect ) | |
37 | { | |
38 | InitRect(rect.x, rect.y, rect.width, rect.height); | |
39 | } | |
40 | ||
94a007ec | 41 | wxRegion( size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ); |
1542ea39 | 42 | |
85f6b408 VS |
43 | wxRegion( const wxBitmap& bmp) |
44 | { | |
45 | Union(bmp); | |
46 | } | |
1542ea39 | 47 | wxRegion( const wxBitmap& bmp, |
85f6b408 | 48 | const wxColour& transColour, int tolerance = 0) |
1542ea39 RD |
49 | { |
50 | Union(bmp, transColour, tolerance); | |
51 | } | |
52 | ||
d3c7fc99 | 53 | virtual ~wxRegion(); |
1934d291 | 54 | |
8a16d737 VZ |
55 | // wxRegionBase methods |
56 | virtual void Clear(); | |
57 | virtual bool IsEmpty() const; | |
1542ea39 | 58 | |
1934d291 RR |
59 | public: |
60 | WXRegion *GetX11Region() const; | |
61 | ||
62 | protected: | |
8f884a0d VZ |
63 | virtual wxGDIRefData *CreateGDIRefData() const; |
64 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
1542ea39 | 65 | |
8a16d737 VZ |
66 | // wxRegionBase pure virtuals |
67 | virtual bool DoIsEqual(const wxRegion& region) const; | |
68 | virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const; | |
69 | virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const; | |
70 | virtual wxRegionContain DoContainsRect(const wxRect& rect) const; | |
71 | ||
72 | virtual bool DoOffset(wxCoord x, wxCoord y); | |
73 | virtual bool DoUnionWithRect(const wxRect& rect); | |
74 | virtual bool DoUnionWithRegion(const wxRegion& region); | |
75 | virtual bool DoIntersect(const wxRegion& region); | |
76 | virtual bool DoSubtract(const wxRegion& region); | |
77 | virtual bool DoXor(const wxRegion& region); | |
78 | ||
1934d291 RR |
79 | // common part of ctors for a rectangle region |
80 | void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h); | |
81 | ||
82 | private: | |
777105f2 | 83 | DECLARE_DYNAMIC_CLASS(wxRegion) |
83df96d6 JS |
84 | }; |
85 | ||
1934d291 RR |
86 | // ---------------------------------------------------------------------------- |
87 | // wxRegionIterator: decomposes a region into rectangles | |
88 | // ---------------------------------------------------------------------------- | |
89 | ||
968eb2ef | 90 | class WXDLLIMPEXP_CORE wxRegionIterator: public wxObject |
1934d291 | 91 | { |
83df96d6 JS |
92 | public: |
93 | wxRegionIterator(); | |
94 | wxRegionIterator(const wxRegion& region); | |
1934d291 RR |
95 | |
96 | void Reset() { m_current = 0u; } | |
83df96d6 | 97 | void Reset(const wxRegion& region); |
1934d291 RR |
98 | |
99 | operator bool () const; | |
100 | bool HaveRects() const; | |
101 | ||
83df96d6 JS |
102 | void operator ++ (); |
103 | void operator ++ (int); | |
1934d291 | 104 | |
83df96d6 JS |
105 | wxCoord GetX() const; |
106 | wxCoord GetY() const; | |
107 | wxCoord GetW() const; | |
108 | wxCoord GetWidth() const { return GetW(); } | |
109 | wxCoord GetH() const; | |
110 | wxCoord GetHeight() const { return GetH(); } | |
1934d291 RR |
111 | wxRect GetRect() const; |
112 | ||
83df96d6 | 113 | private: |
1934d291 | 114 | size_t m_current; |
83df96d6 | 115 | wxRegion m_region; |
1934d291 RR |
116 | |
117 | private: | |
777105f2 | 118 | DECLARE_DYNAMIC_CLASS(wxRegionIterator) |
83df96d6 JS |
119 | }; |
120 | ||
121 | #endif | |
122 | // _WX_REGION_H_ |