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_
13 // ----------------------------------------------------------------------------
15 // ----------------------------------------------------------------------------
17 class WXDLLIMPEXP_CORE wxRegion
: public wxRegionBase
22 wxRegion( wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
)
27 wxRegion( const wxPoint
& topLeft
, const wxPoint
& bottomRight
)
29 InitRect(topLeft
.x
, topLeft
.y
,
30 bottomRight
.x
- topLeft
.x
, bottomRight
.y
- topLeft
.y
);
33 wxRegion( const wxRect
& rect
)
35 InitRect(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
38 wxRegion( size_t n
, const wxPoint
*points
, int 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
);
54 // wxRegionBase methods
56 virtual bool IsEmpty() const;
59 // Init with GdkRegion, set ref count to 2 so that
60 // the C++ class will not destroy the region!
61 wxRegion( GdkRegion
*region
);
63 GdkRegion
*GetRegion() const;
67 virtual wxObjectRefData
*CreateRefData() const;
68 virtual wxObjectRefData
*CloneRefData(const wxObjectRefData
*data
) const;
70 // wxRegionBase pure virtuals
71 virtual bool DoIsEqual(const wxRegion
& region
) const;
72 virtual bool DoGetBox(wxCoord
& x
, wxCoord
& y
, wxCoord
& w
, wxCoord
& h
) const;
73 virtual wxRegionContain
DoContainsPoint(wxCoord x
, wxCoord y
) const;
74 virtual wxRegionContain
DoContainsRect(const wxRect
& rect
) const;
76 virtual bool DoOffset(wxCoord x
, wxCoord y
);
77 virtual bool DoUnionWithRect(const wxRect
& rect
);
78 virtual bool DoUnionWithRegion(const wxRegion
& region
);
79 virtual bool DoIntersect(const wxRegion
& region
);
80 virtual bool DoSubtract(const wxRegion
& region
);
81 virtual bool DoXor(const wxRegion
& region
);
83 // common part of ctors for a rectangle region
84 void InitRect(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
);
87 DECLARE_DYNAMIC_CLASS(wxRegion
)
90 // ----------------------------------------------------------------------------
91 // wxRegionIterator: decomposes a region into rectangles
92 // ----------------------------------------------------------------------------
94 class WXDLLIMPEXP_CORE wxRegionIterator
: public wxObject
98 wxRegionIterator(const wxRegion
& region
);
99 wxRegionIterator(const wxRegionIterator
& ri
) : wxObject(ri
) { Init(); *this = ri
; }
102 wxRegionIterator
& operator=(const wxRegionIterator
& ri
);
104 void Reset() { m_current
= 0u; }
105 void Reset(const wxRegion
& region
);
107 bool HaveRects() const;
108 operator bool () const { return HaveRects(); }
110 wxRegionIterator
& operator ++ ();
111 wxRegionIterator
operator ++ (int);
113 wxCoord
GetX() const;
114 wxCoord
GetY() const;
115 wxCoord
GetW() const;
116 wxCoord
GetWidth() const { return GetW(); }
117 wxCoord
GetH() const;
118 wxCoord
GetHeight() const { return GetH(); }
119 wxRect
GetRect() const;
123 void CreateRects( const wxRegion
& r
);
132 DECLARE_DYNAMIC_CLASS(wxRegionIterator
)