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

CPoint

Methods Index

Heritage
Description
Usage
Protected Data Members
Public Methods
Constructor and Destructor Methods
Methods for Setting a Point
Member Operations
Conversion Operators
Binary Operators
Methods for Coordinate System Conversion

CPoint


Heritage

Superclass: None

Subclasses: None


Description

CPoint objects are data structures that specify locations on the screen. A CPoint is not a visible object; it is a mathematical entity. A CPoint object consists of two values, a horizontal (x) value and a vertical (y) value. Thus, each CPoint is an x,y coordinate. The functionality of this class is extensive. Every XVT-Power++ object has a CPoint object that tells it which origin to draw from and what its coordinates are relative to.


Usage

Create a CPoint object that has a horizontal and a vertical position, as follows:

CPoint a(1,5); CPoint b = a; 
PNT point; point.h = 2; point.v = 4; CPoint c(point);

Protected Data Members

UNITS fH; Horizontal position
UNITS fV; Vertical position


Public Methods

Constructor and Destructor Methods

CPoint(void);
CPoint(UNITS theHorizontalPos, UNITS theVerticalPos);
CPoint(const CPoint &thePoint);
CPoint & operator= (const CPoint &thePoint);
~CPoint();

Methods for Setting a Point

CPoint& SetPoint(UNITS theHorizontalPos, 
UNITS theVerticalPos);

Member Operations

UNITS H(void) const;
void H(UNITS theHorizontalPos);
UNITS V(void) const;
void V(UNITS theVerticalPos);

Conversion Operators

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

CPoint(PNT point);
operator PNT(void) const;

Binary Operators

CPoint& operator+=(const CPoint& aCPoint);
CPoint& operator-=(const CPoint& CPoint);
friend CPoint operator+(const CPoint& leftPoint,
const CPoint& rightPoint);
friend CPoint operator-(const CPoint& leftPoint,
const CPoint& rightPoint);
BOOLEAN operator==(const CPoint& aCPoint) const;
BOOLEAN operator!=(const CPoint& aCPoint) const;

Methods for Coordinate System Conversion

It is very easy in XVT-Power++ to convert global (window relative) coordinates 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.

CPoint Translate(const CView* fromView, 
const CView* toView);
CPoint GetTranslated(const CView* fromLocalView, 
const CView* toView) const;
CPoint Globalize(const CView* fromView);
CPoint GetGlobal(const CView* fromView) const;
CPoint Localize(const CView* toView);
CPoint 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.