1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mgl/region.h
3 // Purpose: wxRegion class
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_MGL_REGION_H_
12 #define _WX_MGL_REGION_H_
18 class WXDLLIMPEXP_CORE wxRegion
: public wxRegionBase
22 wxRegion(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
);
23 wxRegion(const wxPoint
& topLeft
, const wxPoint
& bottomRight
);
24 wxRegion(const wxRect
& rect
);
25 wxRegion(const MGLRegion
& region
);
26 wxRegion(size_t n
, const wxPoint
*points
, int fillStyle
= wxODDEVEN_RULE
);
27 wxRegion(const wxBitmap
& bmp
)
31 wxRegion(const wxBitmap
& bmp
,
32 const wxColour
& transColour
, int tolerance
= 0)
34 Union(bmp
, transColour
, tolerance
);
39 // wxRegionBase methods
41 virtual bool IsEmpty() const;
43 // implementation from now on:
44 const MGLRegion
& GetMGLRegion() const;
47 virtual wxGDIRefData
*CreateGDIRefData() const;
48 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
50 // wxRegionBase pure virtuals
51 virtual bool DoIsEqual(const wxRegion
& region
) const;
52 virtual bool DoGetBox(wxCoord
& x
, wxCoord
& y
, wxCoord
& w
, wxCoord
& h
) const;
53 virtual wxRegionContain
DoContainsPoint(wxCoord x
, wxCoord y
) const;
54 virtual wxRegionContain
DoContainsRect(const wxRect
& rect
) const;
56 virtual bool DoOffset(wxCoord x
, wxCoord y
);
57 virtual bool DoUnionWithRect(const wxRect
& rect
);
58 virtual bool DoUnionWithRegion(const wxRegion
& region
);
59 virtual bool DoIntersect(const wxRegion
& region
);
60 virtual bool DoSubtract(const wxRegion
& region
);
61 virtual bool DoXor(const wxRegion
& region
);
64 DECLARE_DYNAMIC_CLASS(wxRegion
);
65 friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator
;
69 WX_DECLARE_EXPORTED_LIST(wxRect
, wxRegionRectList
);
71 class WXDLLIMPEXP_CORE wxRegionIterator
: public wxObject
74 wxRegionIterator(void);
75 wxRegionIterator(const wxRegion
& region
);
76 virtual ~wxRegionIterator(void);
78 void Reset(void) { m_currentNode
= NULL
; }
79 void Reset(const wxRegion
& region
);
81 operator bool (void) const { return (m_currentNode
!= NULL
); }
83 bool HaveRects(void) const { return (m_currentNode
!= NULL
); }
85 void operator ++ (void);
86 void operator ++ (int);
88 wxCoord
GetX(void) const;
89 wxCoord
GetY(void) const;
90 wxCoord
GetW(void) const;
91 wxCoord
GetWidth(void) const { return GetW(); }
92 wxCoord
GetH(void) const;
93 wxCoord
GetHeight(void) const { return GetH(); }
94 wxRect
GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
97 wxRegionRectList m_rects
;
98 wxRegionRectList::Node
*m_currentNode
;
100 DECLARE_DYNAMIC_CLASS(wxRegionIterator
);
103 #endif // _WX_MGL_REGION_H_