1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/dfb/region.h
3 // Purpose: wxRegion class
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2006 REA Elektronik GmbH
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_DFB_REGION_H_
12 #define _WX_DFB_REGION_H_
14 class WXDLLIMPEXP_CORE wxRegion
: public wxRegionBase
18 wxRegion(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
);
19 wxRegion(const wxPoint
& topLeft
, const wxPoint
& bottomRight
);
20 wxRegion(const wxRect
& rect
);
21 wxRegion(const wxBitmap
& bmp
)
25 wxRegion(const wxBitmap
& bmp
,
26 const wxColour
& transColour
, int tolerance
= 0)
28 Union(bmp
, transColour
, tolerance
);
33 // wxRegionBase methods
35 virtual bool IsEmpty() const;
37 // NB: implementation detail of DirectFB, should be removed if full
38 // (i.e. not rect-only version is implemented) so that all code that
39 // assumes region==rect breaks
40 wxRect
AsRect() const { return GetBox(); }
44 virtual wxObjectRefData
*CreateRefData() const;
45 virtual wxObjectRefData
*CloneRefData(const wxObjectRefData
*data
) const;
47 // wxRegionBase pure virtuals
48 virtual bool DoIsEqual(const wxRegion
& region
) const;
49 virtual bool DoGetBox(wxCoord
& x
, wxCoord
& y
, wxCoord
& w
, wxCoord
& h
) const;
50 virtual wxRegionContain
DoContainsPoint(wxCoord x
, wxCoord y
) const;
51 virtual wxRegionContain
DoContainsRect(const wxRect
& rect
) const;
53 virtual bool DoOffset(wxCoord x
, wxCoord y
);
54 virtual bool DoUnionWithRect(const wxRect
& rect
);
55 virtual bool DoUnionWithRegion(const wxRegion
& region
);
56 virtual bool DoIntersect(const wxRegion
& region
);
57 virtual bool DoSubtract(const wxRegion
& region
);
58 virtual bool DoXor(const wxRegion
& region
);
61 friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator
;
63 DECLARE_DYNAMIC_CLASS(wxRegion
);
67 class WXDLLIMPEXP_CORE wxRegionIterator
: public wxObject
71 wxRegionIterator(const wxRegion
& region
) { Reset(region
); }
73 void Reset() { m_rect
= wxRect(); }
74 void Reset(const wxRegion
& region
);
76 bool HaveRects() const { return !m_rect
.IsEmpty(); }
77 operator bool() const { return HaveRects(); }
79 wxRegionIterator
& operator++();
80 wxRegionIterator
operator++(int);
82 wxCoord
GetX() const { return m_rect
.GetX(); }
83 wxCoord
GetY() const { return m_rect
.GetY(); }
84 wxCoord
GetW() const { return m_rect
.GetWidth(); }
85 wxCoord
GetWidth() const { return GetW(); }
86 wxCoord
GetH() const { return m_rect
.GetHeight(); }
87 wxCoord
GetHeight() const { return GetH(); }
88 wxRect
GetRect() const { return m_rect
; }
93 DECLARE_DYNAMIC_CLASS(wxRegionIterator
);
96 #endif // _WX_DFB_REGION_H_