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 WXDLLIMPEXP_CORE 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
);
25 wxRegion( const wxBitmap
& bmp
)
29 wxRegion( const wxBitmap
& bmp
,
30 const wxColour
& transColour
, int tolerance
= 0)
32 Union(bmp
, transColour
, tolerance
);
38 // wxRegionBase methods
40 virtual bool IsEmpty() const;
42 // Get internal region handle
43 WXHRGN
GetHRGN() const;
46 virtual wxGDIRefData
*CreateGDIRefData() const;
47 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
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;
54 virtual bool DoOffset(wxCoord x
, wxCoord y
);
55 virtual bool DoCombine(const wxRegion
& region
, wxRegionOp op
);
57 friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator
;
59 DECLARE_DYNAMIC_CLASS(wxRegion
)
62 class WXDLLIMPEXP_CORE wxRegionIterator
: public wxObject
65 wxRegionIterator() { Init(); }
66 wxRegionIterator(const wxRegion
& region
);
67 wxRegionIterator(const wxRegionIterator
& ri
) : wxObject(ri
) { Init(); *this = ri
; }
69 wxRegionIterator
& operator=(const wxRegionIterator
& ri
);
71 virtual ~wxRegionIterator();
73 void Reset() { m_current
= 0; }
74 void Reset(const wxRegion
& region
);
76 bool HaveRects() const { return (m_current
< m_numRects
); }
78 operator bool () const { return HaveRects(); }
80 wxRegionIterator
& operator++();
81 wxRegionIterator
operator++(int);
86 wxCoord
GetWidth() const { return GetW(); }
88 wxCoord
GetHeight() const { return GetH(); }
90 wxRect
GetRect() const { return wxRect(GetX(), GetY(), GetW(), GetH()); }
93 // common part of all ctors
101 DECLARE_DYNAMIC_CLASS(wxRegionIterator
)
104 #endif // _WX_MSW_REGION_H_