1
/////////////////////////////////////////////////////////////////////////////
2
// Name: wx/gtk/region.h
4
// Author: Robert Roebling
5
// Copyright: (c) 1998 Robert Roebling
6
// Licence: wxWindows licence
7
/////////////////////////////////////////////////////////////////////////////
9
#ifndef _WX_GTK_REGION_H_
10
#define _WX_GTK_REGION_H_
13
typedef struct _cairo_region cairo_region_t;
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,
42
wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
45
wxRegion( const wxBitmap& bmp)
49
wxRegion( const wxBitmap& bmp,
50
const wxColour& transColour, int tolerance = 0)
52
Union(bmp, transColour, tolerance);
58
// wxRegionBase methods
60
virtual bool IsEmpty() const;
63
cairo_region_t* GetRegion() const;
65
wxRegion(const GdkRegion* region);
66
GdkRegion *GetRegion() const;
70
virtual wxGDIRefData *CreateGDIRefData() const;
71
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
73
// wxRegionBase pure virtuals
74
virtual bool DoIsEqual(const wxRegion& region) const;
75
virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
76
virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
77
virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
79
virtual bool DoOffset(wxCoord x, wxCoord y);
80
virtual bool DoUnionWithRect(const wxRect& rect);
81
virtual bool DoUnionWithRegion(const wxRegion& region);
82
virtual bool DoIntersect(const wxRegion& region);
83
virtual bool DoSubtract(const wxRegion& region);
84
virtual bool DoXor(const wxRegion& region);
86
// common part of ctors for a rectangle region
87
void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
90
DECLARE_DYNAMIC_CLASS(wxRegion)
93
// ----------------------------------------------------------------------------
94
// wxRegionIterator: decomposes a region into rectangles
95
// ----------------------------------------------------------------------------
97
class WXDLLIMPEXP_CORE wxRegionIterator: public wxObject
101
wxRegionIterator(const wxRegion& region);
102
wxRegionIterator(const wxRegionIterator& ri) : wxObject(ri) { Init(); *this = ri; }
105
wxRegionIterator& operator=(const wxRegionIterator& ri);
107
void Reset() { m_current = 0u; }
108
void Reset(const wxRegion& region);
110
bool HaveRects() const;
111
operator bool () const { return HaveRects(); }
113
wxRegionIterator& operator ++ ();
114
wxRegionIterator operator ++ (int);
116
wxCoord GetX() const;
117
wxCoord GetY() const;
118
wxCoord GetW() const;
119
wxCoord GetWidth() const { return GetW(); }
120
wxCoord GetH() const;
121
wxCoord GetHeight() const { return GetH(); }
122
wxRect GetRect() const;
126
void CreateRects( const wxRegion& r );
133
DECLARE_DYNAMIC_CLASS(wxRegionIterator)