]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/os2/region.h | |
3 | // Purpose: wxRegion class | |
4 | // Author: David Webster | |
5 | // Modified by: | |
6 | // Created: 10/15/99 | |
7 | // Copyright: (c) David Webster | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_OS2_REGION_H_ | |
12 | #define _WX_OS2_REGION_H_ | |
13 | ||
14 | #include "wx/list.h" | |
15 | #include "wx/os2/private.h" | |
16 | ||
17 | class WXDLLIMPEXP_CORE wxRegion : public wxRegionWithCombine | |
18 | { | |
19 | public: | |
20 | wxRegion( wxCoord x | |
21 | ,wxCoord y | |
22 | ,wxCoord vWidth | |
23 | ,wxCoord vHeight | |
24 | ); | |
25 | wxRegion( const wxPoint& rTopLeft | |
26 | ,const wxPoint& rBottomRight | |
27 | ); | |
28 | wxRegion(const wxRect& rRect); | |
29 | wxRegion(WXHRGN hRegion, WXHDC hPS); // Hangs on to this region | |
30 | wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ); | |
31 | wxRegion( const wxBitmap& bmp) | |
32 | { | |
33 | Union(bmp); | |
34 | } | |
35 | wxRegion( const wxBitmap& bmp, | |
36 | const wxColour& transColour, int tolerance = 0) | |
37 | { | |
38 | Union(bmp, transColour, tolerance); | |
39 | } | |
40 | ||
41 | wxRegion(); | |
42 | virtual ~wxRegion(); | |
43 | ||
44 | // | |
45 | // Modify region | |
46 | // | |
47 | ||
48 | // | |
49 | // Clear current region | |
50 | // | |
51 | virtual void Clear(); | |
52 | ||
53 | // | |
54 | // Is region empty? | |
55 | // | |
56 | virtual bool IsEmpty() const; | |
57 | ||
58 | // | |
59 | // Get internal region handle | |
60 | // | |
61 | WXHRGN GetHRGN() const; | |
62 | ||
63 | void SetPS(HPS hPS); | |
64 | ||
65 | protected: | |
66 | virtual wxGDIRefData* CreateGDIRefData(void) const; | |
67 | virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* pData) const; | |
68 | ||
69 | virtual bool DoIsEqual(const wxRegion& region) const; | |
70 | virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const; | |
71 | virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const; | |
72 | virtual wxRegionContain DoContainsRect(const wxRect& rect) const; | |
73 | ||
74 | virtual bool DoOffset(wxCoord x, wxCoord y); | |
75 | virtual bool DoCombine(const wxRegion& region, wxRegionOp op); | |
76 | ||
77 | friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator; | |
78 | DECLARE_DYNAMIC_CLASS(wxRegion); | |
79 | ||
80 | }; // end of CLASS wxRegion | |
81 | ||
82 | class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject | |
83 | { | |
84 | public: | |
85 | wxRegionIterator(); | |
86 | wxRegionIterator(const wxRegion& rRegion); | |
87 | virtual ~wxRegionIterator(); | |
88 | ||
89 | void Reset(void) { m_lCurrent = 0; } | |
90 | void Reset(const wxRegion& rRegion); | |
91 | ||
92 | operator bool (void) const { return m_lCurrent < m_lNumRects; } | |
93 | bool HaveRects(void) const { return m_lCurrent < m_lNumRects; } | |
94 | ||
95 | void operator ++ (void); | |
96 | void operator ++ (int); | |
97 | ||
98 | wxCoord GetX(void) const; | |
99 | wxCoord GetY(void) const; | |
100 | wxCoord GetW(void) const; | |
101 | wxCoord GetWidth(void) const { return GetW(); } | |
102 | wxCoord GetH(void) const; | |
103 | wxCoord GetHeight(void) const { return GetH(); } | |
104 | wxRect GetRect(void) const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); } | |
105 | ||
106 | private: | |
107 | long m_lCurrent; | |
108 | long m_lNumRects; | |
109 | wxRegion m_vRegion; | |
110 | wxRect* m_pRects; | |
111 | ||
112 | DECLARE_DYNAMIC_CLASS(wxRegionIterator) | |
113 | }; // end of wxRegionIterator | |
114 | ||
115 | #endif // _WX_OS2_REGION_H_ |