1 \section{\class{wxRegion
}}\label{wxregion
}
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.
6 \wxheading{Derived from
}
8 \helpref{wxGDIObject
}{wxgdiobject
}\\
9 \helpref{wxObject
}{wxobject
}
11 \wxheading{Include files
}
17 \helpref{wxRegionIterator
}{wxregioniterator
}
19 \latexignore{\rtfignore{\wxheading{Members
}}}
21 \membersection{wxRegion::wxRegion
}\label{wxregionconstr
}
23 \func{}{wxRegion
}{\void}
27 \func{}{wxRegion
}{\param{long
}{ x
},
\param{long
}{ y
},
\param{long
}{ width
},
\param{long
}{ height
}}
29 Constructs a rectangular region with the given position and size.
31 \func{}{wxRegion
}{\param{const wxPoint\&
}{ topLeft
},
\param{const wxPoint\&
}{ bottomRight
}}
33 Constructs a rectangular region from the top left point and the bottom right point.
35 \func{}{wxRegion
}{\param{const wxRect\&
}{ rect
}}
37 Constructs a rectangular region a wxRect object.
39 \func{}{wxRegion
}{\param{const wxRegion\&
}{ region
}}
41 Constructs a region by copying another region.
43 \membersection{wxRegion::
\destruct{wxRegion
}}
45 \func{}{\destruct{wxRegion
}}{\void}
49 \membersection{wxRegion::Clear
}\label{wxregionclear
}
51 \func{void
}{Clear
}{\void}
53 Clears the current region.
55 \membersection{wxRegion::Contains
}\label{wxregioncontains
}
57 \constfunc{wxRegionContain
}{Contains
}{\param{long\&
}{x
},
\param{long\&
}{y
}}
59 Returns a value indicating whether the given point is contained within the region.
61 \constfunc{wxRegionContain
}{Contains
}{\param{const wxPoint\&
}{ pt
}}
63 Returns a value indicating whether the given point is contained within the region.
65 \constfunc{wxRegionContain
}{Contains
}{\param{long\&
}{x
},
\param{long\&
}{y
},
\param{long\&
}{width
},
\param{long\&
}{height
}}
67 Returns a value indicating whether the given rectangle is contained within the region.
69 \constfunc{wxRegionContain
}{Contains
}{\param{const wxRect\&
}{rect
}}
71 Returns a value indicating whether the given rectangle is contained within the region.
73 \wxheading{Return value
}
75 The return value is one of wxOutRegion, wxPartRegion and wxInRegion.
77 On Windows, only wxOutRegion and wxInRegion are returned; a value wxInRegion then indicates that
78 all or some part of the region is contained in this region.
80 \membersection{wxRegion::GetBox
}\label{wxregiongetbox
}
82 \constfunc{void
}{GetBox
}{\param{long\&
}{x
},
\param{long\&
}{y
},
\param{long\&
}{width
},
\param{long\&
}{height
}}
84 Returns the outer bounds of the region.
86 \constfunc{wxRect
}{GetBox
}{\void}
88 Returns the outer bounds of the region.
90 \membersection{wxRegion::Intersect
}\label{wxregionintersect
}
92 \func{bool
}{Intersect
}{\param{long
}{ x
},
\param{long
}{ y
},
\param{long
}{ width
},
\param{long
}{ height
}}
94 Finds the intersection of this region and another, rectangular region, specified using position and size.
96 \func{bool
}{Intersect
}{\param{const wxRect\&
}{ rect
}}
98 Finds the intersection of this region and another, rectangular region.
100 \func{bool
}{Intersect
}{\param{const wxRegion\&
}{ region
}}
102 Finds the intersection of this region and another region.
104 \wxheading{Return value
}
106 TRUE if successful, FALSE otherwise.
110 Creates the intersection of the two regions, that is, the parts which are in both regions. The result
111 is stored in this region.
113 \membersection{wxRegion::IsEmpty
}\label{wxregionisempty
}
115 \constfunc{bool
}{IsEmpty
}{\void}
117 Returns TRUE if the region is empty, FALSE otherwise.
119 \membersection{wxRegion::Subtract
}\label{wxregionsubstract
}
121 \func{bool
}{Subtract
}{\param{const wxRect\&
}{ rect
}}
123 Subtracts a rectangular region from this region.
125 \func{bool
}{Subtract
}{\param{const wxRegion\&
}{ region
}}
127 Subtracts a region from this region.
129 \wxheading{Return value
}
131 TRUE if successful, FALSE otherwise.
135 This operation combines the parts of 'this' region that are not part of the second region.
136 The result is stored in this region.
138 \membersection{wxRegion::Union
}\label{wxregionunion
}
140 \func{bool
}{Union
}{\param{long
}{ x
},
\param{long
}{ y
},
\param{long
}{ width
},
\param{long
}{ height
}}
142 Finds the union of this region and another, rectangular region, specified using position and size.
144 \func{bool
}{Union
}{\param{const wxRect\&
}{ rect
}}
146 Finds the union of this region and another, rectangular region.
148 \func{bool
}{Union
}{\param{const wxRegion\&
}{ region
}}
150 Finds the union of this region and another region.
152 \wxheading{Return value
}
154 TRUE if successful, FALSE otherwise.
158 This operation creates a region that combines all of this region and the second region.
159 The result is stored in this region.
161 \membersection{wxRegion::Xor
}\label{wxregionxor
}
163 \func{bool
}{Xor
}{\param{long
}{ x
},
\param{long
}{ y
},
\param{long
}{ width
},
\param{long
}{ height
}}
165 Finds the Xor of this region and another, rectangular region, specified using position and size.
167 \func{bool
}{Xor
}{\param{const wxRect\&
}{ rect
}}
169 Finds the Xor of this region and another, rectangular region.
171 \func{bool
}{Xor
}{\param{const wxRegion\&
}{ region
}}
173 Finds the Xor of this region and another region.
175 \wxheading{Return value
}
177 TRUE if successful, FALSE otherwise.
181 This operation creates a region that combines all of this region and the second region, except
182 for any overlapping areas. The result is stored in this region.
184 \membersection{wxRegion::operator $=$
}\label{wxregionassign
}
186 \func{void
}{operator $=$
}{\param{const wxRegion\&
}{ region
}}
188 Copies
{\it region
} by reference counting.
190 \section{\class{wxRegionIterator
}}\label{wxregioniterator
}
192 This class is used to iterate through the rectangles in a region,
193 typically when examining the damaged regions of a window within an OnPaint call.
195 To use it, construct an iterator object on the stack and loop through the
196 regions, testing the object and incrementing the iterator at the end of the loop.
198 See
\helpref{wxWindow::OnPaint
}{wxwindowonpaint
} for an example of use.
200 \wxheading{Derived from
}
202 \helpref{wxObject
}{wxobject
}
204 \wxheading{Include files
}
210 \helpref{wxWindow::OnPaint
}{wxwindowonpaint
}
212 \latexignore{\rtfignore{\wxheading{Members
}}}
214 \membersection{wxRegionIterator::wxRegionIterator
}
216 \func{}{wxRegionIterator
}{\void}
220 \func{}{wxRegionIterator
}{\param{const wxRegion\&
}{ region
}}
222 Creates an iterator object given a region.
224 \membersection{wxRegionIterator::GetX
}
226 \constfunc{long
}{GetX
}{\void}
228 Returns the x value for the current region.
230 \membersection{wxRegionIterator::GetY
}
232 \constfunc{long
}{GetY
}{\void}
234 Returns the y value for the current region.
236 \membersection{wxRegionIterator::GetW
}
238 \constfunc{long
}{GetW
}{\void}
240 An alias for GetWidth.
242 \membersection{wxRegionIterator::GetWidth
}
244 \constfunc{long
}{GetWidth
}{\void}
246 Returns the width value for the current region.
248 \membersection{wxRegionIterator::GetH
}
250 \constfunc{long
}{GetH
}{\void}
252 An alias for GetHeight.
254 \membersection{wxRegionIterator::GetHeight
}
256 \constfunc{long
}{GetWidth
}{\void}
258 Returns the width value for the current region.
260 \membersection{wxRegionIterator::GetRect
}
262 \constfunc{wxRect
}{GetRect
}{\void}
264 Returns the current rectangle.
266 \membersection{wxRegionIterator::HaveRects
}
268 \constfunc{bool
}{HaveRects
}{\void}
270 Returns TRUE if there are still some rectangles; otherwise returns FALSE.
272 \membersection{wxRegionIterator::Reset
}
274 \func{void
}{Reset
}{\void}
276 Resets the iterator to the beginning of the rectangles.
278 \func{void
}{Reset
}{\param{const wxRegion\&
}{ region
}}
280 Resets the iterator to the given region.
282 \membersection{wxRegionIterator::operator $++$
}
284 \func{void
}{operator $++$
}{\void}
286 Increment operator. Increments the iterator to the next region.
288 \pythonnote{A wxPython alias for this operator is called
{\tt Next
}.
}
290 \membersection{wxRegionIterator::operator bool
}
292 \constfunc{}{operator bool
}{\void}
294 Returns TRUE if there are still some rectangles; otherwise returns FALSE.
296 You can use this to test the iterator object as if it were of type bool.