]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
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 | ||
93 | public: | |
94 | ||
95 | GdkRegion *GetRegion(void) const; | |
96 | }; | |
97 | ||
98 | #endif | |
99 | // __REGIONH__ |