1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/region.h
3 // Purpose: wxRegion class
4 // Author: Julian Smart
7 // Copyright: (c) 1997-2002 wxWidgets team
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_MSW_REGION_H_
12 #define _WX_MSW_REGION_H_
14 class WXDLLIMPEXP_CORE wxRegion
: public wxRegionWithCombine
18 wxRegion(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
);
19 wxRegion(const wxPoint
& topLeft
, const wxPoint
& bottomRight
);
20 wxRegion(const wxRect
& rect
);
21 wxRegion(WXHRGN hRegion
); // Hangs on to this region
22 wxRegion(size_t n
, const wxPoint
*points
, wxPolygonFillMode 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
);
37 // wxRegionBase methods
39 virtual bool IsEmpty() const;
41 // Get internal region handle
42 WXHRGN
GetHRGN() const;
45 virtual wxGDIRefData
*CreateGDIRefData() const;
46 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
48 virtual bool DoIsEqual(const wxRegion
& region
) const;
49 virtual bool DoGetBox(wxCoord
& x
, wxCoord
& y
, wxCoord
& w
, wxCoord
& h
) const;
50 virtual wxRegionContain
DoContainsPoint(wxCoord x
, wxCoord y
) const;
51 virtual wxRegionContain
DoContainsRect(const wxRect
& rect
) const;
53 virtual bool DoOffset(wxCoord x
, wxCoord y
);
54 virtual bool DoCombine(const wxRegion
& region
, wxRegionOp op
);
56 friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator
;
58 DECLARE_DYNAMIC_CLASS(wxRegion
)
61 class WXDLLIMPEXP_CORE wxRegionIterator
: public wxObject
64 wxRegionIterator() { Init(); }
65 wxRegionIterator(const wxRegion
& region
);
66 wxRegionIterator(const wxRegionIterator
& ri
) : wxObject(ri
) { Init(); *this = ri
; }
68 wxRegionIterator
& operator=(const wxRegionIterator
& ri
);
70 virtual ~wxRegionIterator();
72 void Reset() { m_current
= 0; }
73 void Reset(const wxRegion
& region
);
75 bool HaveRects() const { return (m_current
< m_numRects
); }
77 operator bool () const { return HaveRects(); }
79 wxRegionIterator
& operator++();
80 wxRegionIterator
operator++(int);
85 wxCoord
GetWidth() const { return GetW(); }
87 wxCoord
GetHeight() const { return GetH(); }
89 wxRect
GetRect() const { return wxRect(GetX(), GetY(), GetW(), GetH()); }
92 // common part of all ctors
100 DECLARE_DYNAMIC_CLASS(wxRegionIterator
)
103 #endif // _WX_MSW_REGION_H_