]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/region.h
Motif and other mods
[wxWidgets.git] / include / wx / gtk1 / region.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: region.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Created: 01/02/97
6 // Id:
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef __REGIONH__
12 #define __REGIONH__
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "wx/list.h"
19 #include "wx/gdiobj.h"
20 #include "wx/gdicmn.h"
21
22 //-----------------------------------------------------------------------------
23 // classes
24 //-----------------------------------------------------------------------------
25
26 class wxRegion;
27
28 //-----------------------------------------------------------------------------
29 // constants
30 //-----------------------------------------------------------------------------
31
32 enum wxRegionContain
33 {
34 wxOutRegion = 0, wxPartRegion = 1, wxInRegion = 2
35 };
36
37 // So far, for internal use only
38 enum wxRegionOp {
39 wxRGN_AND, // Creates the intersection of the two combined regions.
40 wxRGN_COPY, // Creates a copy of the region identified by hrgnSrc1.
41 wxRGN_DIFF, // Combines the parts of hrgnSrc1 that are not part of hrgnSrc2.
42 wxRGN_OR, // Creates the union of two combined regions.
43 wxRGN_XOR // Creates the union of two combined regions except for any overlapping areas.
44 };
45
46 //-----------------------------------------------------------------------------
47 // wxRegion
48 //-----------------------------------------------------------------------------
49
50 class wxRegion : public wxGDIObject
51 {
52 DECLARE_DYNAMIC_CLASS(wxRegion);
53
54 public:
55
56 wxRegion( long x, long y, long w, long h );
57 wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight );
58 wxRegion( const wxRect& rect );
59 wxRegion(void);
60 ~wxRegion(void);
61
62 inline wxRegion( const wxRegion& r )
63 { Ref(r); }
64 inline wxRegion& operator = ( const wxRegion& r )
65 { Ref(r); return (*this); }
66
67 void Clear(void);
68
69 bool Union( long x, long y, long width, long height );
70 bool Union( const wxRect& rect );
71 bool Union( const wxRegion& region );
72
73 bool Intersect( long x, long y, long width, long height );
74 bool Intersect( const wxRect& rect );
75 bool Intersect( const wxRegion& region );
76
77 bool Subtract( long x, long y, long width, long height );
78 bool Subtract( const wxRect& rect );
79 bool Subtract( const wxRegion& region );
80
81 bool Xor( long x, long y, long width, long height );
82 bool Xor( const wxRect& rect );
83 bool Xor( const wxRegion& region );
84
85 void GetBox( long& x, long& y, long&w, long &h ) const;
86 wxRect GetBox(void) const ;
87
88 bool Empty(void) const;
89
90 wxRegionContain Contains( long x, long y ) const;
91 wxRegionContain Contains( long x, long y, long w, long h ) const;
92 wxRegionContain Contains(const wxPoint& pt) const;
93 wxRegionContain Contains(const wxRect& rect) const;
94
95 public:
96
97 wxList *GetRectList() const;
98 GdkRegion *GetRegion(void) const;
99 };
100
101 class wxRegionIterator: public wxObject
102 {
103 DECLARE_DYNAMIC_CLASS(wxRegionIterator);
104
105 public:
106
107 wxRegionIterator(void);
108 wxRegionIterator(const wxRegion& region);
109
110 void Reset(void) { m_current = 0; }
111 void Reset(const wxRegion& region);
112
113 operator bool (void) const;
114 bool HaveRects(void) const;
115
116 void operator ++ (void);
117 void operator ++ (int);
118
119 long GetX(void) const;
120 long GetY(void) const;
121 long GetW(void) const;
122 long GetWidth(void) const { return GetW(); }
123 long GetH(void) const;
124 long GetHeight(void) const { return GetH(); }
125
126 private:
127
128 long m_current;
129 wxRegion m_region;
130 };
131
132
133 #endif
134 // __REGIONH__