1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/x11/region.h
3 // Purpose: wxRegion class
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart, Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 class WXDLLIMPEXP_CORE wxRegion
: public wxRegionBase
25 wxRegion( wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
)
30 wxRegion( const wxPoint
& topLeft
, const wxPoint
& bottomRight
)
32 InitRect(topLeft
.x
, topLeft
.y
,
33 bottomRight
.x
- topLeft
.x
, bottomRight
.y
- topLeft
.y
);
36 wxRegion( const wxRect
& rect
)
38 InitRect(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
41 wxRegion( size_t n
, const wxPoint
*points
, wxPolygonFillMode fillStyle
= wxODDEVEN_RULE
);
43 wxRegion( const wxBitmap
& bmp
)
47 wxRegion( const wxBitmap
& bmp
,
48 const wxColour
& transColour
, int tolerance
= 0)
50 Union(bmp
, transColour
, tolerance
);
55 // wxRegionBase methods
57 virtual bool IsEmpty() const;
60 WXRegion
*GetX11Region() const;
63 virtual wxGDIRefData
*CreateGDIRefData() const;
64 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
66 // wxRegionBase pure virtuals
67 virtual bool DoIsEqual(const wxRegion
& region
) const;
68 virtual bool DoGetBox(wxCoord
& x
, wxCoord
& y
, wxCoord
& w
, wxCoord
& h
) const;
69 virtual wxRegionContain
DoContainsPoint(wxCoord x
, wxCoord y
) const;
70 virtual wxRegionContain
DoContainsRect(const wxRect
& rect
) const;
72 virtual bool DoOffset(wxCoord x
, wxCoord y
);
73 virtual bool DoUnionWithRect(const wxRect
& rect
);
74 virtual bool DoUnionWithRegion(const wxRegion
& region
);
75 virtual bool DoIntersect(const wxRegion
& region
);
76 virtual bool DoSubtract(const wxRegion
& region
);
77 virtual bool DoXor(const wxRegion
& region
);
79 // common part of ctors for a rectangle region
80 void InitRect(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
);
83 DECLARE_DYNAMIC_CLASS(wxRegion
)
86 // ----------------------------------------------------------------------------
87 // wxRegionIterator: decomposes a region into rectangles
88 // ----------------------------------------------------------------------------
90 class WXDLLIMPEXP_CORE wxRegionIterator
: public wxObject
94 wxRegionIterator(const wxRegion
& region
);
96 void Reset() { m_current
= 0u; }
97 void Reset(const wxRegion
& region
);
99 operator bool () const;
100 bool HaveRects() const;
103 void operator ++ (int);
105 wxCoord
GetX() const;
106 wxCoord
GetY() const;
107 wxCoord
GetW() const;
108 wxCoord
GetWidth() const { return GetW(); }
109 wxCoord
GetH() const;
110 wxCoord
GetHeight() const { return GetH(); }
111 wxRect
GetRect() const;
118 DECLARE_DYNAMIC_CLASS(wxRegionIterator
)