]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/region.h
fixing 10.5 only compiles
[wxWidgets.git] / include / wx / msw / region.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/region.h
3 // Purpose: wxRegion class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) 1997-2002 wxWidgets team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MSW_REGION_H_
13 #define _WX_MSW_REGION_H_
14
15 class WXDLLEXPORT wxRegion : public wxRegionWithCombine
16 {
17 public:
18 wxRegion();
19 wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
20 wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
21 wxRegion(const wxRect& rect);
22 wxRegion(WXHRGN hRegion); // Hangs on to this region
23 wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
24 #if wxUSE_IMAGE
25 wxRegion( const wxBitmap& bmp)
26 {
27 Union(bmp);
28 }
29 wxRegion( const wxBitmap& bmp,
30 const wxColour& transColour, int tolerance = 0)
31 {
32 Union(bmp, transColour, tolerance);
33 }
34 #endif // wxUSE_IMAGE
35
36 virtual ~wxRegion();
37
38 // wxRegionBase methods
39 virtual void Clear();
40 virtual bool IsEmpty() const;
41
42 // Get internal region handle
43 WXHRGN GetHRGN() const;
44
45 protected:
46 virtual wxObjectRefData *CreateRefData() const;
47 virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
48
49 virtual bool DoIsEqual(const wxRegion& region) const;
50 virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
51 virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
52 virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
53
54 virtual bool DoOffset(wxCoord x, wxCoord y);
55 virtual bool DoCombine(const wxRegion& region, wxRegionOp op);
56
57 friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator;
58
59 DECLARE_DYNAMIC_CLASS(wxRegion)
60 };
61
62 class WXDLLEXPORT wxRegionIterator : public wxObject
63 {
64 public:
65 wxRegionIterator() { Init(); }
66 wxRegionIterator(const wxRegion& region);
67 wxRegionIterator(const wxRegionIterator& ri) : wxObject(ri) { Init(); *this = ri; }
68
69 wxRegionIterator& operator=(const wxRegionIterator& ri);
70
71 virtual ~wxRegionIterator();
72
73 void Reset() { m_current = 0; }
74 void Reset(const wxRegion& region);
75
76 bool HaveRects() const { return (m_current < m_numRects); }
77
78 operator bool () const { return HaveRects(); }
79
80 wxRegionIterator& operator++();
81 wxRegionIterator operator++(int);
82
83 wxCoord GetX() const;
84 wxCoord GetY() const;
85 wxCoord GetW() const;
86 wxCoord GetWidth() const { return GetW(); }
87 wxCoord GetH() const;
88 wxCoord GetHeight() const { return GetH(); }
89
90 wxRect GetRect() const { return wxRect(GetX(), GetY(), GetW(), GetH()); }
91
92 private:
93 // common part of all ctors
94 void Init();
95
96 long m_current;
97 long m_numRects;
98 wxRegion m_region;
99 wxRect* m_rects;
100
101 DECLARE_DYNAMIC_CLASS(wxRegionIterator)
102 };
103
104 #endif // _WX_MSW_REGION_H_