]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/rect.tex
[ 1521481 ] wxPathList modernization
[wxWidgets.git] / docs / latex / wx / rect.tex
1 \section{\class{wxRect}}\label{wxrect}
2
3 A class for manipulating rectangles.
4
5 \wxheading{Derived from}
6
7 None
8
9 \wxheading{Include files}
10
11 <wx/gdicmn.h>
12
13 \wxheading{See also}
14
15 \helpref{wxPoint}{wxpoint}, \helpref{wxSize}{wxsize}
16
17 \latexignore{\rtfignore{\wxheading{Members}}}
18
19
20 \membersection{wxRect::wxRect}\label{wxrectctor}
21
22 \func{}{wxRect}{\void}
23
24 Default constructor.
25
26 \func{}{wxRect}{\param{int}{ x}, \param{int}{ y}, \param{int}{ width}, \param{int}{ height}}
27
28 Creates a wxRect object from x, y, width and height values.
29
30 \func{}{wxRect}{\param{const wxPoint\&}{ topLeft}, \param{const wxPoint\&}{ bottomRight}}
31
32 Creates a wxRect object from top-left and bottom-right points.
33
34 \func{}{wxRect}{\param{const wxPoint\&}{ pos}, \param{const wxSize\&}{ size}}
35
36 Creates a wxRect object from position and size values.
37
38 \func{}{wxRect}{\param{const wxSize\&}{ size}}
39
40 Creates a wxRect object from size values at the origin.
41
42
43 \membersection{wxRect::x}\label{wxrectx}
44
45 \member{int}{x}
46
47 x coordinate of the top-level corner of the rectangle.
48
49
50 \membersection{wxRect::y}\label{wxrecty}
51
52 \member{int}{y}
53
54 y coordinate of the top-level corner of the rectangle.
55
56
57 \membersection{wxRect::width}\label{wxrectwidth}
58
59 \member{int}{width}
60
61 Width member.
62
63
64 \membersection{wxRect::height}\label{wxrectheight}
65
66 \member{int}{height}
67
68 Height member.
69
70
71 \membersection{wxRect::CentreIn}\label{wxrectcentrein}
72
73 \constfunc{wxRect}{CentreIn}{\param{const wxRect\& }{r}, \param{int }{dir = wxBOTH}}
74
75 \constfunc{wxRect}{CenterIn}{\param{const wxRect\& }{r}, \param{int }{dir = wxBOTH}}
76
77 Returns the rectangle having the same size as this one but centered relatively
78 to the given rectangle \arg{r}. By default, rectangle is centred in both
79 directions but if \arg{dir} includes only \texttt{wxVERTICAL} or only
80 \texttt{wxHORIZONTAL} flag, then it is only centered in this direction while
81 the other component of its position remains unchanged.
82
83
84 \membersection{wxRect::Contains}\label{wxrectcontains}
85
86 \constfunc{bool}{Contains}{\param{int }{x}, \param{int }{y}}
87
88 \constfunc{bool}{Contains}{\param{const wxPoint\& }{pt}}
89
90 Returns {\tt true} if the given point is inside the rectangle (or on its
91 boundary) and {\tt false} otherwise.
92
93 \constfunc{bool}{Contains}{\param{const wxRect\& }{rect}}
94
95 Returns \true if the given rectangle is completely inside this rectangle
96 (or touches its boundary) and \false otherwise.
97
98
99 \membersection{wxRect::Deflate}\label{wxrectdeflate}
100
101 \func{void}{Deflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
102
103 \func{void}{Deflate}{\param{wxCoord }{diff}}
104
105 \constfunc{wxRect}{Deflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
106
107 Decrease the rectangle size.
108
109 This method is the opposite from \helpref{Inflate}{wxrectinflate}:
110 Deflate(a, b) is equivalent to Inflate(-a, -b).
111 Please refer to \helpref{Inflate}{wxrectinflate} for full description.
112
113 \wxheading{See also}
114
115 \helpref{Inflate}{wxrectinflate}
116
117
118 \membersection{wxRect::GetBottom}\label{wxrectgetbottom}
119
120 \constfunc{int}{GetBottom}{\void}
121
122 Gets the bottom point of the rectangle.
123
124
125 \membersection{wxRect::GetHeight}\label{wxrectgetheight}
126
127 \constfunc{int}{GetHeight}{\void}
128
129 Gets the height member.
130
131
132 \membersection{wxRect::GetLeft}\label{wxrectgetleft}
133
134 \constfunc{int}{GetLeft}{\void}
135
136 Gets the left point of the rectangle (the same as \helpref{wxRect::GetX}{wxrectgetx}).
137
138
139 \membersection{wxRect::GetPosition}\label{wxrectgetposition}
140
141 \constfunc{wxPoint}{GetPosition}{\void}
142
143 Gets the position.
144
145
146 \membersection{wxRect::GetTopLeft}\label{wxrectgettopleft}
147
148 \constfunc{wxPoint}{GetTopLeft}{\void}
149
150 Gets the position of the top left corner of the rectangle, same as
151 \helpref{GetPosition}{wxrectgetposition}.
152
153
154 \membersection{wxRect::GetTopRight}\label{wxrectgettopright}
155
156 \constfunc{wxPoint}{GetTopRight}{\void}
157
158 Gets the position of the top right corner.
159
160
161 \membersection{wxRect::GetBottomLeft}\label{wxrectgetbottomleft}
162
163 \constfunc{wxPoint}{GetBottomLeft}{\void}
164
165 Gets the position of the bottom left corner.
166
167
168 \membersection{wxRect::GetBottomRight}\label{wxrectgetbottomright}
169
170 \constfunc{wxPoint}{GetBottomRight}{\void}
171
172 Gets the position of the bottom right corner.
173
174
175 \membersection{wxRect::GetRight}\label{wxrectgetright}
176
177 \constfunc{int}{GetRight}{\void}
178
179 Gets the right point of the rectangle.
180
181
182 \membersection{wxRect::GetSize}\label{wxrectgetsize}
183
184 \constfunc{wxSize}{GetSize}{\void}
185
186 Gets the size.
187
188 \wxheading{See also}
189
190 \helpref{wxRect::SetSize}{wxrectsetsize}
191
192
193 \membersection{wxRect::GetTop}\label{wxrectgettop}
194
195 \constfunc{int}{GetTop}{\void}
196
197 Gets the top point of the rectangle (the same as \helpref{wxRect::GetY}{wxrectgety}).
198
199
200 \membersection{wxRect::GetWidth}\label{wxrectgetwidth}
201
202 \constfunc{int}{GetWidth}{\void}
203
204 Gets the width member.
205
206
207 \membersection{wxRect::GetX}\label{wxrectgetx}
208
209 \constfunc{int}{GetX}{\void}
210
211 Gets the x member.
212
213
214 \membersection{wxRect::GetY}\label{wxrectgety}
215
216 \constfunc{int}{GetY}{\void}
217
218 Gets the y member.
219
220
221 \membersection{wxRect::Inflate}\label{wxrectinflate}
222
223 \func{void}{Inflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
224
225 \func{void}{Inflate}{\param{wxCoord }{diff}}
226
227 \constfunc{wxRect}{Inflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
228
229 Increases the size of the rectangle.
230
231 The second form uses the same {\it diff} for both {\it dx} and {\it dy}.
232
233 The first two versions modify the rectangle in place, the last one returns a
234 new rectangle leaving this one unchanged.
235
236 The left border is moved farther left and the right border is moved farther
237 right by {\it dx}. The upper border is moved farther up and the bottom border
238 is moved farther down by {\it dy}. (Note the the width and height of the
239 rectangle thus change by 2*{\it dx} and 2*{\it dy}, respectively.) If one or
240 both of {\it dx} and {\it dy} are negative, the opposite happens: the rectangle
241 size decreases in the respective direction.
242
243 Inflating and deflating behaves ``naturally''. Defined more precisely, that
244 means:
245 \begin{enumerate}
246 \item ``Real'' inflates (that is, {\it dx} and/or {\it dy} >= 0) are not
247 constrained. Thus inflating a rectangle can cause its upper left corner
248 to move into the negative numbers. (the versions prior to 2.5.4 forced
249 the top left coordinate to not fall below (0, 0), which implied a
250 forced move of the rectangle.)
251
252 \item Deflates are clamped to not reduce the width or height of the
253 rectangle below zero. In such cases, the top-left corner is nonetheless
254 handled properly. For example, a rectangle at (10, 10) with size (20,
255 40) that is inflated by (-15, -15) will become located at (20, 25) at
256 size (0, 10). Finally, observe that the width and height are treated
257 independently. In the above example, the width is reduced by 20,
258 whereas the height is reduced by the full 30 (rather than also stopping
259 at 20, when the width reached zero).
260 \end{enumerate}
261
262 \wxheading{See also}
263
264 \helpref{Deflate}{wxrectdeflate}
265
266
267 \membersection{wxRect::Intersects}\label{wxrectintersects}
268
269 \constfunc{bool}{Intersects}{\param{const wxRect\& }{rect}}
270
271 Returns {\tt true} if this rectangle has a non-empty intersection with the
272 rectangle {\it rect} and {\tt false} otherwise.
273
274
275 \membersection{wxRect::IsEmpty}\label{wxrectisempty}
276
277 \constfunc{bool}{IsEmpty}{}
278
279 Returns {\tt true} if this rectangle has a width or height less than or equal to
280 0 and {\tt false} otherwise.
281
282
283 \membersection{wxRect::Offset}\label{wxrectoffset}
284
285 \func{void}{Offset}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
286
287 \func{void}{Offset}{\param{const wxPoint\& }{pt}}
288
289 Moves the rectangle by the specified offset. If {\it dx} is positive, the
290 rectangle is moved to the right, if {\it dy} is positive, it is moved to the
291 bottom, otherwise it is moved to the left or top respectively.
292
293
294 \membersection{wxRect::SetHeight}\label{wxrectsetheight}
295
296 \func{void}{SetHeight}{\param{int}{ height}}
297
298 Sets the height.
299
300
301 \membersection{wxRect::SetSize}\label{wxrectsetsize}
302
303 \func{void}{SetSize}{\param{const wxSize\&}{ s}}
304
305 Sets the size.
306
307 \wxheading{See also}
308
309 \helpref{wxRect::GetSize}{wxrectgetsize}
310
311
312 \membersection{wxRect::SetWidth}\label{wxrectsetwidth}
313
314 \func{void}{SetWidth}{\param{int}{ width}}
315
316 Sets the width.
317
318
319 \membersection{wxRect::SetX}\label{wxrectsetx}
320
321 \func{void}{SetX}{\param{int}{ x}}
322
323 Sets the x position.
324
325
326 \membersection{wxRect::SetY}\label{wxrectsety}
327
328 \func{void}{SetY}{\param{int}{ y}}
329
330 Sets the y position.
331
332
333 \membersection{wxRect::Union}\label{wxrectunion}
334
335 \constfunc{wxRect}{Union}{\param{const wxRect\&}{ rect}}
336
337 \func{wxRect\&}{Union}{\param{const wxRect\&}{ rect}}
338
339 Modifies the rectangle to contain the bounding box of this rectangle and the
340 one passed in as parameter. The const version returns the new rectangle, the
341 other one modifies this rectangle in place.
342
343
344 \membersection{wxRect::operator $=$}\label{wxrectassign}
345
346 \func{void}{operator $=$}{\param{const wxRect\& }{rect}}
347
348 Assignment operator.
349
350
351 \membersection{wxRect::operator $==$}\label{wxrectequal}
352
353 \func{bool}{operator $==$}{\param{const wxRect\& }{rect}}
354
355 Equality operator.
356
357
358 \membersection{wxRect::operator $!=$}\label{wxrectnotequal}
359
360 \func{bool}{operator $!=$}{\param{const wxRect\& }{rect}}
361
362 Inequality operator.
363