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