1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/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_
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 class WXDLLIMPEXP_CORE wxRegion
: public wxRegionBase
24 wxRegion( wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
)
29 wxRegion( const wxPoint
& topLeft
, const wxPoint
& bottomRight
)
31 InitRect(topLeft
.x
, topLeft
.y
,
32 bottomRight
.x
- topLeft
.x
, bottomRight
.y
- topLeft
.y
);
35 wxRegion( const wxRect
& rect
)
37 InitRect(rect
.x
, rect
.y
, rect
.width
, rect
.height
);
40 wxRegion( size_t n
, const wxPoint
*points
, int fillStyle
= wxODDEVEN_RULE
);
42 wxRegion( const wxBitmap
& bmp
)
46 wxRegion( const wxBitmap
& bmp
,
47 const wxColour
& transColour
, int tolerance
= 0)
49 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;
66 virtual wxGDIRefData
*CreateGDIRefData() const;
67 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
69 // wxRegionBase pure virtuals
70 virtual bool DoIsEqual(const wxRegion
& region
) const;
71 virtual bool DoGetBox(wxCoord
& x
, wxCoord
& y
, wxCoord
& w
, wxCoord
& h
) const;
72 virtual wxRegionContain
DoContainsPoint(wxCoord x
, wxCoord y
) const;
73 virtual wxRegionContain
DoContainsRect(const wxRect
& rect
) const;
75 virtual bool DoOffset(wxCoord x
, wxCoord y
);
76 virtual bool DoUnionWithRect(const wxRect
& rect
);
77 virtual bool DoUnionWithRegion(const wxRegion
& region
);
78 virtual bool DoIntersect(const wxRegion
& region
);
79 virtual bool DoSubtract(const wxRegion
& region
);
80 virtual bool DoXor(const wxRegion
& region
);
82 // common part of ctors for a rectangle region
83 void InitRect(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
);
86 DECLARE_DYNAMIC_CLASS(wxRegion
)
89 // ----------------------------------------------------------------------------
90 // wxRegionIterator: decomposes a region into rectangles
91 // ----------------------------------------------------------------------------
93 class WXDLLIMPEXP_CORE wxRegionIterator
: public wxObject
97 wxRegionIterator(const wxRegion
& region
);
99 void Reset() { m_current
= 0u; }
100 void Reset(const wxRegion
& region
);
102 bool HaveRects() const;
103 operator bool () const { return HaveRects(); }
105 wxRegionIterator
& operator ++ ();
106 wxRegionIterator
operator ++ (int);
108 wxCoord
GetX() const;
109 wxCoord
GetY() const;
110 wxCoord
GetW() const;
111 wxCoord
GetWidth() const { return GetW(); }
112 wxCoord
GetH() const;
113 wxCoord
GetHeight() const { return GetH(); }
114 wxRect
GetRect() const;
121 DECLARE_DYNAMIC_CLASS(wxRegionIterator
)