1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/region.h
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_GTK_REGION_H_
11 #define _WX_GTK_REGION_H_
14 typedef struct _cairo_region cairo_region_t
;
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
,
43 wxPolygonFillMode fillStyle
= wxODDEVEN_RULE
);
46 wxRegion( const wxBitmap
& bmp
)
50 wxRegion( const wxBitmap
& bmp
,
51 const wxColour
& transColour
, int tolerance
= 0)
53 Union(bmp
, transColour
, tolerance
);
59 // wxRegionBase methods
61 virtual bool IsEmpty() const;
64 cairo_region_t
* GetRegion() const;
66 wxRegion(const GdkRegion
* region
);
67 GdkRegion
*GetRegion() const;
71 virtual wxGDIRefData
*CreateGDIRefData() const;
72 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
74 // wxRegionBase pure virtuals
75 virtual bool DoIsEqual(const wxRegion
& region
) const;
76 virtual bool DoGetBox(wxCoord
& x
, wxCoord
& y
, wxCoord
& w
, wxCoord
& h
) const;
77 virtual wxRegionContain
DoContainsPoint(wxCoord x
, wxCoord y
) const;
78 virtual wxRegionContain
DoContainsRect(const wxRect
& rect
) const;
80 virtual bool DoOffset(wxCoord x
, wxCoord y
);
81 virtual bool DoUnionWithRect(const wxRect
& rect
);
82 virtual bool DoUnionWithRegion(const wxRegion
& region
);
83 virtual bool DoIntersect(const wxRegion
& region
);
84 virtual bool DoSubtract(const wxRegion
& region
);
85 virtual bool DoXor(const wxRegion
& region
);
87 // common part of ctors for a rectangle region
88 void InitRect(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
);
91 DECLARE_DYNAMIC_CLASS(wxRegion
)
94 // ----------------------------------------------------------------------------
95 // wxRegionIterator: decomposes a region into rectangles
96 // ----------------------------------------------------------------------------
98 class WXDLLIMPEXP_CORE wxRegionIterator
: public wxObject
102 wxRegionIterator(const wxRegion
& region
);
103 wxRegionIterator(const wxRegionIterator
& ri
) : wxObject(ri
) { Init(); *this = ri
; }
106 wxRegionIterator
& operator=(const wxRegionIterator
& ri
);
108 void Reset() { m_current
= 0u; }
109 void Reset(const wxRegion
& region
);
111 bool HaveRects() const;
112 operator bool () const { return HaveRects(); }
114 wxRegionIterator
& operator ++ ();
115 wxRegionIterator
operator ++ (int);
117 wxCoord
GetX() const;
118 wxCoord
GetY() const;
119 wxCoord
GetW() const;
120 wxCoord
GetWidth() const { return GetW(); }
121 wxCoord
GetH() const;
122 wxCoord
GetHeight() const { return GetH(); }
123 wxRect
GetRect() const;
127 void CreateRects( const wxRegion
& r
);
134 DECLARE_DYNAMIC_CLASS(wxRegionIterator
)