[Classes] [Prev] [Next] [Methods]

CRect

Methods Index

Heritage
Description
Usage
Protected Data Members
Public Methods
Constructor and Destructor Methods
Resetting Methods
Side Operations
Height and Width Operations
Utility CRect Operations
Type Conversion Utilities
Binary Operators
Union Operators
Intersection Operators
Translation Operators
Methods for Coordinate System Conversion

CRect


Heritage

Superclass: None

Subclasses: CRectRWC


Description

CRect is a data structure that allows you to store a rectangular region (set of coordinates) on the screen. A CRect is not a visible object. That is, the dimensions of a CRect define an area in which another object will be located. Every XVT-Power++ object has a CRect that tells it where to draw. A CRect object consists of four measurements-a top, a left, a bottom, and a right-that define its rectangular region.


Usage

Create a CRect object and initialize it with top-left and bottom-right coordinates.


Protected Data Members

UNITS itsLeft; The left side
UNITS itsTop; The top side
UNITS itsRight; The right side
UNITS itsBottom; The bottom side


Public Methods

Constructor and Destructor Methods

CRect(void);
CRect(UNITS theLeft, 
UNITS theTop,
UNITS theRight,
UNITS theBottom);
CRect(const CPoint& theTopLeftCorner, 
const CPoint& theBottomRightCorner);
CRect(const CRect &theRect);
CRect & operator= (const CRect &theRect);
~CRect();

Resetting Methods

CRect& SetRect(UNITS theLeft,
UNITS theTop,
UNITS theRight,
UNITS theBottom);
CRect& SetRect(CPoint theTopLeftCorner,
CPoint theBottomRightCorner);
CRect& Inflate(UNITS theInflation);

CRect& Inflate(UNITS theHInflation, UNITS theVInflation);

Side Operations

Each of the following methods performs an operation on one side of a CRect. Notice that these methods are overloaded.

UNITS Left(void) const;
UNITS Left(UNITS theNewLeft);
UNITS Top(void) const;
UNITS Top(UNITS theNewTop);
UNITS Right(void) const;
UNITS Right(UNITS theNewRight);
UNITS Bottom(void) const;
UNITS Bottom(UNITS theNewBottom);

Height and Width Operations

UNITS Height(void) const;
UNITS Height(UNITS theNewHeight);
UNITS Width(void) const;
UNITS Width(UNITS theNewWidth);

Utility CRect Operations

BOOLEAN IsPointInRect(const CPoint& thePoint) const;
BOOLEAN IsEmpty(void) const;
CRect GetInflatedRect(UNITS theInflation) const;
CRect GetInflatedRect(UNITS theHInflation, 
UNITS theVInflation) const;

Type Conversion Utilities

The following two conversion methods exist for purposes of compatibility with the XVT Portability Toolkit, making CRects and RCTs completely interchangeable.

CRect(const RCT& rect);
operator RCT(void) const;

Binary Operators

BOOLEAN operator==(const CRect& aCRect) const;
BOOLEAN operator!=(const CRect& aCRect) const;

Union Operators

CRect& operator+=(const CRect& aCRect);

friend CRect operator+(const CRect& leftRect, 
const CRect& rightRect);

Intersection Operators

CRect& operator-=(const CRect& aCRect);

friend CRect operator-(const CRect& leftRect, 
const CRect& rightRect);

Translation Operators

CRect& operator-=(const CPoint& aPoint);

CRect& operator+=(const CPoint& aPoint);

friend CRect operator+(const CRect& theRect,
const CPoint& thePoint);
friend CRect operator+(const CPoint& thePoint,
const CRect& theRect);
friend CRect operator-(const CRect& theRect, 
const CPoint& thePoint);

Methods for Coordinate System Conversion

It is very easy in XVT-Power++ to convert global to local coordinates and vice versa because XVT-Power++ provides the Localize and Globalize methods. You can go back and forth between global and local coordinates without having to do any calculations.

CRect Translate(const CView* fromView, const CView* toView);
CRect GetTranslated(const CView* fromLocalView, 
const CView* toView) const;
CRect Globalize(const CView* fromView);
CRect GetGlobal(const CView* fromView) const;
CRect Localize(const CView* toView);
CRect GetLocal(const CView* toView) const;


[Classes] [Prev] [Next] [Methods]

support@xvt.com


Visit our online help desk for tech support

Copyright © 2009, Providence Software Solutions Inc. All rights reserved.