]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dfb/region.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[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 // Copyright: (c) 2006 REA Elektronik GmbH
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_DFB_REGION_H_
11 #define _WX_DFB_REGION_H_
12
13 class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase
14 {
15 public:
16 wxRegion();
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)
21 {
22 Union(bmp);
23 }
24 wxRegion(const wxBitmap& bmp,
25 const wxColour& transColour, int tolerance = 0)
26 {
27 Union(bmp, transColour, tolerance);
28 }
29
30 virtual ~wxRegion();
31
32 // wxRegionBase methods
33 virtual void Clear();
34 virtual bool IsEmpty() const;
35
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(); }
40
41 protected:
42 virtual wxGDIRefData *CreateGDIRefData() const;
43 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
44
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;
50
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);
57
58
59 friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator;
60
61 DECLARE_DYNAMIC_CLASS(wxRegion);
62 };
63
64
65 class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject
66 {
67 public:
68 wxRegionIterator() {}
69 wxRegionIterator(const wxRegion& region) { Reset(region); }
70
71 void Reset() { m_rect = wxRect(); }
72 void Reset(const wxRegion& region);
73
74 bool HaveRects() const { return !m_rect.IsEmpty(); }
75 operator bool() const { return HaveRects(); }
76
77 wxRegionIterator& operator++();
78 wxRegionIterator operator++(int);
79
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; }
87
88 private:
89 wxRect m_rect;
90
91 DECLARE_DYNAMIC_CLASS(wxRegionIterator);
92 };
93
94 #endif // _WX_DFB_REGION_H_