TPoint Class Reference

#include <e32cmn.h>

class TPoint
Public Attributes
TInt iX
TInt iY
Public Member Enumerations
enumTUninitialized { EUninitialized }
Public Member Functions
TPoint(TUninitialized)
TPoint()
TPoint(TInt, TInt)
IMPORT_C TSizeAsSize()
IMPORT_C voidSetXY(TInt, TInt)
IMPORT_C TBooloperator!=(const TPoint &)
IMPORT_C TPointoperator+(const TPoint &)
IMPORT_C TPointoperator+(const TSize &)
IMPORT_C TPoint &operator+=(const TPoint &)
IMPORT_C TPoint &operator+=(const TSize &)
IMPORT_C TPointoperator-(const TPoint &)
IMPORT_C TPointoperator-(const TSize &)
IMPORT_C TPointoperator-()
IMPORT_C TPoint &operator-=(const TPoint &)
IMPORT_C TPoint &operator-=(const TSize &)
IMPORT_C TBooloperator==(const TPoint &)

Detailed 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.

Member Attribute Documentation

iX

TInt iX

The x co-ordinate.

iY

TInt iY

The y co-ordinate.

Member Enumeration Documentation

Enum TUninitialized

EnumeratorValueDescription
EUninitialized

Constructor & Destructor Documentation

TPoint ( TUninitialized )

TPoint(TUninitialized)[inline]

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

TPoint ( )

TPoint()[inline]

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

TPoint ( TInt, TInt )

TPoint(TIntaX,
TIntaY
)[inline]

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

Parameters
aXThe x co-ordinate value.
aYThe y co-ordinate value.

Member Function Documentation

AsSize ( )

IMPORT_C TSizeAsSize()const

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
The co-ordinates of this point converted to a size.

SetXY ( TInt, TInt )

IMPORT_C voidSetXY(TIntaX,
TIntaY
)

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

Parameters
aXThe value to assign to the x co-ordinate.
aYThe value to assign to the y co-ordinate.

operator!= ( const TPoint & )

IMPORT_C TBooloperator!=(const TPoint &aPoint)const

Compares two points for inequality.

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

Parameters
aPointThe point to be compared with this point.
Return Value
True, if the two points are unequal; false, otherwise.

operator+ ( const TPoint & )

IMPORT_C TPointoperator+(const TPoint &aPoint)const

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

Parameters
aPointThe point to be added to this point.
Return Value
The result of the operation.

operator+ ( const TSize & )

IMPORT_C TPointoperator+(const TSize &aSize)const

TSize addition operator.

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

The operation proceeds by:

1. adding the width value of the TSize to the x co-ordinate value

2. adding the height value of the TSize to the y co-ordinate value.

Parameters
aSizeThe TSize to be added to this TPoint.
Return Value
The result of the operation.

operator+= ( const TPoint & )

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

TPoint addition assignment operator.

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

Parameters
aPointThe point to be added.
Return Value
A reference to this point object.

operator+= ( const TSize & )

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

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:

1. adding the width value of the TSize to the x co-ordinate value

2. adding the height value of the TSize to the y co-ordinate value

Parameters
aSizeThe TSize to be added to this point.
Return Value
A reference to this point object.

operator- ( const TPoint & )

IMPORT_C TPointoperator-(const TPoint &aPoint)const

TPoint subtraction operator.

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

Parameters
aPointThe point to be subtracted from this point.
Return Value
The result of the operation.

operator- ( const TSize & )

IMPORT_C TPointoperator-(const TSize &aSize)const

TSize subtraction operator.

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

The operation proceeds by:

1. subtracting the width value of the TSize from the x co-ordinate value

2. subtracting the height value of the TSize from the y co-ordinate value.

Parameters
aSizeThe TSize to be subtracted.
Return Value
The result of the operation.

operator- ( )

IMPORT_C TPointoperator-()const

Unary minus operator.

The operator returns the negation of this point.

Return Value
The result of the operation.

operator-= ( const TPoint & )

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

TPoint subtraction assignment operator.

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

Parameters
aPointThe point to be subtracted.
Return Value
A reference to this point object.

operator-= ( const TSize & )

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

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:

1. subtracting the width value of the TSize from the x co-ordinate value

2. subtracting the height value of the TSize from the y co-ordinate value

Parameters
aSizeThe TSize to be subtracted.
Return Value
A reference to this point object.

operator== ( const TPoint & )

IMPORT_C TBooloperator==(const TPoint &aPoint)const

Compares two points for equality.

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

Parameters
aPointThe point to be compared with this point.
Return Value
True, if the two points are equal; false, otherwise.