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(); }
43 virtual wxGDIRefData
*CreateGDIRefData() const;
44 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
46 // wxRegionBase pure virtuals
47 virtual bool DoIsEqual(const wxRegion
& region
) const;
48 virtual bool DoGetBox(wxCoord
& x
, wxCoord
& y
, wxCoord
& w
, wxCoord
& h
) const;
49 virtual wxRegionContain
DoContainsPoint(wxCoord x
, wxCoord y
) const;
50 virtual wxRegionContain
DoContainsRect(const wxRect
& rect
) const;
52 virtual bool DoOffset(wxCoord x
, wxCoord y
);
53 virtual bool DoUnionWithRect(const wxRect
& rect
);
54 virtual bool DoUnionWithRegion(const wxRegion
& region
);
55 virtual bool DoIntersect(const wxRegion
& region
);
56 virtual bool DoSubtract(const wxRegion
& region
);
57 virtual bool DoXor(const wxRegion
& region
);
60 friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator
;
62 DECLARE_DYNAMIC_CLASS(wxRegion
);
66 class WXDLLIMPEXP_CORE wxRegionIterator
: public wxObject
70 wxRegionIterator(const wxRegion
& region
) { Reset(region
); }
72 void Reset() { m_rect
= wxRect(); }
73 void Reset(const wxRegion
& region
);
75 bool HaveRects() const { return !m_rect
.IsEmpty(); }
76 operator bool() const { return HaveRects(); }
78 wxRegionIterator
& operator++();
79 wxRegionIterator
operator++(int);
81 wxCoord
GetX() const { return m_rect
.GetX(); }
82 wxCoord
GetY() const { return m_rect
.GetY(); }
83 wxCoord
GetW() const { return m_rect
.GetWidth(); }
84 wxCoord
GetWidth() const { return GetW(); }
85 wxCoord
GetH() const { return m_rect
.GetHeight(); }
86 wxCoord
GetHeight() const { return GetH(); }
87 wxRect
GetRect() const { return m_rect
; }
92 DECLARE_DYNAMIC_CLASS(wxRegionIterator
);
95 #endif // _WX_DFB_REGION_H_