]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxRect}}\label{wxrect} |
2 | ||
3 | A class for manipulating rectangles. | |
4 | ||
5 | \wxheading{Derived from} | |
6 | ||
9838df2c | 7 | None |
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 | ||
24 | Default constructor. | |
25 | ||
eaaa6a06 | 26 | \func{}{wxRect}{\param{int}{ x}, \param{int}{ y}, \param{int}{ width}, \param{int}{ height}} |
a660d684 KB |
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 | ||
8d8fbb9d WS |
38 | \func{}{wxRect}{\param{const wxSize\&}{ size}} |
39 | ||
40 | Creates 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 | 47 | x 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 | 54 | y 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 | ||
61 | Width member. | |
62 | ||
df83b840 | 63 | |
39275175 | 64 | \membersection{wxRect::height}\label{wxrectheight} |
a660d684 KB |
65 | |
66 | \member{int}{height} | |
67 | ||
68 | Height 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 | 79 | Decrease the rectangle size. |
f4c43a17 | 80 | |
8673a125 VZ |
81 | This method is the opposite from \helpref{Inflate}{wxrectinflate}: |
82 | Deflate(a, b) is equivalent to Inflate(-a, -b). | |
83 | Please 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 | ||
94 | Gets the bottom point of the rectangle. | |
95 | ||
df83b840 | 96 | |
a660d684 KB |
97 | \membersection{wxRect::GetHeight}\label{wxrectgetheight} |
98 | ||
99 | \constfunc{int}{GetHeight}{\void} | |
100 | ||
101 | Gets the height member. | |
102 | ||
df83b840 | 103 | |
a660d684 KB |
104 | \membersection{wxRect::GetLeft}\label{wxrectgetleft} |
105 | ||
106 | \constfunc{int}{GetLeft}{\void} | |
107 | ||
108 | Gets 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 | ||
115 | Gets the position. | |
116 | ||
df83b840 | 117 | |
355a5e2b JS |
118 | \membersection{wxRect::GetTopLeft}\label{wxrectgettopleft} |
119 | ||
120 | \constfunc{wxPoint}{GetTopLeft}{\void} | |
121 | ||
122 | Gets 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 | ||
129 | Gets 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 | ||
136 | Gets the right point of the rectangle. | |
137 | ||
df83b840 | 138 | |
a660d684 KB |
139 | \membersection{wxRect::GetSize}\label{wxrectgetsize} |
140 | ||
141 | \constfunc{wxSize}{GetSize}{\void} | |
142 | ||
143 | Gets the size. | |
144 | ||
df83b840 | 145 | |
a660d684 KB |
146 | \membersection{wxRect::GetTop}\label{wxrectgettop} |
147 | ||
148 | \constfunc{int}{GetTop}{\void} | |
149 | ||
150 | Gets the top point of the rectangle (the same as \helpref{wxRect::GetY}{wxrectgety}). | |
151 | ||
df83b840 | 152 | |
a660d684 KB |
153 | \membersection{wxRect::GetWidth}\label{wxrectgetwidth} |
154 | ||
155 | \constfunc{int}{GetWidth}{\void} | |
156 | ||
157 | Gets the width member. | |
158 | ||
df83b840 | 159 | |
a660d684 KB |
160 | \membersection{wxRect::GetX}\label{wxrectgetx} |
161 | ||
162 | \constfunc{int}{GetX}{\void} | |
163 | ||
164 | Gets the x member. | |
165 | ||
df83b840 | 166 | |
a660d684 KB |
167 | \membersection{wxRect::GetY}\label{wxrectgety} |
168 | ||
169 | \constfunc{int}{GetY}{\void} | |
170 | ||
171 | Gets the y member. | |
172 | ||
df83b840 | 173 | |
45816ddd VZ |
174 | \membersection{wxRect::Inflate}\label{wxrectinflate} |
175 | ||
176 | \func{void}{Inflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}} | |
177 | ||
178 | \func{void}{Inflate}{\param{wxCoord }{diff}} | |
179 | ||
f4c43a17 VZ |
180 | \constfunc{wxRect}{Inflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}} |
181 | ||
8673a125 | 182 | Increases the size of the rectangle. |
45816ddd VZ |
183 | |
184 | The second form uses the same {\it diff} for both {\it dx} and {\it dy}. | |
185 | ||
f4c43a17 VZ |
186 | The first two versions modify the rectangle in place, the last one returns a |
187 | new rectangle leaving this one unchanged. | |
188 | ||
8673a125 VZ |
189 | The left border is moved farther left and the right border is moved farther |
190 | right by {\it dx}. The upper border is moved farther up and the bottom border | |
191 | is moved farther down by {\it dy}. (Note the the width and height of the | |
192 | rectangle thus change by 2*{\it dx} and 2*{\it dy}, respectively.) If one or | |
193 | both of {\it dx} and {\it dy} are negative, the opposite happens: the rectangle | |
194 | size decreases in the respective direction. | |
195 | ||
196 | Inflating and deflating behaves ``naturally''. Defined more precisely, that | |
197 | means: | |
198 | \begin{enumerate} | |
199 | \item ``Real'' inflates (that is, {\it dx} and/or {\it dy} >= 0) are not | |
200 | constrained. Thus inflating a rectangle can cause its upper left corner | |
201 | to move into the negative numbers. (the versions prior to 2.5.4 forced | |
202 | the top left coordinate to not fall below (0, 0), which implied a | |
203 | forced move of the rectangle.) | |
204 | ||
205 | \item Deflates are clamped to not reduce the width or height of the | |
206 | rectangle below zero. In such cases, the top-left corner is nonetheless | |
207 | handled properly. For example, a rectangle at (10, 10) with size (20, | |
208 | 40) that is inflated by (-15, -15) will become located at (20, 25) at | |
209 | size (0, 10). Finally, observe that the width and height are treated | |
210 | independently. In the above example, the width is reduced by 20, | |
211 | whereas the height is reduced by the full 30 (rather than also stopping | |
212 | at 20, when the width reached zero). | |
213 | \end{enumerate} | |
214 | ||
f4c43a17 VZ |
215 | \wxheading{See also} |
216 | ||
217 | \helpref{Deflate}{wxrectdeflate} | |
218 | ||
df83b840 | 219 | |
c0f62256 | 220 | \membersection{wxRect::Inside}\label{wxrectinside} |
f4c43a17 VZ |
221 | |
222 | \constfunc{bool}{Inside}{\param{int }{x}, \param{int }{y}} | |
223 | ||
224 | \constfunc{bool}{Inside}{\param{const wxPoint\& }{pt}} | |
225 | ||
cc81d32f VS |
226 | Returns {\tt true} if the given point is inside the rectangle (or on its |
227 | boundary) and {\tt false} otherwise. | |
f4c43a17 | 228 | |
df83b840 | 229 | |
c0f62256 | 230 | \membersection{wxRect::Intersects}\label{wxrectintersects} |
f4c43a17 VZ |
231 | |
232 | \constfunc{bool}{Intersects}{\param{const wxRect\& }{rect}} | |
233 | ||
cc81d32f VS |
234 | Returns {\tt true} if this rectangle has a non empty intersection with the |
235 | rectangle {\it rect} and {\tt false} otherwise. | |
f4c43a17 | 236 | |
df83b840 | 237 | |
f4c43a17 VZ |
238 | \membersection{wxRect::Offset}\label{wxrectoffset} |
239 | ||
240 | \func{void}{Offset}{\param{wxCoord }{dx}, \param{wxCoord }{dy}} | |
241 | ||
242 | \func{void}{Offset}{\param{const wxPoint\& }{pt}} | |
243 | ||
244 | Moves the rectangle by the specified offset. If {\it dx} is positive, the | |
245 | rectangle is moved to the right, if {\it dy} is positive, it is moved to the | |
246 | bottom, otherwise it is moved to the left or top respectively. | |
247 | ||
df83b840 | 248 | |
a660d684 KB |
249 | \membersection{wxRect::SetHeight}\label{wxrectsetheight} |
250 | ||
eaaa6a06 | 251 | \func{void}{SetHeight}{\param{int}{ height}} |
a660d684 KB |
252 | |
253 | Sets the height. | |
254 | ||
df83b840 | 255 | |
a660d684 KB |
256 | \membersection{wxRect::SetWidth}\label{wxrectsetwidth} |
257 | ||
eaaa6a06 | 258 | \func{void}{SetWidth}{\param{int}{ width}} |
a660d684 KB |
259 | |
260 | Sets the width. | |
261 | ||
df83b840 | 262 | |
a660d684 KB |
263 | \membersection{wxRect::SetX}\label{wxrectsetx} |
264 | ||
eaaa6a06 | 265 | \func{void}{SetX}{\param{int}{ x}} |
a660d684 KB |
266 | |
267 | Sets the x position. | |
268 | ||
df83b840 | 269 | |
a660d684 KB |
270 | \membersection{wxRect::SetY}\label{wxrectsety} |
271 | ||
eaaa6a06 | 272 | \func{void}{SetY}{\param{int}{ y}} |
a660d684 KB |
273 | |
274 | Sets the y position. | |
275 | ||
df83b840 VZ |
276 | |
277 | \membersection{wxRect::Union}\label{wxrectunion} | |
278 | ||
279 | \constfunc{wxRect}{Union}{\param{const wxRect\&}{ rect}} | |
280 | ||
281 | \func{wxRect\&}{Union}{\param{const wxRect\&}{ rect}} | |
282 | ||
283 | Modifies the rectangle to contain the bounding box of this rectangle and the | |
284 | one passed in as parameter. The const version returns the new rectangle, the | |
285 | other one modifies this rectangle in place. | |
286 | ||
287 | ||
39275175 | 288 | \membersection{wxRect::operator $=$}\label{wxrectassign} |
a660d684 KB |
289 | |
290 | \func{void}{operator $=$}{\param{const wxRect\& }{rect}} | |
291 | ||
292 | Assignment operator. | |
293 | ||
df83b840 | 294 | |
39275175 | 295 | \membersection{wxRect::operator $==$}\label{wxrectequal} |
a660d684 KB |
296 | |
297 | \func{bool}{operator $==$}{\param{const wxRect\& }{rect}} | |
298 | ||
299 | Equality operator. | |
300 | ||
df83b840 | 301 | |
39275175 | 302 | \membersection{wxRect::operator $!=$}\label{wxrectnotequal} |
a660d684 KB |
303 | |
304 | \func{bool}{operator $!=$}{\param{const wxRect\& }{rect}} | |
305 | ||
306 | Inequality operator. | |
307 |