]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: region.h | |
3 | // Purpose: wxRegion class | |
409c9842 | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
409c9842 | 6 | // Created: 10/15/99 |
0e320a79 | 7 | // RCS-ID: $Id$ |
409c9842 | 8 | // Copyright: (c) David Webster |
65571936 | 9 | // Licence: wxWindows licence |
0e320a79 DW |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
8a16d737 VZ |
12 | #ifndef _WX_OS2_REGION_H_ |
13 | #define _WX_OS2_REGION_H_ | |
0e320a79 | 14 | |
0e320a79 | 15 | #include "wx/list.h" |
51a7e6af | 16 | #include "wx/os2/private.h" |
0e320a79 | 17 | |
8a16d737 | 18 | class WXDLLEXPORT wxRegion : public wxRegionWithCombine |
5a56a532 | 19 | { |
0e320a79 | 20 | public: |
5a56a532 DW |
21 | wxRegion( wxCoord x |
22 | ,wxCoord y | |
23 | ,wxCoord vWidth | |
24 | ,wxCoord vHeight | |
25 | ); | |
26 | wxRegion( const wxPoint& rTopLeft | |
27 | ,const wxPoint& rBottomRight | |
28 | ); | |
29 | wxRegion(const wxRect& rRect); | |
19193a2c | 30 | wxRegion(WXHRGN hRegion, WXHDC hPS); // Hangs on to this region |
85f6b408 VS |
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 | } | |
409c9842 DW |
40 | |
41 | wxRegion(); | |
d3c7fc99 | 42 | virtual ~wxRegion(); |
409c9842 | 43 | |
5a56a532 DW |
44 | // |
45 | // Modify region | |
46 | // | |
47 | ||
48 | // | |
409c9842 | 49 | // Clear current region |
5a56a532 | 50 | // |
8a16d737 | 51 | virtual void Clear(); |
5a56a532 DW |
52 | |
53 | // | |
409c9842 | 54 | // Is region empty? |
5a56a532 | 55 | // |
8a16d737 | 56 | virtual bool IsEmpty() const; |
5a56a532 DW |
57 | |
58 | // | |
409c9842 | 59 | // Get internal region handle |
5a56a532 | 60 | // |
8a16d737 VZ |
61 | WXHRGN GetHRGN() const; |
62 | ||
5a56a532 | 63 | void SetPS(HPS hPS); |
45e0dc94 DW |
64 | |
65 | protected: | |
66 | virtual wxObjectRefData* CreateData(void) const; | |
107e4338 DW |
67 | virtual wxObjectRefData* CloneData(const wxObjectRefData* pData) const; |
68 | ||
8a16d737 VZ |
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 | ||
45e0dc94 DW |
77 | friend class WXDLLEXPORT wxRegionIterator; |
78 | DECLARE_DYNAMIC_CLASS(wxRegion); | |
79 | ||
5a56a532 | 80 | }; // end of CLASS wxRegion |
0e320a79 | 81 | |
5a56a532 DW |
82 | class WXDLLEXPORT wxRegionIterator : public wxObject |
83 | { | |
0e320a79 DW |
84 | DECLARE_DYNAMIC_CLASS(wxRegionIterator); |
85 | public: | |
409c9842 | 86 | wxRegionIterator(); |
5a56a532 | 87 | wxRegionIterator(const wxRegion& rRegion); |
d3c7fc99 | 88 | virtual ~wxRegionIterator(); |
0e320a79 | 89 | |
5a56a532 DW |
90 | void Reset(void) { m_lCurrent = 0; } |
91 | void Reset(const wxRegion& rRegion); | |
0e320a79 | 92 | |
5a56a532 DW |
93 | operator bool (void) const { return m_lCurrent < m_lNumRects; } |
94 | bool HaveRects(void) const { return m_lCurrent < m_lNumRects; } | |
0e320a79 | 95 | |
5a56a532 | 96 | void operator ++ (void); |
409c9842 | 97 | void operator ++ (int); |
0e320a79 | 98 | |
5a56a532 DW |
99 | wxCoord GetX(void) const; |
100 | wxCoord GetY(void) const; | |
101 | wxCoord GetW(void) const; | |
102 | wxCoord GetWidth(void) const { return GetW(); } | |
103 | wxCoord GetH(void) const; | |
104 | wxCoord GetHeight(void) const { return GetH(); } | |
105 | wxRect GetRect(void) const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); } | |
0e320a79 DW |
106 | |
107 | private: | |
5a56a532 DW |
108 | long m_lCurrent; |
109 | long m_lNumRects; | |
110 | wxRegion m_vRegion; | |
111 | wxRect* m_pRects; | |
112 | }; // end of wxRegionIterator | |
0e320a79 | 113 | |
8a16d737 | 114 | #endif // _WX_OS2_REGION_H_ |