]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/rect.tex
Typo correction
[wxWidgets.git] / docs / latex / wx / rect.tex
CommitLineData
a660d684
KB
1\section{\class{wxRect}}\label{wxrect}
2
3A class for manipulating rectangles.
4
5\wxheading{Derived from}
6
9838df2c 7None
a660d684 8
954b8ae6
JS
9\wxheading{Include files}
10
11<wx/gdicmn.h>
12
a660d684
KB
13\wxheading{See also}
14
15\helpref{wxPoint}{wxpoint}, \helpref{wxSize}{wxsize}
16
17\latexignore{\rtfignore{\wxheading{Members}}}
18
df83b840 19
39275175 20\membersection{wxRect::wxRect}\label{wxrectctor}
a660d684
KB
21
22\func{}{wxRect}{\void}
23
24Default constructor.
25
eaaa6a06 26\func{}{wxRect}{\param{int}{ x}, \param{int}{ y}, \param{int}{ width}, \param{int}{ height}}
a660d684
KB
27
28Creates a wxRect object from x, y, width and height values.
29
30\func{}{wxRect}{\param{const wxPoint\&}{ topLeft}, \param{const wxPoint\&}{ bottomRight}}
31
32Creates a wxRect object from top-left and bottom-right points.
33
34\func{}{wxRect}{\param{const wxPoint\&}{ pos}, \param{const wxSize\&}{ size}}
35
36Creates a wxRect object from position and size values.
37
8d8fbb9d
WS
38\func{}{wxRect}{\param{const wxSize\&}{ size}}
39
40Creates a wxRect object from size values at the origin.
41
df83b840 42
39275175 43\membersection{wxRect::x}\label{wxrectx}
a660d684
KB
44
45\member{int}{x}
46
f6bcfd97 47x coordinate of the top-level corner of the rectangle.
a660d684 48
df83b840 49
39275175 50\membersection{wxRect::y}\label{wxrecty}
a660d684
KB
51
52\member{int}{y}
53
f6bcfd97 54y coordinate of the top-level corner of the rectangle.
a660d684 55
df83b840 56
39275175 57\membersection{wxRect::width}\label{wxrectwidth}
a660d684
KB
58
59\member{int}{width}
60
61Width member.
62
df83b840 63
39275175 64\membersection{wxRect::height}\label{wxrectheight}
a660d684
KB
65
66\member{int}{height}
67
68Height member.
69
df83b840 70
1bfb73b8
VZ
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
77Returns the rectangle having the same size as this one but centered relatively
78to the given rectangle \arg{r}. By default, rectangle is centred in both
79directions but if \arg{dir} includes only \texttt{wxVERTICAL} or only
80\texttt{wxHORIZONTAL} flag, then it is only centered in this direction while
81the other component of its position remains unchanged.
82
83
23621b35
VS
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
90Returns {\tt true} if the given point is inside the rectangle (or on its
91boundary) and {\tt false} otherwise.
92
93\constfunc{bool}{Contains}{\param{const wxRect\& }{rect}}
94
95Returns \true if the given rectangle is completely inside this rectangle
96(or touches its boundary) and \false otherwise.
97
98
f4c43a17
VZ
99\membersection{wxRect::Deflate}\label{wxrectdeflate}
100
101\func{void}{Deflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
102
c2c4d939
VZ
103\func{void}{Deflate}{\param{const wxSize\& }{diff}}
104
f4c43a17
VZ
105\func{void}{Deflate}{\param{wxCoord }{diff}}
106
107\constfunc{wxRect}{Deflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
108
8673a125 109Decrease the rectangle size.
f4c43a17 110
8673a125
VZ
111This method is the opposite from \helpref{Inflate}{wxrectinflate}:
112Deflate(a, b) is equivalent to Inflate(-a, -b).
113Please refer to \helpref{Inflate}{wxrectinflate} for full description.
f4c43a17
VZ
114
115\wxheading{See also}
116
117\helpref{Inflate}{wxrectinflate}
118
df83b840 119
a660d684
KB
120\membersection{wxRect::GetBottom}\label{wxrectgetbottom}
121
122\constfunc{int}{GetBottom}{\void}
123
124Gets the bottom point of the rectangle.
125
df83b840 126
a660d684
KB
127\membersection{wxRect::GetHeight}\label{wxrectgetheight}
128
129\constfunc{int}{GetHeight}{\void}
130
131Gets the height member.
132
df83b840 133
a660d684
KB
134\membersection{wxRect::GetLeft}\label{wxrectgetleft}
135
136\constfunc{int}{GetLeft}{\void}
137
138Gets the left point of the rectangle (the same as \helpref{wxRect::GetX}{wxrectgetx}).
139
df83b840 140
a660d684
KB
141\membersection{wxRect::GetPosition}\label{wxrectgetposition}
142
143\constfunc{wxPoint}{GetPosition}{\void}
144
145Gets the position.
146
df83b840 147
355a5e2b
JS
148\membersection{wxRect::GetTopLeft}\label{wxrectgettopleft}
149
150\constfunc{wxPoint}{GetTopLeft}{\void}
151
f790ec82
VZ
152Gets 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
160Gets the position of the top right corner.
161
162
163\membersection{wxRect::GetBottomLeft}\label{wxrectgetbottomleft}
164
165\constfunc{wxPoint}{GetBottomLeft}{\void}
166
167Gets the position of the bottom left corner.
355a5e2b 168
df83b840 169
355a5e2b
JS
170\membersection{wxRect::GetBottomRight}\label{wxrectgetbottomright}
171
172\constfunc{wxPoint}{GetBottomRight}{\void}
173
f790ec82 174Gets the position of the bottom right corner.
355a5e2b 175
df83b840 176
a660d684
KB
177\membersection{wxRect::GetRight}\label{wxrectgetright}
178
179\constfunc{int}{GetRight}{\void}
180
181Gets the right point of the rectangle.
182
df83b840 183
a660d684
KB
184\membersection{wxRect::GetSize}\label{wxrectgetsize}
185
186\constfunc{wxSize}{GetSize}{\void}
187
188Gets the size.
189
f050223c
WS
190\wxheading{See also}
191
192\helpref{wxRect::SetSize}{wxrectsetsize}
193
df83b840 194
a660d684
KB
195\membersection{wxRect::GetTop}\label{wxrectgettop}
196
197\constfunc{int}{GetTop}{\void}
198
199Gets the top point of the rectangle (the same as \helpref{wxRect::GetY}{wxrectgety}).
200
df83b840 201
a660d684
KB
202\membersection{wxRect::GetWidth}\label{wxrectgetwidth}
203
204\constfunc{int}{GetWidth}{\void}
205
206Gets the width member.
207
df83b840 208
a660d684
KB
209\membersection{wxRect::GetX}\label{wxrectgetx}
210
211\constfunc{int}{GetX}{\void}
212
213Gets the x member.
214
df83b840 215
a660d684
KB
216\membersection{wxRect::GetY}\label{wxrectgety}
217
218\constfunc{int}{GetY}{\void}
219
220Gets the y member.
221
df83b840 222
45816ddd
VZ
223\membersection{wxRect::Inflate}\label{wxrectinflate}
224
225\func{void}{Inflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
226
c2c4d939
VZ
227\func{void}{Inflate}{\param{const wxSize\& }{diff}}
228
45816ddd
VZ
229\func{void}{Inflate}{\param{wxCoord }{diff}}
230
f4c43a17
VZ
231\constfunc{wxRect}{Inflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
232
8673a125 233Increases the size of the rectangle.
45816ddd
VZ
234
235The second form uses the same {\it diff} for both {\it dx} and {\it dy}.
236
f4c43a17
VZ
237The first two versions modify the rectangle in place, the last one returns a
238new rectangle leaving this one unchanged.
239
8673a125
VZ
240The left border is moved farther left and the right border is moved farther
241right by {\it dx}. The upper border is moved farther up and the bottom border
242is moved farther down by {\it dy}. (Note the the width and height of the
243rectangle thus change by 2*{\it dx} and 2*{\it dy}, respectively.) If one or
244both of {\it dx} and {\it dy} are negative, the opposite happens: the rectangle
245size decreases in the respective direction.
246
247Inflating and deflating behaves ``naturally''. Defined more precisely, that
248means:
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
f4c43a17
VZ
266\wxheading{See also}
267
268\helpref{Deflate}{wxrectdeflate}
269
df83b840 270
c0f62256 271\membersection{wxRect::Intersects}\label{wxrectintersects}
f4c43a17
VZ
272
273\constfunc{bool}{Intersects}{\param{const wxRect\& }{rect}}
274
154b6b0f 275Returns {\tt true} if this rectangle has a non-empty intersection with the
cc81d32f 276rectangle {\it rect} and {\tt false} otherwise.
f4c43a17 277
df83b840 278
b737ad10
RR
279\membersection{wxRect::IsEmpty}\label{wxrectisempty}
280
281\constfunc{bool}{IsEmpty}{}
282
283Returns {\tt true} if this rectangle has a width or height less than or equal to
2840 and {\tt false} otherwise.
285
286
f4c43a17
VZ
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
293Moves the rectangle by the specified offset. If {\it dx} is positive, the
294rectangle is moved to the right, if {\it dy} is positive, it is moved to the
295bottom, otherwise it is moved to the left or top respectively.
296
df83b840 297
a660d684
KB
298\membersection{wxRect::SetHeight}\label{wxrectsetheight}
299
eaaa6a06 300\func{void}{SetHeight}{\param{int}{ height}}
a660d684
KB
301
302Sets the height.
303
df83b840 304
f050223c
WS
305\membersection{wxRect::SetSize}\label{wxrectsetsize}
306
307\func{void}{SetSize}{\param{const wxSize\&}{ s}}
308
309Sets the size.
310
311\wxheading{See also}
312
313\helpref{wxRect::GetSize}{wxrectgetsize}
314
315
a660d684
KB
316\membersection{wxRect::SetWidth}\label{wxrectsetwidth}
317
eaaa6a06 318\func{void}{SetWidth}{\param{int}{ width}}
a660d684
KB
319
320Sets the width.
321
df83b840 322
a660d684
KB
323\membersection{wxRect::SetX}\label{wxrectsetx}
324
eaaa6a06 325\func{void}{SetX}{\param{int}{ x}}
a660d684
KB
326
327Sets the x position.
328
df83b840 329
a660d684
KB
330\membersection{wxRect::SetY}\label{wxrectsety}
331
eaaa6a06 332\func{void}{SetY}{\param{int}{ y}}
a660d684
KB
333
334Sets the y position.
335
df83b840
VZ
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
343Modifies the rectangle to contain the bounding box of this rectangle and the
344one passed in as parameter. The const version returns the new rectangle, the
345other one modifies this rectangle in place.
346
347
39275175 348\membersection{wxRect::operator $=$}\label{wxrectassign}
a660d684
KB
349
350\func{void}{operator $=$}{\param{const wxRect\& }{rect}}
351
352Assignment operator.
353
df83b840 354
39275175 355\membersection{wxRect::operator $==$}\label{wxrectequal}
a660d684
KB
356
357\func{bool}{operator $==$}{\param{const wxRect\& }{rect}}
358
359Equality operator.
360
df83b840 361
39275175 362\membersection{wxRect::operator $!=$}\label{wxrectnotequal}
a660d684
KB
363
364\func{bool}{operator $!=$}{\param{const wxRect\& }{rect}}
365
366Inequality operator.
367