]> git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/region.h
Add wxActivateEvent::GetActivationReason().
[wxWidgets.git] / include / wx / x11 / region.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/x11/region.h
3 // Purpose: wxRegion class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // Copyright: (c) Julian Smart, Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_REGION_H_
12 #define _WX_REGION_H_
13
14 #include "wx/list.h"
15
16 // ----------------------------------------------------------------------------
17 // wxRegion
18 // ----------------------------------------------------------------------------
19
20 class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase
21 {
22 public:
23 wxRegion() { }
24
25 wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
26 {
27 InitRect(x, y, w, h);
28 }
29
30 wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight )
31 {
32 InitRect(topLeft.x, topLeft.y,
33 bottomRight.x - topLeft.x, bottomRight.y - topLeft.y);
34 }
35
36 wxRegion( const wxRect& rect )
37 {
38 InitRect(rect.x, rect.y, rect.width, rect.height);
39 }
40
41 wxRegion( size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
42
43 wxRegion( const wxBitmap& bmp)
44 {
45 Union(bmp);
46 }
47 wxRegion( const wxBitmap& bmp,
48 const wxColour& transColour, int tolerance = 0)
49 {
50 Union(bmp, transColour, tolerance);
51 }
52
53 virtual ~wxRegion();
54
55 // wxRegionBase methods
56 virtual void Clear();
57 virtual bool IsEmpty() const;
58
59 public:
60 WXRegion *GetX11Region() const;
61
62 protected:
63 virtual wxGDIRefData *CreateGDIRefData() const;
64 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
65
66 // wxRegionBase pure virtuals
67 virtual bool DoIsEqual(const wxRegion& region) const;
68 virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
69 virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
70 virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
71
72 virtual bool DoOffset(wxCoord x, wxCoord y);
73 virtual bool DoUnionWithRect(const wxRect& rect);
74 virtual bool DoUnionWithRegion(const wxRegion& region);
75 virtual bool DoIntersect(const wxRegion& region);
76 virtual bool DoSubtract(const wxRegion& region);
77 virtual bool DoXor(const wxRegion& region);
78
79 // common part of ctors for a rectangle region
80 void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
81
82 private:
83 DECLARE_DYNAMIC_CLASS(wxRegion)
84 };
85
86 // ----------------------------------------------------------------------------
87 // wxRegionIterator: decomposes a region into rectangles
88 // ----------------------------------------------------------------------------
89
90 class WXDLLIMPEXP_CORE wxRegionIterator: public wxObject
91 {
92 public:
93 wxRegionIterator();
94 wxRegionIterator(const wxRegion& region);
95
96 void Reset() { m_current = 0u; }
97 void Reset(const wxRegion& region);
98
99 operator bool () const;
100 bool HaveRects() const;
101
102 void operator ++ ();
103 void operator ++ (int);
104
105 wxCoord GetX() const;
106 wxCoord GetY() const;
107 wxCoord GetW() const;
108 wxCoord GetWidth() const { return GetW(); }
109 wxCoord GetH() const;
110 wxCoord GetHeight() const { return GetH(); }
111 wxRect GetRect() const;
112
113 private:
114 size_t m_current;
115 wxRegion m_region;
116
117 private:
118 DECLARE_DYNAMIC_CLASS(wxRegionIterator)
119 };
120
121 #endif
122 // _WX_REGION_H_