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 \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{long
}{ x
},
\param{long
}{ y
},
\param{long
}{ width
},
\param{long
}{ 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 TRUE if successful, 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 TRUE if the region is empty, 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 TRUE if successful, 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::Union
}\label{wxregionunion
}
148 \func{bool
}{Union
}{\param{long
}{ x
},
\param{long
}{ y
},
\param{long
}{ width
},
\param{long
}{ height
}}
150 Finds the union of this region and another, rectangular region, specified using position and size.
152 \func{bool
}{Union
}{\param{const wxRect\&
}{ rect
}}
154 Finds the union of this region and another, rectangular region.
156 \func{bool
}{Union
}{\param{const wxRegion\&
}{ region
}}
158 Finds the union of this region and another region.
160 \wxheading{Return value
}
162 TRUE if successful, FALSE otherwise.
166 This operation creates a region that combines all of this region and the second region.
167 The result is stored in this region.
169 \membersection{wxRegion::Xor
}\label{wxregionxor
}
171 \func{bool
}{Xor
}{\param{long
}{ x
},
\param{long
}{ y
},
\param{long
}{ width
},
\param{long
}{ height
}}
173 Finds the Xor of this region and another, rectangular region, specified using position and size.
175 \func{bool
}{Xor
}{\param{const wxRect\&
}{ rect
}}
177 Finds the Xor of this region and another, rectangular region.
179 \func{bool
}{Xor
}{\param{const wxRegion\&
}{ region
}}
181 Finds the Xor of this region and another region.
183 \wxheading{Return value
}
185 TRUE if successful, FALSE otherwise.
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.
192 \membersection{wxRegion::operator $=$
}\label{wxregionassign
}
194 \func{void
}{operator $=$
}{\param{const wxRegion\&
}{ region
}}
196 Copies
{\it region
} by reference counting.
198 \section{\class{wxRegionIterator
}}\label{wxregioniterator
}
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.
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.
206 See
\helpref{wxWindow::OnPaint
}{wxwindowonpaint
} for an example of use.
208 \wxheading{Derived from
}
210 \helpref{wxObject
}{wxobject
}
212 \wxheading{Include files
}
218 \helpref{wxWindow::OnPaint
}{wxwindowonpaint
}
220 \latexignore{\rtfignore{\wxheading{Members
}}}
222 \membersection{wxRegionIterator::wxRegionIterator
}
224 \func{}{wxRegionIterator
}{\void}
228 \func{}{wxRegionIterator
}{\param{const wxRegion\&
}{ region
}}
230 Creates an iterator object given a region.
232 \membersection{wxRegionIterator::GetX
}
234 \constfunc{long
}{GetX
}{\void}
236 Returns the x value for the current region.
238 \membersection{wxRegionIterator::GetY
}
240 \constfunc{long
}{GetY
}{\void}
242 Returns the y value for the current region.
244 \membersection{wxRegionIterator::GetW
}
246 \constfunc{long
}{GetW
}{\void}
248 An alias for GetWidth.
250 \membersection{wxRegionIterator::GetWidth
}
252 \constfunc{long
}{GetWidth
}{\void}
254 Returns the width value for the current region.
256 \membersection{wxRegionIterator::GetH
}
258 \constfunc{long
}{GetH
}{\void}
260 An alias for GetHeight.
262 \membersection{wxRegionIterator::GetHeight
}
264 \constfunc{long
}{GetWidth
}{\void}
266 Returns the width value for the current region.
268 \membersection{wxRegionIterator::GetRect
}
270 \constfunc{wxRect
}{GetRect
}{\void}
272 Returns the current rectangle.
274 \membersection{wxRegionIterator::HaveRects
}
276 \constfunc{bool
}{HaveRects
}{\void}
278 Returns TRUE if there are still some rectangles; otherwise returns FALSE.
280 \membersection{wxRegionIterator::Reset
}
282 \func{void
}{Reset
}{\void}
284 Resets the iterator to the beginning of the rectangles.
286 \func{void
}{Reset
}{\param{const wxRegion\&
}{ region
}}
288 Resets the iterator to the given region.
290 \membersection{wxRegionIterator::operator $++$
}
292 \func{void
}{operator $++$
}{\void}
294 Increment operator. Increments the iterator to the next region.
296 \pythonnote{A wxPython alias for this operator is called
{\tt Next
}.
}
298 \membersection{wxRegionIterator::operator bool
}
300 \constfunc{}{operator bool
}{\void}
302 Returns TRUE if there are still some rectangles; otherwise returns FALSE.
304 You can use this to test the iterator object as if it were of type bool.