]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxRegion}}\label{wxregion} |
2 | ||
3 | A wxRegion represents a simple or complex region on a device context or window. It uses | |
4 | reference counting, so copying and assignment operations are fast. | |
5 | ||
6 | \wxheading{Derived from} | |
7 | ||
8 | \helpref{wxGDIObject}{wxgdiobject}\\ | |
9 | \helpref{wxObject}{wxobject} | |
10 | ||
954b8ae6 JS |
11 | \wxheading{Include files} |
12 | ||
13 | <wx/region.h> | |
14 | ||
76c5df24 JS |
15 | \wxheading{See also} |
16 | ||
17 | \helpref{wxRegionIterator}{wxregioniterator} | |
18 | ||
a660d684 KB |
19 | \latexignore{\rtfignore{\wxheading{Members}}} |
20 | ||
21 | \membersection{wxRegion::wxRegion}\label{wxregionconstr} | |
22 | ||
23 | \func{}{wxRegion}{\void} | |
24 | ||
25 | Default constructor. | |
26 | ||
27 | \func{}{wxRegion}{\param{long}{ x}, \param{long}{ y}, \param{long}{ width}, \param{long}{ height}} | |
28 | ||
29 | Constructs a rectangular region with the given position and size. | |
30 | ||
31 | \func{}{wxRegion}{\param{const wxPoint\&}{ topLeft}, \param{const wxPoint\&}{ bottomRight}} | |
32 | ||
33 | Constructs a rectangular region from the top left point and the bottom right point. | |
34 | ||
35 | \func{}{wxRegion}{\param{const wxRect\&}{ rect}} | |
36 | ||
37 | Constructs a rectangular region a wxRect object. | |
38 | ||
39 | \func{}{wxRegion}{\param{const wxRegion\&}{ region}} | |
40 | ||
41 | Constructs a region by copying another region. | |
42 | ||
5549e9f7 VZ |
43 | \func{}{wxRegion}{\param{size\_t}{ n}, \param{const wxPoint }{*points}, \param{int }{fillStyle = wxWINDING\_RULE}} |
44 | ||
45 | Constructs a region corresponding to the polygon made of {\it n} points in the | |
46 | provided array. {\it fillStyle} parameter may have values | |
47 | {\tt wxWINDING\_RULE} or {\tt wxODDEVEN\_RULE}. | |
48 | ||
49 | {\bf NB:} This constructor is only implemented for Win32 and GTK+ wxWindows ports. | |
50 | ||
a660d684 KB |
51 | \membersection{wxRegion::\destruct{wxRegion}} |
52 | ||
53 | \func{}{\destruct{wxRegion}}{\void} | |
54 | ||
55 | Destructor. | |
56 | ||
57 | \membersection{wxRegion::Clear}\label{wxregionclear} | |
58 | ||
59 | \func{void}{Clear}{\void} | |
60 | ||
61 | Clears the current region. | |
62 | ||
63 | \membersection{wxRegion::Contains}\label{wxregioncontains} | |
64 | ||
65 | \constfunc{wxRegionContain}{Contains}{\param{long\& }{x}, \param{long\& }{y}} | |
66 | ||
67 | Returns a value indicating whether the given point is contained within the region. | |
68 | ||
69 | \constfunc{wxRegionContain}{Contains}{\param{const wxPoint\&}{ pt}} | |
70 | ||
71 | Returns a value indicating whether the given point is contained within the region. | |
72 | ||
73 | \constfunc{wxRegionContain}{Contains}{\param{long\& }{x}, \param{long\& }{y}, \param{long\& }{width}, \param{long\& }{height}} | |
74 | ||
75 | Returns a value indicating whether the given rectangle is contained within the region. | |
76 | ||
77 | \constfunc{wxRegionContain}{Contains}{\param{const wxRect\& }{rect}} | |
78 | ||
79 | Returns a value indicating whether the given rectangle is contained within the region. | |
80 | ||
81 | \wxheading{Return value} | |
82 | ||
83 | The return value is one of wxOutRegion, wxPartRegion and wxInRegion. | |
84 | ||
85 | On Windows, only wxOutRegion and wxInRegion are returned; a value wxInRegion then indicates that | |
86 | all or some part of the region is contained in this region. | |
87 | ||
88 | \membersection{wxRegion::GetBox}\label{wxregiongetbox} | |
89 | ||
90 | \constfunc{void}{GetBox}{\param{long\& }{x}, \param{long\& }{y}, \param{long\& }{width}, \param{long\& }{height}} | |
91 | ||
92 | Returns the outer bounds of the region. | |
93 | ||
94 | \constfunc{wxRect}{GetBox}{\void} | |
95 | ||
96 | Returns the outer bounds of the region. | |
97 | ||
98 | \membersection{wxRegion::Intersect}\label{wxregionintersect} | |
99 | ||
100 | \func{bool}{Intersect}{\param{long}{ x}, \param{long}{ y}, \param{long}{ width}, \param{long}{ height}} | |
101 | ||
102 | Finds the intersection of this region and another, rectangular region, specified using position and size. | |
103 | ||
104 | \func{bool}{Intersect}{\param{const wxRect\&}{ rect}} | |
105 | ||
106 | Finds the intersection of this region and another, rectangular region. | |
107 | ||
108 | \func{bool}{Intersect}{\param{const wxRegion\&}{ region}} | |
109 | ||
110 | Finds the intersection of this region and another region. | |
111 | ||
112 | \wxheading{Return value} | |
113 | ||
114 | TRUE if successful, FALSE otherwise. | |
115 | ||
116 | \wxheading{Remarks} | |
117 | ||
118 | Creates the intersection of the two regions, that is, the parts which are in both regions. The result | |
119 | is stored in this region. | |
120 | ||
121 | \membersection{wxRegion::IsEmpty}\label{wxregionisempty} | |
122 | ||
123 | \constfunc{bool}{IsEmpty}{\void} | |
124 | ||
a660d684 KB |
125 | Returns TRUE if the region is empty, FALSE otherwise. |
126 | ||
f3339684 VZ |
127 | \membersection{wxRegion::Subtract}\label{wxregionsubstract} |
128 | ||
a660d684 KB |
129 | \func{bool}{Subtract}{\param{const wxRect\&}{ rect}} |
130 | ||
131 | Subtracts a rectangular region from this region. | |
132 | ||
133 | \func{bool}{Subtract}{\param{const wxRegion\&}{ region}} | |
134 | ||
135 | Subtracts a region from this region. | |
136 | ||
137 | \wxheading{Return value} | |
138 | ||
139 | TRUE if successful, FALSE otherwise. | |
140 | ||
141 | \wxheading{Remarks} | |
142 | ||
143 | This operation combines the parts of 'this' region that are not part of the second region. | |
144 | The result is stored in this region. | |
145 | ||
146 | \membersection{wxRegion::Union}\label{wxregionunion} | |
147 | ||
148 | \func{bool}{Union}{\param{long}{ x}, \param{long}{ y}, \param{long}{ width}, \param{long}{ height}} | |
149 | ||
150 | Finds the union of this region and another, rectangular region, specified using position and size. | |
151 | ||
152 | \func{bool}{Union}{\param{const wxRect\&}{ rect}} | |
153 | ||
154 | Finds the union of this region and another, rectangular region. | |
155 | ||
156 | \func{bool}{Union}{\param{const wxRegion\&}{ region}} | |
157 | ||
158 | Finds the union of this region and another region. | |
159 | ||
160 | \wxheading{Return value} | |
161 | ||
162 | TRUE if successful, FALSE otherwise. | |
163 | ||
164 | \wxheading{Remarks} | |
165 | ||
166 | This operation creates a region that combines all of this region and the second region. | |
167 | The result is stored in this region. | |
168 | ||
169 | \membersection{wxRegion::Xor}\label{wxregionxor} | |
170 | ||
171 | \func{bool}{Xor}{\param{long}{ x}, \param{long}{ y}, \param{long}{ width}, \param{long}{ height}} | |
172 | ||
173 | Finds the Xor of this region and another, rectangular region, specified using position and size. | |
174 | ||
175 | \func{bool}{Xor}{\param{const wxRect\&}{ rect}} | |
176 | ||
177 | Finds the Xor of this region and another, rectangular region. | |
178 | ||
179 | \func{bool}{Xor}{\param{const wxRegion\&}{ region}} | |
180 | ||
181 | Finds the Xor of this region and another region. | |
182 | ||
183 | \wxheading{Return value} | |
184 | ||
185 | TRUE if successful, FALSE otherwise. | |
186 | ||
187 | \wxheading{Remarks} | |
188 | ||
189 | This operation creates a region that combines all of this region and the second region, except | |
190 | for any overlapping areas. The result is stored in this region. | |
191 | ||
192 | \membersection{wxRegion::operator $=$}\label{wxregionassign} | |
193 | ||
194 | \func{void}{operator $=$}{\param{const wxRegion\&}{ region}} | |
195 | ||
196 | Copies {\it region} by reference counting. | |
197 | ||
76c5df24 JS |
198 | \section{\class{wxRegionIterator}}\label{wxregioniterator} |
199 | ||
200 | This class is used to iterate through the rectangles in a region, | |
201 | typically when examining the damaged regions of a window within an OnPaint call. | |
202 | ||
203 | To use it, construct an iterator object on the stack and loop through the | |
204 | regions, testing the object and incrementing the iterator at the end of the loop. | |
205 | ||
206 | See \helpref{wxWindow::OnPaint}{wxwindowonpaint} for an example of use. | |
207 | ||
208 | \wxheading{Derived from} | |
209 | ||
210 | \helpref{wxObject}{wxobject} | |
211 | ||
954b8ae6 JS |
212 | \wxheading{Include files} |
213 | ||
214 | <wx/region.h> | |
215 | ||
76c5df24 JS |
216 | \wxheading{See also} |
217 | ||
218 | \helpref{wxWindow::OnPaint}{wxwindowonpaint} | |
219 | ||
220 | \latexignore{\rtfignore{\wxheading{Members}}} | |
221 | ||
222 | \membersection{wxRegionIterator::wxRegionIterator} | |
223 | ||
224 | \func{}{wxRegionIterator}{\void} | |
225 | ||
226 | Default constructor. | |
227 | ||
228 | \func{}{wxRegionIterator}{\param{const wxRegion\&}{ region}} | |
229 | ||
230 | Creates an iterator object given a region. | |
231 | ||
232 | \membersection{wxRegionIterator::GetX} | |
233 | ||
234 | \constfunc{long}{GetX}{\void} | |
235 | ||
236 | Returns the x value for the current region. | |
237 | ||
238 | \membersection{wxRegionIterator::GetY} | |
239 | ||
240 | \constfunc{long}{GetY}{\void} | |
241 | ||
242 | Returns the y value for the current region. | |
243 | ||
244 | \membersection{wxRegionIterator::GetW} | |
245 | ||
246 | \constfunc{long}{GetW}{\void} | |
247 | ||
248 | An alias for GetWidth. | |
249 | ||
250 | \membersection{wxRegionIterator::GetWidth} | |
251 | ||
252 | \constfunc{long}{GetWidth}{\void} | |
253 | ||
254 | Returns the width value for the current region. | |
255 | ||
256 | \membersection{wxRegionIterator::GetH} | |
257 | ||
258 | \constfunc{long}{GetH}{\void} | |
259 | ||
260 | An alias for GetHeight. | |
261 | ||
262 | \membersection{wxRegionIterator::GetHeight} | |
263 | ||
264 | \constfunc{long}{GetWidth}{\void} | |
265 | ||
266 | Returns the width value for the current region. | |
267 | ||
268 | \membersection{wxRegionIterator::GetRect} | |
269 | ||
270 | \constfunc{wxRect}{GetRect}{\void} | |
271 | ||
272 | Returns the current rectangle. | |
273 | ||
274 | \membersection{wxRegionIterator::HaveRects} | |
275 | ||
276 | \constfunc{bool}{HaveRects}{\void} | |
277 | ||
278 | Returns TRUE if there are still some rectangles; otherwise returns FALSE. | |
279 | ||
280 | \membersection{wxRegionIterator::Reset} | |
281 | ||
282 | \func{void}{Reset}{\void} | |
283 | ||
284 | Resets the iterator to the beginning of the rectangles. | |
285 | ||
286 | \func{void}{Reset}{\param{const wxRegion\&}{ region}} | |
287 | ||
288 | Resets the iterator to the given region. | |
289 | ||
290 | \membersection{wxRegionIterator::operator $++$} | |
291 | ||
292 | \func{void}{operator $++$}{\void} | |
293 | ||
294 | Increment operator. Increments the iterator to the next region. | |
295 | ||
c9110876 | 296 | \pythonnote{A wxPython alias for this operator is called {\tt Next}.} |
06d20283 | 297 | |
76c5df24 JS |
298 | \membersection{wxRegionIterator::operator bool} |
299 | ||
300 | \constfunc{}{operator bool}{\void} | |
301 | ||
302 | Returns TRUE if there are still some rectangles; otherwise returns FALSE. | |
303 | ||
304 | You can use this to test the iterator object as if it were of type bool. | |
a660d684 | 305 |