]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
8ef94bfc | 2 | // Name: wx/gtk1/region.h |
c801d85f KB |
3 | // Purpose: |
4 | // Author: Robert Roebling | |
58614078 | 5 | // Copyright: (c) 1998 Robert Roebling |
65571936 | 6 | // Licence: wxWindows licence |
c801d85f KB |
7 | ///////////////////////////////////////////////////////////////////////////// |
8 | ||
5fc7ede9 VZ |
9 | #ifndef _WX_GTK_REGION_H_ |
10 | #define _WX_GTK_REGION_H_ | |
c801d85f | 11 | |
c801d85f | 12 | #include "wx/list.h" |
c801d85f | 13 | |
1e6feb95 | 14 | // ---------------------------------------------------------------------------- |
c801d85f | 15 | // wxRegion |
1e6feb95 | 16 | // ---------------------------------------------------------------------------- |
c801d85f | 17 | |
8a16d737 | 18 | class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase |
c801d85f | 19 | { |
e1208c31 | 20 | public: |
9fe4c99c | 21 | wxRegion() { } |
1542ea39 | 22 | |
9fe4c99c VZ |
23 | wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) |
24 | { | |
25 | InitRect(x, y, w, h); | |
26 | } | |
27 | ||
28 | wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight ) | |
29 | { | |
30 | InitRect(topLeft.x, topLeft.y, | |
31 | bottomRight.x - topLeft.x, bottomRight.y - topLeft.y); | |
32 | } | |
33 | ||
34 | wxRegion( const wxRect& rect ) | |
35 | { | |
36 | InitRect(rect.x, rect.y, rect.width, rect.height); | |
37 | } | |
38 | ||
94a007ec | 39 | wxRegion( size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ); |
1542ea39 | 40 | |
85f6b408 VS |
41 | wxRegion( const wxBitmap& bmp) |
42 | { | |
43 | Union(bmp); | |
44 | } | |
1542ea39 | 45 | wxRegion( const wxBitmap& bmp, |
85f6b408 | 46 | const wxColour& transColour, int tolerance = 0) |
1542ea39 RD |
47 | { |
48 | Union(bmp, transColour, tolerance); | |
49 | } | |
50 | ||
d3c7fc99 | 51 | virtual ~wxRegion(); |
c801d85f | 52 | |
8a16d737 VZ |
53 | // wxRegionBase methods |
54 | virtual void Clear(); | |
55 | virtual bool IsEmpty() const; | |
1542ea39 | 56 | |
e1208c31 | 57 | public: |
331a0b6b RR |
58 | // Init with GdkRegion, set ref count to 2 so that |
59 | // the C++ class will not destroy the region! | |
60 | wxRegion( GdkRegion *region ); | |
1542ea39 | 61 | |
07818da8 | 62 | GdkRegion *GetRegion() const; |
1e6feb95 VZ |
63 | |
64 | protected: | |
8f884a0d VZ |
65 | virtual wxGDIRefData *CreateGDIRefData() const; |
66 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
1542ea39 | 67 | |
8a16d737 VZ |
68 | // wxRegionBase pure virtuals |
69 | virtual bool DoIsEqual(const wxRegion& region) const; | |
70 | virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const; | |
71 | virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const; | |
72 | virtual wxRegionContain DoContainsRect(const wxRect& rect) const; | |
73 | ||
74 | virtual bool DoOffset(wxCoord x, wxCoord y); | |
75 | virtual bool DoUnionWithRect(const wxRect& rect); | |
76 | virtual bool DoUnionWithRegion(const wxRegion& region); | |
77 | virtual bool DoIntersect(const wxRegion& region); | |
78 | virtual bool DoSubtract(const wxRegion& region); | |
79 | virtual bool DoXor(const wxRegion& region); | |
80 | ||
9fe4c99c VZ |
81 | // common part of ctors for a rectangle region |
82 | void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h); | |
83 | ||
e1208c31 | 84 | private: |
777105f2 | 85 | DECLARE_DYNAMIC_CLASS(wxRegion) |
c801d85f KB |
86 | }; |
87 | ||
1e6feb95 VZ |
88 | // ---------------------------------------------------------------------------- |
89 | // wxRegionIterator: decomposes a region into rectangles | |
90 | // ---------------------------------------------------------------------------- | |
91 | ||
20123d49 | 92 | class WXDLLIMPEXP_CORE wxRegionIterator: public wxObject |
8429bec1 | 93 | { |
738f9e5a | 94 | public: |
07818da8 | 95 | wxRegionIterator(); |
8429bec1 RR |
96 | wxRegionIterator(const wxRegion& region); |
97 | ||
6f2a55e3 | 98 | void Reset() { m_current = 0u; } |
8429bec1 RR |
99 | void Reset(const wxRegion& region); |
100 | ||
07818da8 | 101 | bool HaveRects() const; |
2b5f62a0 | 102 | operator bool () const { return HaveRects(); } |
8429bec1 | 103 | |
2b5f62a0 VZ |
104 | wxRegionIterator& operator ++ (); |
105 | wxRegionIterator operator ++ (int); | |
8429bec1 | 106 | |
b02da6b1 VZ |
107 | wxCoord GetX() const; |
108 | wxCoord GetY() const; | |
109 | wxCoord GetW() const; | |
110 | wxCoord GetWidth() const { return GetW(); } | |
111 | wxCoord GetH() const; | |
112 | wxCoord GetHeight() const { return GetH(); } | |
1e6feb95 | 113 | wxRect GetRect() const; |
8429bec1 | 114 | |
738f9e5a | 115 | private: |
6f2a55e3 VZ |
116 | size_t m_current; |
117 | wxRegion m_region; | |
738f9e5a RR |
118 | |
119 | private: | |
777105f2 | 120 | DECLARE_DYNAMIC_CLASS(wxRegionIterator) |
8429bec1 RR |
121 | }; |
122 | ||
123 | ||
c801d85f | 124 | #endif |
5fc7ede9 | 125 | // _WX_GTK_REGION_H_ |