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