]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/region.h
extracted wxGtkString in a separate file, it's also needed by wxX11
[wxWidgets.git] / include / wx / os2 / region.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: region.h
3 // Purpose: wxRegion class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/15/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_OS2_REGION_H_
13 #define _WX_OS2_REGION_H_
14
15 #include "wx/list.h"
16 #include "wx/os2/private.h"
17
18 class WXDLLEXPORT wxRegion : public wxRegionWithCombine
19 {
20 public:
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);
30 wxRegion(WXHRGN hRegion, WXHDC hPS); // Hangs on to this region
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 wxObjectRefData* CreateData(void) const;
67 virtual wxObjectRefData* CloneData(const wxObjectRefData* 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 WXDLLEXPORT wxRegionIterator;
78 DECLARE_DYNAMIC_CLASS(wxRegion);
79
80 }; // end of CLASS wxRegion
81
82 class WXDLLEXPORT wxRegionIterator : public wxObject
83 {
84 DECLARE_DYNAMIC_CLASS(wxRegionIterator);
85 public:
86 wxRegionIterator();
87 wxRegionIterator(const wxRegion& rRegion);
88 virtual ~wxRegionIterator();
89
90 void Reset(void) { m_lCurrent = 0; }
91 void Reset(const wxRegion& rRegion);
92
93 operator bool (void) const { return m_lCurrent < m_lNumRects; }
94 bool HaveRects(void) const { return m_lCurrent < m_lNumRects; }
95
96 void operator ++ (void);
97 void operator ++ (int);
98
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()); }
106
107 private:
108 long m_lCurrent;
109 long m_lNumRects;
110 wxRegion m_vRegion;
111 wxRect* m_pRects;
112 }; // end of wxRegionIterator
113
114 #endif // _WX_OS2_REGION_H_