1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/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_
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
18 class WXDLLIMPEXP_CORE wxRegion
: public wxRegionBase
23 wxRegion( wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
)
28 wxRegion( const wxPoint
& topLeft
, const wxPoint
& bottomRight
)
30 InitRect(topLeft
.x
, topLeft
.y
,
31 bottomRight
.x
- topLeft
.x
, bottomRight
.y
- topLeft
.y
);
34 wxRegion( const wxRect
& rect
)
36 InitRect(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
39 wxRegion( size_t n
, const wxPoint
*points
, wxPolygonFillMode fillStyle
= wxODDEVEN_RULE
);
41 wxRegion( const wxBitmap
& bmp
)
45 wxRegion( const wxBitmap
& bmp
,
46 const wxColour
& transColour
, int tolerance
= 0)
48 Union(bmp
, transColour
, tolerance
);
53 // wxRegionBase methods
55 virtual bool IsEmpty() const;
58 // Init with GdkRegion, set ref count to 2 so that
59 // the C++ class will not destroy the region!
60 wxRegion( GdkRegion
*region
);
62 GdkRegion
*GetRegion() const;
65 virtual wxGDIRefData
*CreateGDIRefData() const;
66 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*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 bool HaveRects() const;
102 operator bool () const { return HaveRects(); }
104 wxRegionIterator
& operator ++ ();
105 wxRegionIterator
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
)