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