]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/dfb/region.h
fixed visibility warning on Fedora
[wxWidgets.git] / include / wx / dfb / region.h
... / ...
CommitLineData
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
14class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase
15{
16public:
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
42protected:
43 // ref counting code
44 virtual wxObjectRefData *CreateRefData() const;
45 virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
46
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;
52
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);
59
60
61 friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator;
62
63 DECLARE_DYNAMIC_CLASS(wxRegion);
64};
65
66
67class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject
68{
69public:
70 wxRegionIterator() {}
71 wxRegionIterator(const wxRegion& region) { Reset(region); }
72
73 void Reset() { m_rect = wxRect(); }
74 void Reset(const wxRegion& region);
75
76 bool HaveRects() const { return !m_rect.IsEmpty(); }
77 operator bool() const { return HaveRects(); }
78
79 wxRegionIterator& operator++();
80 wxRegionIterator operator++(int);
81
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; }
89
90private:
91 wxRect m_rect;
92
93 DECLARE_DYNAMIC_CLASS(wxRegionIterator);
94};
95
96#endif // _WX_DFB_REGION_H_