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