]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dfb/region.h
Add wxDataFormat GetMatchingPair() which wxGTK and wxMSW already had under different...
[wxWidgets.git] / include / wx / dfb / region.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/dfb/region.h
3 // Purpose: wxRegion class
4 // Author: Vaclav Slavik
5 // Created: 2006-08-08
6 // RCS-ID: $Id$
7 // Copyright: (c) 2006 REA Elektronik GmbH
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_DFB_REGION_H_
12 #define _WX_DFB_REGION_H_
13
14 class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase
15 {
16 public:
17 wxRegion();
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)
22 {
23 Union(bmp);
24 }
25 wxRegion(const wxBitmap& bmp,
26 const wxColour& transColour, int tolerance = 0)
27 {
28 Union(bmp, transColour, tolerance);
29 }
30
31 virtual ~wxRegion();
32
33 // wxRegionBase methods
34 virtual void Clear();
35 virtual bool IsEmpty() const;
36
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(); }
41
42 protected:
43 virtual wxGDIRefData *CreateGDIRefData() const;
44 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
45
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;
51
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);
58
59
60 friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator;
61
62 DECLARE_DYNAMIC_CLASS(wxRegion);
63 };
64
65
66 class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject
67 {
68 public:
69 wxRegionIterator() {}
70 wxRegionIterator(const wxRegion& region) { Reset(region); }
71
72 void Reset() { m_rect = wxRect(); }
73 void Reset(const wxRegion& region);
74
75 bool HaveRects() const { return !m_rect.IsEmpty(); }
76 operator bool() const { return HaveRects(); }
77
78 wxRegionIterator& operator++();
79 wxRegionIterator operator++(int);
80
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; }
88
89 private:
90 wxRect m_rect;
91
92 DECLARE_DYNAMIC_CLASS(wxRegionIterator);
93 };
94
95 #endif // _WX_DFB_REGION_H_