1
/////////////////////////////////////////////////////////////////////////////
2
// Name: wx/x11/region.h
3
// Purpose: wxRegion class
4
// Author: Julian Smart
7
// RCS-ID: $Id: region.h 57915 2009-01-08 16:43:56Z FM $
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, wxPolygonFillMode 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;
64
virtual wxGDIRefData *CreateGDIRefData() const;
65
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
67
// wxRegionBase pure virtuals
68
virtual bool DoIsEqual(const wxRegion& region) const;
69
virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
70
virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
71
virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
73
virtual bool DoOffset(wxCoord x, wxCoord y);
74
virtual bool DoUnionWithRect(const wxRect& rect);
75
virtual bool DoUnionWithRegion(const wxRegion& region);
76
virtual bool DoIntersect(const wxRegion& region);
77
virtual bool DoSubtract(const wxRegion& region);
78
virtual bool DoXor(const wxRegion& region);
80
// common part of ctors for a rectangle region
81
void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
84
DECLARE_DYNAMIC_CLASS(wxRegion)
87
// ----------------------------------------------------------------------------
88
// wxRegionIterator: decomposes a region into rectangles
89
// ----------------------------------------------------------------------------
91
class WXDLLIMPEXP_CORE wxRegionIterator: public wxObject
95
wxRegionIterator(const wxRegion& region);
97
void Reset() { m_current = 0u; }
98
void Reset(const wxRegion& region);
100
operator bool () const;
101
bool HaveRects() const;
104
void operator ++ (int);
106
wxCoord GetX() const;
107
wxCoord GetY() const;
108
wxCoord GetW() const;
109
wxCoord GetWidth() const { return GetW(); }
110
wxCoord GetH() const;
111
wxCoord GetHeight() const { return GetH(); }
112
wxRect GetRect() const;
119
DECLARE_DYNAMIC_CLASS(wxRegionIterator)