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{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ 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 \func{}{wxRegion
}{\param{size
\_t}{ n
},
\param{const wxPoint
}{*points
},
\param{int
}{fillStyle = wxWINDING
\_RULE}}
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}.
49 {\bf NB:
} This constructor is only implemented for Win32 and GTK+ wxWindows ports.
51 \membersection{wxRegion::
\destruct{wxRegion
}}
53 \func{}{\destruct{wxRegion
}}{\void}
57 \membersection{wxRegion::Clear
}\label{wxregionclear
}
59 \func{void
}{Clear
}{\void}
61 Clears the current region.
63 \membersection{wxRegion::Contains
}\label{wxregioncontains
}
65 \constfunc{wxRegionContain
}{Contains
}{\param{long\&
}{x
},
\param{long\&
}{y
}}
67 Returns a value indicating whether the given point is contained within the region.
69 \constfunc{wxRegionContain
}{Contains
}{\param{const wxPoint\&
}{ pt
}}
71 Returns a value indicating whether the given point is contained within the region.
73 \constfunc{wxRegionContain
}{Contains
}{\param{long\&
}{x
},
\param{long\&
}{y
},
\param{long\&
}{width
},
\param{long\&
}{height
}}
75 Returns a value indicating whether the given rectangle is contained within the region.
77 \constfunc{wxRegionContain
}{Contains
}{\param{const wxRect\&
}{rect
}}
79 Returns a value indicating whether the given rectangle is contained within the region.
81 \wxheading{Return value
}
83 The return value is one of wxOutRegion, wxPartRegion and wxInRegion.
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.
88 \membersection{wxRegion::GetBox
}\label{wxregiongetbox
}
90 \constfunc{void
}{GetBox
}{\param{long\&
}{x
},
\param{long\&
}{y
},
\param{long\&
}{width
},
\param{long\&
}{height
}}
92 Returns the outer bounds of the region.
94 \constfunc{wxRect
}{GetBox
}{\void}
96 Returns the outer bounds of the region.
98 \membersection{wxRegion::Intersect
}\label{wxregionintersect
}
100 \func{bool
}{Intersect
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ height
}}
102 Finds the intersection of this region and another, rectangular region, specified using position and size.
104 \func{bool
}{Intersect
}{\param{const wxRect\&
}{ rect
}}
106 Finds the intersection of this region and another, rectangular region.
108 \func{bool
}{Intersect
}{\param{const wxRegion\&
}{ region
}}
110 Finds the intersection of this region and another region.
112 \wxheading{Return value
}
114 {\tt TRUE
} if successful,
{\tt FALSE
} otherwise.
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.
121 \membersection{wxRegion::IsEmpty
}\label{wxregionisempty
}
123 \constfunc{bool
}{IsEmpty
}{\void}
125 Returns
{\tt TRUE
} if the region is empty,
{\tt FALSE
} otherwise.
127 \membersection{wxRegion::Subtract
}\label{wxregionsubstract
}
129 \func{bool
}{Subtract
}{\param{const wxRect\&
}{ rect
}}
131 Subtracts a rectangular region from this region.
133 \func{bool
}{Subtract
}{\param{const wxRegion\&
}{ region
}}
135 Subtracts a region from this region.
137 \wxheading{Return value
}
139 {\tt TRUE
} if successful,
{\tt FALSE
} otherwise.
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.
146 \membersection{wxRegion::Offset
}\label{wxregionoffset
}
148 \func{bool
}{Offset
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
}}
150 Moves the region by the specified offsets in horizontal and vertical
153 \wxheading{Return value
}
155 {\tt TRUE
} if successful,
{\tt FALSE
} otherwise (the region is unchanged then).
157 \membersection{wxRegion::Union
}\label{wxregionunion
}
159 \func{bool
}{Union
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ height
}}
161 Finds the union of this region and another, rectangular region, specified using position and size.
163 \func{bool
}{Union
}{\param{const wxRect\&
}{ rect
}}
165 Finds the union of this region and another, rectangular region.
167 \func{bool
}{Union
}{\param{const wxRegion\&
}{ region
}}
169 Finds the union of this region and another region.
171 \wxheading{Return value
}
173 {\tt TRUE
} if successful,
{\tt FALSE
} otherwise.
177 This operation creates a region that combines all of this region and the second region.
178 The result is stored in this region.
180 \membersection{wxRegion::Xor
}\label{wxregionxor
}
182 \func{bool
}{Xor
}{\param{wxCoord
}{ x
},
\param{wxCoord
}{ y
},
\param{wxCoord
}{ width
},
\param{wxCoord
}{ height
}}
184 Finds the Xor of this region and another, rectangular region, specified using position and size.
186 \func{bool
}{Xor
}{\param{const wxRect\&
}{ rect
}}
188 Finds the Xor of this region and another, rectangular region.
190 \func{bool
}{Xor
}{\param{const wxRegion\&
}{ region
}}
192 Finds the Xor of this region and another region.
194 \wxheading{Return value
}
196 {\tt TRUE
} if successful,
{\tt FALSE
} otherwise.
200 This operation creates a region that combines all of this region and the second region, except
201 for any overlapping areas. The result is stored in this region.
203 \membersection{wxRegion::operator $=$
}\label{wxregionassign
}
205 \func{void
}{operator $=$
}{\param{const wxRegion\&
}{ region
}}
207 Copies
{\it region
} by reference counting.
209 \section{\class{wxRegionIterator
}}\label{wxregioniterator
}
211 This class is used to iterate through the rectangles in a region,
212 typically when examining the damaged regions of a window within an OnPaint call.
214 To use it, construct an iterator object on the stack and loop through the
215 regions, testing the object and incrementing the iterator at the end of the loop.
217 See
\helpref{wxWindow::OnPaint
}{wxwindowonpaint
} for an example of use.
219 \wxheading{Derived from
}
221 \helpref{wxObject
}{wxobject
}
223 \wxheading{Include files
}
229 \helpref{wxWindow::OnPaint
}{wxwindowonpaint
}
231 \latexignore{\rtfignore{\wxheading{Members
}}}
233 \membersection{wxRegionIterator::wxRegionIterator
}
235 \func{}{wxRegionIterator
}{\void}
239 \func{}{wxRegionIterator
}{\param{const wxRegion\&
}{ region
}}
241 Creates an iterator object given a region.
243 \membersection{wxRegionIterator::GetX
}
245 \constfunc{wxCoord
}{GetX
}{\void}
247 Returns the x value for the current region.
249 \membersection{wxRegionIterator::GetY
}
251 \constfunc{wxCoord
}{GetY
}{\void}
253 Returns the y value for the current region.
255 \membersection{wxRegionIterator::GetW
}
257 \constfunc{wxCoord
}{GetW
}{\void}
259 An alias for GetWidth.
261 \membersection{wxRegionIterator::GetWidth
}
263 \constfunc{wxCoord
}{GetWidth
}{\void}
265 Returns the width value for the current region.
267 \membersection{wxRegionIterator::GetH
}
269 \constfunc{wxCoord
}{GetH
}{\void}
271 An alias for GetHeight.
273 \membersection{wxRegionIterator::GetHeight
}
275 \constfunc{wxCoord
}{GetWidth
}{\void}
277 Returns the width value for the current region.
279 \membersection{wxRegionIterator::GetRect
}
281 \constfunc{wxRect
}{GetRect
}{\void}
283 Returns the current rectangle.
285 \membersection{wxRegionIterator::HaveRects
}
287 \constfunc{bool
}{HaveRects
}{\void}
289 Returns
{\tt TRUE
} if there are still some rectangles; otherwise returns
{\tt FALSE
}.
291 \membersection{wxRegionIterator::Reset
}
293 \func{void
}{Reset
}{\void}
295 Resets the iterator to the beginning of the rectangles.
297 \func{void
}{Reset
}{\param{const wxRegion\&
}{ region
}}
299 Resets the iterator to the given region.
301 \membersection{wxRegionIterator::operator $++$
}
303 \func{void
}{operator $++$
}{\void}
305 Increment operator. Increments the iterator to the next region.
307 \pythonnote{A wxPython alias for this operator is called
{\tt Next
}.
}
309 \membersection{wxRegionIterator::operator bool
}
311 \constfunc{}{operator bool
}{\void}
313 Returns
{\tt TRUE
} if there are still some rectangles; otherwise returns
{\tt FALSE
}.
315 You can use this to test the iterator object as if it were of type bool.