1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/x11/region.h
3 // Purpose: wxRegion class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart, Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
17 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
21 class WXDLLIMPEXP_CORE wxRegion
: public wxRegionBase
26 wxRegion( wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
)
31 wxRegion( const wxPoint
& topLeft
, const wxPoint
& bottomRight
)
33 InitRect(topLeft
.x
, topLeft
.y
,
34 bottomRight
.x
- topLeft
.x
, bottomRight
.y
- topLeft
.y
);
37 wxRegion( const wxRect
& rect
)
39 InitRect(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
42 wxRegion( size_t n
, const wxPoint
*points
, int fillStyle
= wxODDEVEN_RULE
);
44 wxRegion( const wxBitmap
& bmp
)
48 wxRegion( const wxBitmap
& bmp
,
49 const wxColour
& transColour
, int tolerance
= 0)
51 Union(bmp
, transColour
, tolerance
);
56 // wxRegionBase methods
58 virtual bool IsEmpty() const;
61 WXRegion
*GetX11Region() const;
65 virtual wxObjectRefData
*CreateRefData() const;
66 virtual wxObjectRefData
*CloneRefData(const wxObjectRefData
*data
) const;
68 // wxRegionBase pure virtuals
69 virtual bool DoIsEqual(const wxRegion
& region
) const;
70 virtual bool DoGetBox(wxCoord
& x
, wxCoord
& y
, wxCoord
& w
, wxCoord
& h
) const;
71 virtual wxRegionContain
DoContainsPoint(wxCoord x
, wxCoord y
) const;
72 virtual wxRegionContain
DoContainsRect(const wxRect
& rect
) const;
74 virtual bool DoOffset(wxCoord x
, wxCoord y
);
75 virtual bool DoUnionWithRect(const wxRect
& rect
);
76 virtual bool DoUnionWithRegion(const wxRegion
& region
);
77 virtual bool DoIntersect(const wxRegion
& region
);
78 virtual bool DoSubtract(const wxRegion
& region
);
79 virtual bool DoXor(const wxRegion
& region
);
81 // common part of ctors for a rectangle region
82 void InitRect(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
);
85 DECLARE_DYNAMIC_CLASS(wxRegion
)
88 // ----------------------------------------------------------------------------
89 // wxRegionIterator: decomposes a region into rectangles
90 // ----------------------------------------------------------------------------
92 class WXDLLIMPEXP_CORE wxRegionIterator
: public wxObject
96 wxRegionIterator(const wxRegion
& region
);
98 void Reset() { m_current
= 0u; }
99 void Reset(const wxRegion
& region
);
101 operator bool () const;
102 bool HaveRects() const;
105 void operator ++ (int);
107 wxCoord
GetX() const;
108 wxCoord
GetY() const;
109 wxCoord
GetW() const;
110 wxCoord
GetWidth() const { return GetW(); }
111 wxCoord
GetH() const;
112 wxCoord
GetHeight() const { return GetH(); }
113 wxRect
GetRect() const;
120 DECLARE_DYNAMIC_CLASS(wxRegionIterator
)