]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/rect.tex
Corrected typos
[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{const wxSize\& }{diff}}
104
105 \func{void}{Deflate}{\param{wxCoord }{diff}}
106
107 \constfunc{wxRect}{Deflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
108
109 Decrease the rectangle size.
110
111 This method is the opposite from \helpref{Inflate}{wxrectinflate}:
112 Deflate(a, b) is equivalent to Inflate(-a, -b).
113 Please refer to \helpref{Inflate}{wxrectinflate} for full description.
114
115 \wxheading{See also}
116
117 \helpref{Inflate}{wxrectinflate}
118
119
120 \membersection{wxRect::GetBottom}\label{wxrectgetbottom}
121
122 \constfunc{int}{GetBottom}{\void}
123
124 Gets the bottom point of the rectangle.
125
126
127 \membersection{wxRect::GetHeight}\label{wxrectgetheight}
128
129 \constfunc{int}{GetHeight}{\void}
130
131 Gets the height member.
132
133
134 \membersection{wxRect::GetLeft}\label{wxrectgetleft}
135
136 \constfunc{int}{GetLeft}{\void}
137
138 Gets the left point of the rectangle (the same as \helpref{wxRect::GetX}{wxrectgetx}).
139
140
141 \membersection{wxRect::GetPosition}\label{wxrectgetposition}
142
143 \constfunc{wxPoint}{GetPosition}{\void}
144
145 Gets the position.
146
147
148 \membersection{wxRect::GetTopLeft}\label{wxrectgettopleft}
149
150 \constfunc{wxPoint}{GetTopLeft}{\void}
151
152 Gets the position of the top left corner of the rectangle, same as
153 \helpref{GetPosition}{wxrectgetposition}.
154
155
156 \membersection{wxRect::GetTopRight}\label{wxrectgettopright}
157
158 \constfunc{wxPoint}{GetTopRight}{\void}
159
160 Gets the position of the top right corner.
161
162
163 \membersection{wxRect::GetBottomLeft}\label{wxrectgetbottomleft}
164
165 \constfunc{wxPoint}{GetBottomLeft}{\void}
166
167 Gets the position of the bottom left corner.
168
169
170 \membersection{wxRect::GetBottomRight}\label{wxrectgetbottomright}
171
172 \constfunc{wxPoint}{GetBottomRight}{\void}
173
174 Gets the position of the bottom right corner.
175
176
177 \membersection{wxRect::GetRight}\label{wxrectgetright}
178
179 \constfunc{int}{GetRight}{\void}
180
181 Gets the right point of the rectangle.
182
183
184 \membersection{wxRect::GetSize}\label{wxrectgetsize}
185
186 \constfunc{wxSize}{GetSize}{\void}
187
188 Gets the size.
189
190 \wxheading{See also}
191
192 \helpref{wxRect::SetSize}{wxrectsetsize}
193
194
195 \membersection{wxRect::GetTop}\label{wxrectgettop}
196
197 \constfunc{int}{GetTop}{\void}
198
199 Gets the top point of the rectangle (the same as \helpref{wxRect::GetY}{wxrectgety}).
200
201
202 \membersection{wxRect::GetWidth}\label{wxrectgetwidth}
203
204 \constfunc{int}{GetWidth}{\void}
205
206 Gets the width member.
207
208
209 \membersection{wxRect::GetX}\label{wxrectgetx}
210
211 \constfunc{int}{GetX}{\void}
212
213 Gets the x member.
214
215
216 \membersection{wxRect::GetY}\label{wxrectgety}
217
218 \constfunc{int}{GetY}{\void}
219
220 Gets the y member.
221
222
223 \membersection{wxRect::Inflate}\label{wxrectinflate}
224
225 \func{void}{Inflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
226
227 \func{void}{Inflate}{\param{const wxSize\& }{diff}}
228
229 \func{void}{Inflate}{\param{wxCoord }{diff}}
230
231 \constfunc{wxRect}{Inflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
232
233 Increases the size of the rectangle.
234
235 The second form uses the same {\it diff} for both {\it dx} and {\it dy}.
236
237 The first two versions modify the rectangle in place, the last one returns a
238 new rectangle leaving this one unchanged.
239
240 The left border is moved farther left and the right border is moved farther
241 right by {\it dx}. The upper border is moved farther up and the bottom border
242 is moved farther down by {\it dy}. (Note the the width and height of the
243 rectangle thus change by 2*{\it dx} and 2*{\it dy}, respectively.) If one or
244 both of {\it dx} and {\it dy} are negative, the opposite happens: the rectangle
245 size decreases in the respective direction.
246
247 Inflating and deflating behaves ``naturally''. Defined more precisely, that
248 means:
249 \begin{enumerate}
250 \item ``Real'' inflates (that is, {\it dx} and/or {\it dy} >= 0) are not
251 constrained. Thus inflating a rectangle can cause its upper left corner
252 to move into the negative numbers. (the versions prior to 2.5.4 forced
253 the top left coordinate to not fall below (0, 0), which implied a
254 forced move of the rectangle.)
255
256 \item Deflates are clamped to not reduce the width or height of the
257 rectangle below zero. In such cases, the top-left corner is nonetheless
258 handled properly. For example, a rectangle at (10, 10) with size (20,
259 40) that is inflated by (-15, -15) will become located at (20, 25) at
260 size (0, 10). Finally, observe that the width and height are treated
261 independently. In the above example, the width is reduced by 20,
262 whereas the height is reduced by the full 30 (rather than also stopping
263 at 20, when the width reached zero).
264 \end{enumerate}
265
266 \wxheading{See also}
267
268 \helpref{Deflate}{wxrectdeflate}
269
270
271 \membersection{wxRect::Intersects}\label{wxrectintersects}
272
273 \constfunc{bool}{Intersects}{\param{const wxRect\& }{rect}}
274
275 Returns {\tt true} if this rectangle has a non-empty intersection with the
276 rectangle {\it rect} and {\tt false} otherwise.
277
278
279 \membersection{wxRect::IsEmpty}\label{wxrectisempty}
280
281 \constfunc{bool}{IsEmpty}{}
282
283 Returns {\tt true} if this rectangle has a width or height less than or equal to
284 0 and {\tt false} otherwise.
285
286
287 \membersection{wxRect::Offset}\label{wxrectoffset}
288
289 \func{void}{Offset}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
290
291 \func{void}{Offset}{\param{const wxPoint\& }{pt}}
292
293 Moves the rectangle by the specified offset. If {\it dx} is positive, the
294 rectangle is moved to the right, if {\it dy} is positive, it is moved to the
295 bottom, otherwise it is moved to the left or top respectively.
296
297
298 \membersection{wxRect::SetHeight}\label{wxrectsetheight}
299
300 \func{void}{SetHeight}{\param{int}{ height}}
301
302 Sets the height.
303
304
305 \membersection{wxRect::SetSize}\label{wxrectsetsize}
306
307 \func{void}{SetSize}{\param{const wxSize\&}{ s}}
308
309 Sets the size.
310
311 \wxheading{See also}
312
313 \helpref{wxRect::GetSize}{wxrectgetsize}
314
315
316 \membersection{wxRect::SetWidth}\label{wxrectsetwidth}
317
318 \func{void}{SetWidth}{\param{int}{ width}}
319
320 Sets the width.
321
322
323 \membersection{wxRect::SetX}\label{wxrectsetx}
324
325 \func{void}{SetX}{\param{int}{ x}}
326
327 Sets the x position.
328
329
330 \membersection{wxRect::SetY}\label{wxrectsety}
331
332 \func{void}{SetY}{\param{int}{ y}}
333
334 Sets the y position.
335
336
337 \membersection{wxRect::Union}\label{wxrectunion}
338
339 \constfunc{wxRect}{Union}{\param{const wxRect\&}{ rect}}
340
341 \func{wxRect\&}{Union}{\param{const wxRect\&}{ rect}}
342
343 Modifies the rectangle to contain the bounding box of this rectangle and the
344 one passed in as parameter. The const version returns the new rectangle, the
345 other one modifies this rectangle in place.
346
347
348 \membersection{wxRect::operator $=$}\label{wxrectassign}
349
350 \func{void}{operator $=$}{\param{const wxRect\& }{rect}}
351
352 Assignment operator.
353
354
355 \membersection{wxRect::operator $==$}\label{wxrectequal}
356
357 \func{bool}{operator $==$}{\param{const wxRect\& }{rect}}
358
359 Equality operator.
360
361
362 \membersection{wxRect::operator $!=$}\label{wxrectnotequal}
363
364 \func{bool}{operator $!=$}{\param{const wxRect\& }{rect}}
365
366 Inequality operator.
367