Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: e32std.h
Link against: euser.lib

Class TPoint

TPoint

Support

Supported from 5.0

Description

Stores a two-dimensional point in Cartesian co-ordinates.

Its data members (iX and iY) are public and can be manipulated directly, or by means of the functions provided. Functions are provided to set and manipulate the point, and to compare points for equality.

Defined in TPoint:
AsSize(), SetXY(), TPoint(), iX, iY, operator!=(), operator+(), operator+=(), operator-(), operator-=(), operator==()


Construction and destruction


TPoint()

TPoint();

Description

Constructs default point, initialising its iX and iY members to zero.


TPoint()

TPoint(TInt aX,TInt aY);

Description

Constructs a point with the specified x and y co-ordinates.

Parameters

TInt aX

The x co-ordinate value.

TInt aY

The y co-ordinate value.

[Top]


Assignment


SetXY()

void SetXY(TInt aX,TInt aY);

Description

Sets the x and y co-ordinates for this point.

Parameters

TInt aX

The value to assign to the x co-ordinate.

TInt aY

The value to assign to the y co-ordinate.

[Top]


Overloaded operators


operator-=()

TPoint& operator-=(const TPoint& aPoint);

Description

TPoint subtraction assignment operator.

The operator subtracts the specified point from this point, and assigns the result back to this point.

Parameters

const TPoint& aPoint

The point to be subtracted.

Return value

TPoint&

A reference to this point object.


operator-=()

TPoint& operator-=(const TSize& aSize);

Description

TSize subtraction assignment operator.

The operator subtracts the specified TSize from this point, and assigns the result back to this point.

The operation proceeds by:

Parameters

const TSize& aSize

The TSize to be subtracted.

Return value

TPoint&

A reference to this point object.


operator+=()

TPoint& operator+=(const TPoint& aPoint);

Description

TPoint addition assignment operator.

The operator adds the specified point to this point, and assigns the result back to this point.

Parameters

const TPoint& aPoint

The point to be added.

Return value

TPoint&

A reference to this point object.


operator+=()

TPoint& operator+=(const TSize& aSize);

Description

TSize addition assignment operator.

The operator adds the specified TSize to this point, and assigns the result back to this point.

The operation proceeds by:

Parameters

const TSize& aSize

The TSize to be added to this point.

Return value

TPoint&

A reference to this point object.


operator==()

TInt operator==(const TPoint& aPoint) const;

Description

Compares two points for equality.

For two points to be equal, both their x and y co-ordinate values must be equal.

Parameters

const TPoint& aPoint

The point to be compared with this point.

Return value

TInt

True, if the two points are equal; false, otherwise.


operator!=()

TInt operator!=(const TPoint& aPoint) const;

Description

Compares two points for inequality.

For two points to be unequal, either their x or their y co-ordinate values must be different.

Parameters

const TPoint& aPoint

The point to be compared with this point.

Return value

TInt

True, if the two points are unequal; false, otherwise


operator-()

TPoint operator-(const TPoint& aPoint) const;

Description

TPoint subtraction operator.

The operator subtracts the specified point from this point, and returns the resulting value.

Parameters

const TPoint& aPoint

The point to be subtracted from this point.

Return value

TPoint

The result of the operation.


operator-()

TPoint operator-(const TSize& aSize) const;

Description

TSize subtraction operator.

The operator subtracts the specified TSize from this point, and returns the resulting value.

The operation proceeds by:

Parameters

const TSize& aSize

The TSize to be subtracted.

Return value

TPoint

The result of the operation.


operator-()

TPoint operator-() const;

Description

Unary minus operator.

The operator returns the negation of this point.

Return value

TPoint

The result of the operation.


operator+()

TPoint operator+(const TPoint& aPoint) const;

Description

The operator adds the specified point to this point, and returns the resulting value.

Parameters

const TPoint& aPoint

The point to be added to this point.

Return value

TPoint

The result of the operation.


operator+()

TPoint operator+(const TSize& aSize) const;

Description

TSize addition operator.

The operator adds the specified TSize to this point, and returns the resulting value.

The operation proceeds by:

Parameters

const TSize& aSize

The TSize to be added to this TPoint.

Return value

TPoint

The result of the operation.

[Top]


Conversion to size


AsSize()

TSize AsSize() const;

Description

Gets the size of the rectangle whose top left hand corner is the origin of the screen co-ordinates and whose bottom right hand corner is this point.

Return value

TSize

The co-ordinates of this point converted to a size.

[Top]


Public data members


iX

TInt iX

Description

The x co-ordinate.


iY

TInt iY

Description

The y co-ordinate.