1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/dfb/region.h
3 // Purpose: wxRegion class
4 // Author: Vaclav Slavik
6 // Copyright: (c) 2006 REA Elektronik GmbH
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_DFB_REGION_H_
11 #define _WX_DFB_REGION_H_
13 class WXDLLIMPEXP_CORE wxRegion
: public wxRegionBase
17 wxRegion(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
);
18 wxRegion(const wxPoint
& topLeft
, const wxPoint
& bottomRight
);
19 wxRegion(const wxRect
& rect
);
20 wxRegion(const wxBitmap
& bmp
)
24 wxRegion(const wxBitmap
& bmp
,
25 const wxColour
& transColour
, int tolerance
= 0)
27 Union(bmp
, transColour
, tolerance
);
32 // wxRegionBase methods
34 virtual bool IsEmpty() const;
36 // NB: implementation detail of DirectFB, should be removed if full
37 // (i.e. not rect-only version is implemented) so that all code that
38 // assumes region==rect breaks
39 wxRect
AsRect() const { return GetBox(); }
42 virtual wxGDIRefData
*CreateGDIRefData() const;
43 virtual wxGDIRefData
*CloneGDIRefData(const wxGDIRefData
*data
) const;
45 // wxRegionBase pure virtuals
46 virtual bool DoIsEqual(const wxRegion
& region
) const;
47 virtual bool DoGetBox(wxCoord
& x
, wxCoord
& y
, wxCoord
& w
, wxCoord
& h
) const;
48 virtual wxRegionContain
DoContainsPoint(wxCoord x
, wxCoord y
) const;
49 virtual wxRegionContain
DoContainsRect(const wxRect
& rect
) const;
51 virtual bool DoOffset(wxCoord x
, wxCoord y
);
52 virtual bool DoUnionWithRect(const wxRect
& rect
);
53 virtual bool DoUnionWithRegion(const wxRegion
& region
);
54 virtual bool DoIntersect(const wxRegion
& region
);
55 virtual bool DoSubtract(const wxRegion
& region
);
56 virtual bool DoXor(const wxRegion
& region
);
59 friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator
;
61 DECLARE_DYNAMIC_CLASS(wxRegion
);
65 class WXDLLIMPEXP_CORE wxRegionIterator
: public wxObject
69 wxRegionIterator(const wxRegion
& region
) { Reset(region
); }
71 void Reset() { m_rect
= wxRect(); }
72 void Reset(const wxRegion
& region
);
74 bool HaveRects() const { return !m_rect
.IsEmpty(); }
75 operator bool() const { return HaveRects(); }
77 wxRegionIterator
& operator++();
78 wxRegionIterator
operator++(int);
80 wxCoord
GetX() const { return m_rect
.GetX(); }
81 wxCoord
GetY() const { return m_rect
.GetY(); }
82 wxCoord
GetW() const { return m_rect
.GetWidth(); }
83 wxCoord
GetWidth() const { return GetW(); }
84 wxCoord
GetH() const { return m_rect
.GetHeight(); }
85 wxCoord
GetHeight() const { return GetH(); }
86 wxRect
GetRect() const { return m_rect
; }
91 DECLARE_DYNAMIC_CLASS(wxRegionIterator
);
94 #endif // _WX_DFB_REGION_H_