1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
|
\section{\class{wxRect}}\label{wxrect}
A class for manipulating rectangles.
\wxheading{Derived from}
None
\wxheading{Include files}
<wx/gdicmn.h>
\wxheading{See also}
\helpref{wxPoint}{wxpoint}, \helpref{wxSize}{wxsize}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxRect::wxRect}\label{wxrectctor}
\func{}{wxRect}{\void}
Default constructor.
\func{}{wxRect}{\param{int}{ x}, \param{int}{ y}, \param{int}{ width}, \param{int}{ height}}
Creates a wxRect object from x, y, width and height values.
\func{}{wxRect}{\param{const wxPoint\&}{ topLeft}, \param{const wxPoint\&}{ bottomRight}}
Creates a wxRect object from top-left and bottom-right points.
\func{}{wxRect}{\param{const wxPoint\&}{ pos}, \param{const wxSize\&}{ size}}
Creates a wxRect object from position and size values.
\func{}{wxRect}{\param{const wxSize\&}{ size}}
Creates a wxRect object from size values at the origin.
\membersection{wxRect::x}\label{wxrectx}
\member{int}{x}
x coordinate of the top-level corner of the rectangle.
\membersection{wxRect::y}\label{wxrecty}
\member{int}{y}
y coordinate of the top-level corner of the rectangle.
\membersection{wxRect::width}\label{wxrectwidth}
\member{int}{width}
Width member.
\membersection{wxRect::height}\label{wxrectheight}
\member{int}{height}
Height member.
\membersection{wxRect::CentreIn}\label{wxrectcentrein}
\constfunc{wxRect}{CentreIn}{\param{const wxRect\& }{r}, \param{int }{dir = wxBOTH}}
\constfunc{wxRect}{CenterIn}{\param{const wxRect\& }{r}, \param{int }{dir = wxBOTH}}
Returns the rectangle having the same size as this one but centered relatively
to the given rectangle \arg{r}. By default, rectangle is centred in both
directions but if \arg{dir} includes only \texttt{wxVERTICAL} or only
\texttt{wxHORIZONTAL} flag, then it is only centered in this direction while
the other component of its position remains unchanged.
\membersection{wxRect::Contains}\label{wxrectcontains}
\constfunc{bool}{Contains}{\param{int }{x}, \param{int }{y}}
\constfunc{bool}{Contains}{\param{const wxPoint\& }{pt}}
Returns {\tt true} if the given point is inside the rectangle (or on its
boundary) and {\tt false} otherwise.
\constfunc{bool}{Contains}{\param{const wxRect\& }{rect}}
Returns \true if the given rectangle is completely inside this rectangle
(or touches its boundary) and \false otherwise.
\membersection{wxRect::Deflate}\label{wxrectdeflate}
\func{void}{Deflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
\func{void}{Deflate}{\param{const wxSize\& }{diff}}
\func{void}{Deflate}{\param{wxCoord }{diff}}
\constfunc{wxRect}{Deflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
Decrease the rectangle size.
This method is the opposite from \helpref{Inflate}{wxrectinflate}:
Deflate(a, b) is equivalent to Inflate(-a, -b).
Please refer to \helpref{Inflate}{wxrectinflate} for full description.
\wxheading{See also}
\helpref{Inflate}{wxrectinflate}
\membersection{wxRect::GetBottom}\label{wxrectgetbottom}
\constfunc{int}{GetBottom}{\void}
Gets the bottom point of the rectangle.
\membersection{wxRect::GetHeight}\label{wxrectgetheight}
\constfunc{int}{GetHeight}{\void}
Gets the height member.
\membersection{wxRect::GetLeft}\label{wxrectgetleft}
\constfunc{int}{GetLeft}{\void}
Gets the left point of the rectangle (the same as \helpref{wxRect::GetX}{wxrectgetx}).
\membersection{wxRect::GetPosition}\label{wxrectgetposition}
\constfunc{wxPoint}{GetPosition}{\void}
Gets the position.
\membersection{wxRect::GetTopLeft}\label{wxrectgettopleft}
\constfunc{wxPoint}{GetTopLeft}{\void}
Gets the position of the top left corner of the rectangle, same as
\helpref{GetPosition}{wxrectgetposition}.
\membersection{wxRect::GetTopRight}\label{wxrectgettopright}
\constfunc{wxPoint}{GetTopRight}{\void}
Gets the position of the top right corner.
\membersection{wxRect::GetBottomLeft}\label{wxrectgetbottomleft}
\constfunc{wxPoint}{GetBottomLeft}{\void}
Gets the position of the bottom left corner.
\membersection{wxRect::GetBottomRight}\label{wxrectgetbottomright}
\constfunc{wxPoint}{GetBottomRight}{\void}
Gets the position of the bottom right corner.
\membersection{wxRect::GetRight}\label{wxrectgetright}
\constfunc{int}{GetRight}{\void}
Gets the right point of the rectangle.
\membersection{wxRect::GetSize}\label{wxrectgetsize}
\constfunc{wxSize}{GetSize}{\void}
Gets the size.
\wxheading{See also}
\helpref{wxRect::SetSize}{wxrectsetsize}
\membersection{wxRect::GetTop}\label{wxrectgettop}
\constfunc{int}{GetTop}{\void}
Gets the top point of the rectangle (the same as \helpref{wxRect::GetY}{wxrectgety}).
\membersection{wxRect::GetWidth}\label{wxrectgetwidth}
\constfunc{int}{GetWidth}{\void}
Gets the width member.
\membersection{wxRect::GetX}\label{wxrectgetx}
\constfunc{int}{GetX}{\void}
Gets the x member.
\membersection{wxRect::GetY}\label{wxrectgety}
\constfunc{int}{GetY}{\void}
Gets the y member.
\membersection{wxRect::Inflate}\label{wxrectinflate}
\func{void}{Inflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
\func{void}{Inflate}{\param{const wxSize\& }{diff}}
\func{void}{Inflate}{\param{wxCoord }{diff}}
\constfunc{wxRect}{Inflate}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
Increases the size of the rectangle.
The second form uses the same {\it diff} for both {\it dx} and {\it dy}.
The first two versions modify the rectangle in place, the last one returns a
new rectangle leaving this one unchanged.
The left border is moved farther left and the right border is moved farther
right by {\it dx}. The upper border is moved farther up and the bottom border
is moved farther down by {\it dy}. (Note the the width and height of the
rectangle thus change by 2*{\it dx} and 2*{\it dy}, respectively.) If one or
both of {\it dx} and {\it dy} are negative, the opposite happens: the rectangle
size decreases in the respective direction.
Inflating and deflating behaves ``naturally''. Defined more precisely, that
means:
\begin{enumerate}
\item ``Real'' inflates (that is, {\it dx} and/or {\it dy} >= 0) are not
constrained. Thus inflating a rectangle can cause its upper left corner
to move into the negative numbers. (the versions prior to 2.5.4 forced
the top left coordinate to not fall below (0, 0), which implied a
forced move of the rectangle.)
\item Deflates are clamped to not reduce the width or height of the
rectangle below zero. In such cases, the top-left corner is nonetheless
handled properly. For example, a rectangle at (10, 10) with size (20,
40) that is inflated by (-15, -15) will become located at (20, 25) at
size (0, 10). Finally, observe that the width and height are treated
independently. In the above example, the width is reduced by 20,
whereas the height is reduced by the full 30 (rather than also stopping
at 20, when the width reached zero).
\end{enumerate}
\wxheading{See also}
\helpref{Deflate}{wxrectdeflate}
\membersection{wxRect::Intersect}\label{wxrectintersect}
\constfunc{wxRect}{Intersect}{\param{const wxRect\& }{rect}}
\func{wxRect\&}{Intersect}{\param{const wxRect\& }{rect}}
Modifies the rectangle to contain the overlapping box of this rectangle and the
one passed in as parameter. The const version returns the new rectangle, the
other one modifies this rectangle in place.
\membersection{wxRect::Intersects}\label{wxrectintersects}
\constfunc{bool}{Intersects}{\param{const wxRect\& }{rect}}
Returns {\tt true} if this rectangle has a non-empty intersection with the
rectangle {\it rect} and {\tt false} otherwise.
\membersection{wxRect::IsEmpty}\label{wxrectisempty}
\constfunc{bool}{IsEmpty}{}
Returns {\tt true} if this rectangle has a width or height less than or equal to
0 and {\tt false} otherwise.
\membersection{wxRect::Offset}\label{wxrectoffset}
\func{void}{Offset}{\param{wxCoord }{dx}, \param{wxCoord }{dy}}
\func{void}{Offset}{\param{const wxPoint\& }{pt}}
Moves the rectangle by the specified offset. If {\it dx} is positive, the
rectangle is moved to the right, if {\it dy} is positive, it is moved to the
bottom, otherwise it is moved to the left or top respectively.
\membersection{wxRect::SetHeight}\label{wxrectsetheight}
\func{void}{SetHeight}{\param{int}{ height}}
Sets the height.
\membersection{wxRect::SetSize}\label{wxrectsetsize}
\func{void}{SetSize}{\param{const wxSize\&}{ s}}
Sets the size.
\wxheading{See also}
\helpref{wxRect::GetSize}{wxrectgetsize}
\membersection{wxRect::SetWidth}\label{wxrectsetwidth}
\func{void}{SetWidth}{\param{int}{ width}}
Sets the width.
\membersection{wxRect::SetX}\label{wxrectsetx}
\func{void}{SetX}{\param{int}{ x}}
Sets the x position.
\membersection{wxRect::SetY}\label{wxrectsety}
\func{void}{SetY}{\param{int}{ y}}
Sets the y position.
\membersection{wxRect::Union}\label{wxrectunion}
\constfunc{wxRect}{Union}{\param{const wxRect\&}{ rect}}
\func{wxRect\&}{Union}{\param{const wxRect\&}{ rect}}
Modifies the rectangle to contain the bounding box of this rectangle and the
one passed in as parameter. The const version returns the new rectangle, the
other one modifies this rectangle in place.
\membersection{wxRect::operator $=$}\label{wxrectassign}
\func{void}{operator $=$}{\param{const wxRect\& }{rect}}
Assignment operator.
\membersection{wxRect::operator $==$}\label{wxrectequal}
\func{bool}{operator $==$}{\param{const wxRect\& }{rect}}
Equality operator.
\membersection{wxRect::operator $!=$}\label{wxrectnotequal}
\func{bool}{operator $!=$}{\param{const wxRect\& }{rect}}
Inequality operator.
|