1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/region.h
3 // Purpose: wxRegion class
4 // Author: Julian Smart
8 // Copyright: (c) 1997-2002 wxWidgets team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_MSW_REGION_H_
13 #define _WX_MSW_REGION_H_
15 class WXDLLEXPORT wxRegion
: public wxRegionWithCombine
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 wxRegion( const wxBitmap
& bmp
)
28 wxRegion( const wxBitmap
& bmp
,
29 const wxColour
& transColour
, int tolerance
= 0)
31 Union(bmp
, transColour
, tolerance
);
36 // wxRegionBase methods
38 virtual bool IsEmpty() const;
40 // Get internal region handle
41 WXHRGN
GetHRGN() const;
44 virtual wxObjectRefData
*CreateRefData() const;
45 virtual wxObjectRefData
*CloneRefData(const wxObjectRefData
*data
) const;
47 virtual bool DoIsEqual(const wxRegion
& region
) const;
48 virtual bool DoGetBox(wxCoord
& x
, wxCoord
& y
, wxCoord
& w
, wxCoord
& h
) const;
49 virtual wxRegionContain
DoContainsPoint(wxCoord x
, wxCoord y
) const;
50 virtual wxRegionContain
DoContainsRect(const wxRect
& rect
) const;
52 virtual bool DoOffset(wxCoord x
, wxCoord y
);
53 virtual bool DoCombine(const wxRegion
& region
, wxRegionOp op
);
55 friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator
;
57 DECLARE_DYNAMIC_CLASS(wxRegion
)
60 class WXDLLEXPORT wxRegionIterator
: public wxObject
63 wxRegionIterator() { Init(); }
64 wxRegionIterator(const wxRegion
& region
);
65 wxRegionIterator(const wxRegionIterator
& ri
) : wxObject(ri
) { Init(); *this = ri
; }
67 wxRegionIterator
& operator=(const wxRegionIterator
& ri
);
69 virtual ~wxRegionIterator();
71 void Reset() { m_current
= 0; }
72 void Reset(const wxRegion
& region
);
74 bool HaveRects() const { return (m_current
< m_numRects
); }
76 operator bool () const { return HaveRects(); }
78 wxRegionIterator
& operator++();
79 wxRegionIterator
operator++(int);
84 wxCoord
GetWidth() const { return GetW(); }
86 wxCoord
GetHeight() const { return GetH(); }
88 wxRect
GetRect() const { return wxRect(GetX(), GetY(), GetW(), GetH()); }
91 // common part of all ctors
99 DECLARE_DYNAMIC_CLASS(wxRegionIterator
)
102 #endif // _WX_MSW_REGION_H_