ReactOS 0.4.15-dev-8116-gf69e256
CRect Class Reference

#include <atltypes.h>

Inheritance diagram for CRect:
Collaboration diagram for CRect:

Public Member Functions

 CRect () noexcept
 
 CRect (int l, int t, int r, int b) noexcept
 
 CRect (const RECT &srcRect) noexcept
 
 CRect (LPCRECT lpSrcRect) noexcept
 
 CRect (POINT point, SIZE size) noexcept
 
 CRect (POINT topLeft, POINT bottomRight) noexcept
 
CPointBottomRight () noexcept
 
const CPointBottomRight () const noexcept
 
CPoint CenterPoint () const noexcept
 
void CopyRect (LPCRECT lpSrcRect) noexcept
 
void DeflateRect (int x, int y) noexcept
 
void DeflateRect (SIZE size) noexcept
 
void DeflateRect (LPCRECT lpRect) noexcept
 
void DeflateRect (int l, int t, int r, int b) noexcept
 
BOOL EqualRect (LPCRECT lpRect) const noexcept
 
int Height () const noexcept
 
void InflateRect (int x, int y) noexcept
 
void InflateRect (SIZE size) noexcept
 
void InflateRect (LPCRECT lpRect) noexcept
 
void InflateRect (int l, int t, int r, int b) noexcept
 
BOOL IntersectRect (LPCRECT lpRect1, LPCRECT lpRect2) noexcept
 
BOOL IsRectEmpty () const noexcept
 
BOOL IsRectNull () const noexcept
 
void MoveToX (int x) noexcept
 
void MoveToY (int y) noexcept
 
void MoveToXY (int x, int y) noexcept
 
void MoveToXY (POINT point) noexcept
 
void NormalizeRect () noexcept
 
void OffsetRect (int x, int y) noexcept
 
void OffsetRect (POINT point) noexcept
 
void OffsetRect (SIZE size) noexcept
 
BOOL PtInRect (POINT point) const noexcept
 
void SetRect (int x1, int y1, int x2, int y2) noexcept
 
void SetRectEmpty () noexcept
 
CSize Size () const noexcept
 
BOOL SubtractRect (LPCRECT lpRectSrc1, LPCRECT lpRectSrc2) noexcept
 
CPointTopLeft () noexcept
 
const CPointTopLeft () const noexcept
 
BOOL UnionRect (LPCRECT lpRect1, LPCRECT lpRect2) noexcept
 
int Width () const noexcept
 
BOOL operator== (const RECT &rect) const noexcept
 
BOOL operator!= (const RECT &rect) const noexcept
 
void operator= (const RECT &srcRect) noexcept
 
void operator+= (POINT point) noexcept
 
void operator+= (SIZE size) noexcept
 
void operator+= (LPCRECT lpRect) noexcept
 
void operator-= (POINT point) noexcept
 
void operator-= (SIZE size) noexcept
 
void operator-= (LPCRECT lpRect) noexcept
 
CRect operator+ (POINT point) const noexcept
 
CRect operator+ (LPCRECT lpRect) const noexcept
 
CRect operator+ (SIZE size) const noexcept
 
CRect operator- (POINT point) const noexcept
 
CRect operator- (SIZE size) const noexcept
 
CRect operator- (LPCRECT lpRect) const noexcept
 
void operator&= (const RECT &rect) noexcept
 
CRect operator& (const RECT &rect2) const noexcept
 
void operator|= (const RECT &rect) noexcept
 
CRect operator| (const RECT &rect2) const noexcept
 
 operator LPRECT () noexcept
 
 operator LPCRECT () const noexcept
 

Additional Inherited Members

- Public Attributes inherited from tagRECT
LONG left
 
LONG top
 
LONG right
 
LONG bottom
 

Detailed Description

Definition at line 221 of file atltypes.h.

Constructor & Destructor Documentation

◆ CRect() [1/6]

CRect::CRect ( )
inlinenoexcept

Definition at line 224 of file atltypes.h.

225 {
226 left = top = right = bottom = 0;
227 }
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLint GLint bottom
Definition: glext.h:7726

◆ CRect() [2/6]

CRect::CRect ( int  l,
int  t,
int  r,
int  b 
)
inlinenoexcept

Definition at line 229 of file atltypes.h.

230 {
231 left = l;
232 top = t;
233 right = r;
234 bottom = b;
235 }
r l[0]
Definition: byte_order.h:168
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble t
Definition: gl.h:2047
#define b
Definition: ke_i.h:79

◆ CRect() [3/6]

CRect::CRect ( const RECT srcRect)
inlinenoexcept

Definition at line 237 of file atltypes.h.

238 {
239 left = srcRect.left;
240 top = srcRect.top;
241 right = srcRect.right;
242 bottom = srcRect.bottom;
243 }
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306

◆ CRect() [4/6]

CRect::CRect ( LPCRECT  lpSrcRect)
inlinenoexcept

Definition at line 245 of file atltypes.h.

246 {
247 left = lpSrcRect->left;
248 top = lpSrcRect->top;
249 right = lpSrcRect->right;
250 bottom = lpSrcRect->bottom;
251 }

◆ CRect() [5/6]

CRect::CRect ( POINT  point,
SIZE  size 
)
inlinenoexcept

Definition at line 253 of file atltypes.h.

254 {
255 left = point.x;
256 top = point.y;
257 right = point.x + size.cx;
258 bottom = point.y + size.cy;
259 }
POINTL point
Definition: edittest.c:50
GLsizeiptr size
Definition: glext.h:5919
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329

◆ CRect() [6/6]

CRect::CRect ( POINT  topLeft,
POINT  bottomRight 
)
inlinenoexcept

Definition at line 261 of file atltypes.h.

262 {
263 left = topLeft.x;
264 top = topLeft.y;
265 right = bottomRight.x;
266 bottom = bottomRight.y;
267 }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48

Member Function Documentation

◆ BottomRight() [1/2]

const CPoint & CRect::BottomRight ( ) const
inlinenoexcept

Definition at line 274 of file atltypes.h.

275 {
276 return ((const CPoint*)this)[1];
277 }

◆ BottomRight() [2/2]

CPoint & CRect::BottomRight ( )
inlinenoexcept

Definition at line 269 of file atltypes.h.

270 {
271 return ((CPoint*)this)[1];
272 }

◆ CenterPoint()

CPoint CRect::CenterPoint ( ) const
inlinenoexcept

Definition at line 279 of file atltypes.h.

280 {
281 return CPoint(left + (Width() >> 1), top + (Height() >> 1));
282 }
int Width() const noexcept
Definition: atltypes.h:461
int Height() const noexcept
Definition: atltypes.h:318

◆ CopyRect()

void CRect::CopyRect ( LPCRECT  lpSrcRect)
inlinenoexcept

Definition at line 284 of file atltypes.h.

285 {
286 ::CopyRect(this, lpSrcRect);
287 }
void CopyRect(LPCRECT lpSrcRect) noexcept
Definition: atltypes.h:284

Referenced by CopyRect(), and test_CRect().

◆ DeflateRect() [1/4]

void CRect::DeflateRect ( int  l,
int  t,
int  r,
int  b 
)
inlinenoexcept

Definition at line 304 of file atltypes.h.

305 {
306 left += l;
307 top += t;
308 right -= r;
309 bottom -= b;
310 }

◆ DeflateRect() [2/4]

void CRect::DeflateRect ( int  x,
int  y 
)
inlinenoexcept

Definition at line 289 of file atltypes.h.

290 {
291 ::InflateRect(this, -x, -y);
292 }
void InflateRect(int x, int y) noexcept
Definition: atltypes.h:323
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by DeflateRect(), and operator-=().

◆ DeflateRect() [3/4]

void CRect::DeflateRect ( LPCRECT  lpRect)
inlinenoexcept

Definition at line 299 of file atltypes.h.

300 {
301 DeflateRect(lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
302 }
void DeflateRect(int x, int y) noexcept
Definition: atltypes.h:289

◆ DeflateRect() [4/4]

void CRect::DeflateRect ( SIZE  size)
inlinenoexcept

Definition at line 294 of file atltypes.h.

295 {
296 ::InflateRect(this, -size.cx, -size.cy);
297 }

◆ EqualRect()

BOOL CRect::EqualRect ( LPCRECT  lpRect) const
inlinenoexcept

Definition at line 312 of file atltypes.h.

313 {
314 return ::EqualRect(this, lpRect);
315 }

Referenced by SelectionModel::Landing(), and test_CRect().

◆ Height()

◆ InflateRect() [1/4]

void CRect::InflateRect ( int  l,
int  t,
int  r,
int  b 
)
inlinenoexcept

Definition at line 338 of file atltypes.h.

339 {
340 left -= l;
341 top -= t;
342 right += r;
343 bottom += b;
344 }

◆ InflateRect() [2/4]

◆ InflateRect() [3/4]

void CRect::InflateRect ( LPCRECT  lpRect)
inlinenoexcept

Definition at line 333 of file atltypes.h.

334 {
335 InflateRect(lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
336 }

◆ InflateRect() [4/4]

void CRect::InflateRect ( SIZE  size)
inlinenoexcept

Definition at line 328 of file atltypes.h.

329 {
330 ::InflateRect(this, size.cx, size.cy);
331 }

◆ IntersectRect()

BOOL CRect::IntersectRect ( LPCRECT  lpRect1,
LPCRECT  lpRect2 
)
inlinenoexcept

Definition at line 346 of file atltypes.h.

347 {
348 return ::IntersectRect(this, lpRect1, lpRect2);
349 }

Referenced by CCanvasWindow::DoDraw(), CTextEditWindow::FixEditPos(), CCanvasWindow::getNewZoomRect(), operator&=(), ImageModel::PushImageForUndo(), and test_CRect().

◆ IsRectEmpty()

◆ IsRectNull()

BOOL CRect::IsRectNull ( ) const
inlinenoexcept

Definition at line 356 of file atltypes.h.

357 {
358 return (left == 0 && right == 0 &&
359 top == 0 && bottom == 0);
360 }

Referenced by test_CRect().

◆ MoveToX()

void CRect::MoveToX ( int  x)
inlinenoexcept

Definition at line 362 of file atltypes.h.

363 {
364 int dx = x - left;
365 left = x;
366 right += dx;
367 }
GLint dx
Definition: linetemp.h:97

Referenced by MoveToXY().

◆ MoveToXY() [1/2]

void CRect::MoveToXY ( int  x,
int  y 
)
inlinenoexcept

Definition at line 376 of file atltypes.h.

377 {
378 MoveToX(x);
379 MoveToY(y);
380 }
void MoveToX(int x) noexcept
Definition: atltypes.h:362
void MoveToY(int y) noexcept
Definition: atltypes.h:369

Referenced by MoveToXY().

◆ MoveToXY() [2/2]

void CRect::MoveToXY ( POINT  point)
inlinenoexcept

Definition at line 382 of file atltypes.h.

383 {
385 }
void MoveToXY(int x, int y) noexcept
Definition: atltypes.h:376

◆ MoveToY()

void CRect::MoveToY ( int  y)
inlinenoexcept

Definition at line 369 of file atltypes.h.

370 {
371 int dy = y - top;
372 top = y;
373 bottom += dy;
374 }
GLint dy
Definition: linetemp.h:97

Referenced by MoveToXY().

◆ NormalizeRect()

void CRect::NormalizeRect ( )
inlinenoexcept

Definition at line 387 of file atltypes.h.

388 {
389 if (left > right)
390 {
391 LONG tmp = left;
392 left = right;
393 right = tmp;
394 }
395 if (top > bottom)
396 {
397 LONG tmp = top;
398 top = bottom;
399 bottom = tmp;
400 }
401 }
long LONG
Definition: pedump.c:60

Referenced by TwoPointDrawTool::OnButtonUp(), and SelectionModel::SetRectFromPoints().

◆ OffsetRect() [1/3]

void CRect::OffsetRect ( int  x,
int  y 
)
inlinenoexcept

◆ OffsetRect() [2/3]

void CRect::OffsetRect ( POINT  point)
inlinenoexcept

Definition at line 408 of file atltypes.h.

409 {
410 ::OffsetRect(this, point.x, point.y);
411 }

◆ OffsetRect() [3/3]

void CRect::OffsetRect ( SIZE  size)
inlinenoexcept

Definition at line 413 of file atltypes.h.

414 {
415 ::OffsetRect(this, size.cx, size.cy);
416 }

◆ operator LPCRECT()

CRect::operator LPCRECT ( ) const
inlinenoexcept

Definition at line 590 of file atltypes.h.

591 {
592 return this;
593 }

◆ operator LPRECT()

CRect::operator LPRECT ( )
inlinenoexcept

Definition at line 585 of file atltypes.h.

586 {
587 return this;
588 }

◆ operator!=()

BOOL CRect::operator!= ( const RECT rect) const
inlinenoexcept

Definition at line 475 of file atltypes.h.

476 {
477 return !(*this == rect);
478 }
& rect
Definition: startmenu.cpp:1413

◆ operator&()

CRect CRect::operator& ( const RECT rect2) const
inlinenoexcept

Definition at line 566 of file atltypes.h.

567 {
568 CRect r;
569 r.IntersectRect(this, &rect2);
570 return r;
571 }
RECT rect2
Definition: edittest.c:51

◆ operator&=()

void CRect::operator&= ( const RECT rect)
inlinenoexcept

Definition at line 561 of file atltypes.h.

562 {
563 IntersectRect(this, &rect);
564 }
BOOL IntersectRect(LPCRECT lpRect1, LPCRECT lpRect2) noexcept
Definition: atltypes.h:346

◆ operator+() [1/3]

CRect CRect::operator+ ( LPCRECT  lpRect) const
inlinenoexcept

Definition at line 526 of file atltypes.h.

527 {
528 CRect r(this);
529 r.InflateRect(lpRect);
530 return r;
531 }

◆ operator+() [2/3]

CRect CRect::operator+ ( POINT  point) const
inlinenoexcept

Definition at line 519 of file atltypes.h.

520 {
521 CRect r(this);
522 r.OffsetRect(point);
523 return r;
524 }

◆ operator+() [3/3]

CRect CRect::operator+ ( SIZE  size) const
inlinenoexcept

Definition at line 533 of file atltypes.h.

534 {
535 CRect r(this);
536 r.OffsetRect(size);
537 return r;
538 }

◆ operator+=() [1/3]

void CRect::operator+= ( LPCRECT  lpRect)
inlinenoexcept

Definition at line 498 of file atltypes.h.

499 {
500 InflateRect(lpRect);
501 }

◆ operator+=() [2/3]

void CRect::operator+= ( POINT  point)
inlinenoexcept

Definition at line 488 of file atltypes.h.

489 {
491 }

◆ operator+=() [3/3]

void CRect::operator+= ( SIZE  size)
inlinenoexcept

Definition at line 493 of file atltypes.h.

494 {
496 }

◆ operator-() [1/3]

CRect CRect::operator- ( LPCRECT  lpRect) const
inlinenoexcept

Definition at line 554 of file atltypes.h.

555 {
556 CRect r(this);
557 r.DeflateRect(lpRect);
558 return r;
559 }

◆ operator-() [2/3]

CRect CRect::operator- ( POINT  point) const
inlinenoexcept

Definition at line 540 of file atltypes.h.

541 {
542 CRect r(this);
543 r.OffsetRect(-point.x, -point.y);
544 return r;
545 }

◆ operator-() [3/3]

CRect CRect::operator- ( SIZE  size) const
inlinenoexcept

Definition at line 547 of file atltypes.h.

548 {
549 CRect r(this);
550 r.OffsetRect(-size.cx, -size.cy);
551 return r;
552 }

◆ operator-=() [1/3]

void CRect::operator-= ( LPCRECT  lpRect)
inlinenoexcept

Definition at line 513 of file atltypes.h.

514 {
515 DeflateRect(lpRect);
516 }

◆ operator-=() [2/3]

void CRect::operator-= ( POINT  point)
inlinenoexcept

Definition at line 503 of file atltypes.h.

504 {
506 }

◆ operator-=() [3/3]

void CRect::operator-= ( SIZE  size)
inlinenoexcept

Definition at line 508 of file atltypes.h.

509 {
510 OffsetRect(-size.cx, -size.cy);
511 }

◆ operator=()

void CRect::operator= ( const RECT srcRect)
inlinenoexcept

Definition at line 480 of file atltypes.h.

481 {
482 left = srcRect.left;
483 top = srcRect.top;
484 right = srcRect.right;
485 bottom = srcRect.bottom;
486 }

◆ operator==()

BOOL CRect::operator== ( const RECT rect) const
inlinenoexcept

Definition at line 467 of file atltypes.h.

468 {
469 return (left == rect.left &&
470 top == rect.top &&
471 right == rect.right &&
472 bottom == rect.bottom);
473 }

◆ operator|()

CRect CRect::operator| ( const RECT rect2) const
inlinenoexcept

Definition at line 578 of file atltypes.h.

579 {
580 CRect r;
581 r.UnionRect(this, &rect2);
582 return r;
583 }

◆ operator|=()

void CRect::operator|= ( const RECT rect)
inlinenoexcept

Definition at line 573 of file atltypes.h.

574 {
575 UnionRect(this, &rect);
576 }
BOOL UnionRect(LPCRECT lpRect1, LPCRECT lpRect2) noexcept
Definition: atltypes.h:456

◆ PtInRect()

BOOL CRect::PtInRect ( POINT  point) const
inlinenoexcept

Definition at line 418 of file atltypes.h.

419 {
420 return ::PtInRect(this, point);
421 }

Referenced by ZoomTool::getNewZoomRect(), getSizeBoxHitTest(), CCanvasWindow::OnMouseMove(), and CCanvasWindow::OnSetCursor().

◆ SetRect()

void CRect::SetRect ( int  x1,
int  y1,
int  x2,
int  y2 
)
inlinenoexcept

Definition at line 423 of file atltypes.h.

424 {
425 left = x1;
426 top = y1;
427 right = x2;
428 bottom = y2;
429 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3711

Referenced by CToolSettingsWindow::calculateTwoBoxes(), CCanvasWindow::getNewZoomRect(), TextTool::OnButtonUp(), and ImageModel::PushImageForUndo().

◆ SetRectEmpty()

void CRect::SetRectEmpty ( )
inlinenoexcept

◆ Size()

CSize CRect::Size ( ) const
inlinenoexcept

Definition at line 436 of file atltypes.h.

437 {
438 return CSize(Width(), Height());
439 }

◆ SubtractRect()

BOOL CRect::SubtractRect ( LPCRECT  lpRectSrc1,
LPCRECT  lpRectSrc2 
)
inlinenoexcept

Definition at line 441 of file atltypes.h.

442 {
443 return ::SubtractRect(this, lpRectSrc1, lpRectSrc2);
444 }

◆ TopLeft() [1/2]

const CPoint & CRect::TopLeft ( ) const
inlinenoexcept

Definition at line 451 of file atltypes.h.

452 {
453 return ((const CPoint*)this)[0];
454 }

◆ TopLeft() [2/2]

CPoint & CRect::TopLeft ( )
inlinenoexcept

Definition at line 446 of file atltypes.h.

447 {
448 return ((CPoint*)this)[0];
449 }

◆ UnionRect()

BOOL CRect::UnionRect ( LPCRECT  lpRect1,
LPCRECT  lpRect2 
)
inlinenoexcept

Definition at line 456 of file atltypes.h.

457 {
458 return ::UnionRect(this, lpRect1, lpRect2);
459 }

Referenced by SelectionModel::Landing(), and operator|=().

◆ Width()


The documentation for this class was generated from the following file: