TRect Class Reference

class TRect

Geometric rectangle.

The class represents a rectangle whose sides are parallel with the axes of the co-ordinate system.

The co-ordinates of the top-left and bottom-right corners are used to set the dimensions of the rectangle. The bottom right co-ordinate is outside the rectangle. Thus TRect(TPoint(2,2),TSize(4,4)) is equal to TRect(TPoint(2,2),TPoint(6,6)), and in both cases you get a 4x4 pixel rectangle on the screen.

Functions are provided to initialise and manipulate the rectangle and to extract information about it.

Public Member Functions
TRect(TUninitialized)
TRect()
TRect(TInt, TInt, TInt, TInt)
TRect(const TPoint &, const TPoint &)
TRect(const TPoint &, const TSize &)
TRect(const TSize &)
IMPORT_C voidBoundingRect(const TRect &)
IMPORT_C TPointCenter()
IMPORT_C TBoolContains(const TPoint &)
IMPORT_C voidGrow(TInt, TInt)
IMPORT_C voidGrow(const TSize &)
IMPORT_C TIntHeight()
IMPORT_C voidIntersection(const TRect &)
IMPORT_C TBoolIntersects(const TRect &)
IMPORT_C TBoolIsEmpty()
IMPORT_C TBoolIsNormalized()
IMPORT_C voidMove(TInt, TInt)
IMPORT_C voidMove(const TPoint &)
IMPORT_C voidNormalize()
IMPORT_C voidResize(TInt, TInt)
IMPORT_C voidResize(const TSize &)
IMPORT_C voidSetHeight(TInt)
IMPORT_C voidSetRect(TInt, TInt, TInt, TInt)
IMPORT_C voidSetRect(const TPoint &, const TPoint &)
IMPORT_C voidSetRect(const TPoint &, const TSize &)
IMPORT_C voidSetSize(const TSize &)
IMPORT_C voidSetWidth(TInt)
IMPORT_C voidShrink(TInt, TInt)
IMPORT_C voidShrink(const TSize &)
IMPORT_C TSizeSize()
IMPORT_C TIntWidth()
IMPORT_C TBooloperator!=(const TRect &)
IMPORT_C TBooloperator==(const TRect &)
Private Member Functions
voidAdjust(TInt, TInt)
Public Member Enumerations
enumTUninitialized { EUninitialized }
Public Attributes
TPoint iBr
TPoint iTl

Constructor & Destructor Documentation

TRect(TUninitialized)

TRect(TUninitialized)[inline]

Constructs a default rectangle.

This initialises the co-ordinates of its top left and bottom right corners to (0,0).

Parameters

TUninitialized

TRect()

IMPORT_CTRect()

TRect(TInt, TInt, TInt, TInt)

IMPORT_CTRect(TIntaAx,
TIntaAy,
TIntaBx,
TIntaBy
)

Parameters

TInt aAx
TInt aAy
TInt aBx
TInt aBy

TRect(const TPoint &, const TPoint &)

IMPORT_CTRect(const TPoint &aPointA,
const TPoint &aPointB
)

Parameters

const TPoint & aPointA
const TPoint & aPointB

TRect(const TPoint &, const TSize &)

IMPORT_CTRect(const TPoint &aPoint,
const TSize &aSize
)

Parameters

const TPoint & aPoint
const TSize & aSize

TRect(const TSize &)

IMPORT_CTRect(const TSize &aSize)

Parameters

const TSize & aSize

Member Functions Documentation

Adjust(TInt, TInt)

voidAdjust(TIntaDx,
TIntaDy
)[private]

Parameters

TInt aDx
TInt aDy

BoundingRect(const TRect &)

IMPORT_C voidBoundingRect(const TRect &aRect)

Parameters

const TRect & aRect

Center()

IMPORT_C TPointCenter()const

Contains(const TPoint &)

IMPORT_C TBoolContains(const TPoint &aPoint)const

Parameters

const TPoint & aPoint

Grow(TInt, TInt)

IMPORT_C voidGrow(TIntaDx,
TIntaDy
)

Parameters

TInt aDx
TInt aDy

Grow(const TSize &)

IMPORT_C voidGrow(const TSize &aSize)

Parameters

const TSize & aSize

Height()

IMPORT_C TIntHeight()const

Intersection(const TRect &)

IMPORT_C voidIntersection(const TRect &aRect)

Parameters

const TRect & aRect

Intersects(const TRect &)

IMPORT_C TBoolIntersects(const TRect &aRect)const

Parameters

const TRect & aRect

IsEmpty()

IMPORT_C TBoolIsEmpty()const

IsNormalized()

IMPORT_C TBoolIsNormalized()const

Move(TInt, TInt)

IMPORT_C voidMove(TIntaDx,
TIntaDy
)

Parameters

TInt aDx
TInt aDy

Move(const TPoint &)

IMPORT_C voidMove(const TPoint &aOffset)

Parameters

const TPoint & aOffset

Normalize()

IMPORT_C voidNormalize()

Resize(TInt, TInt)

IMPORT_C voidResize(TIntaDx,
TIntaDy
)

Parameters

TInt aDx
TInt aDy

Resize(const TSize &)

IMPORT_C voidResize(const TSize &aSize)

Parameters

const TSize & aSize

SetHeight(TInt)

IMPORT_C voidSetHeight(TIntaHeight)

Parameters

TInt aHeight

SetRect(TInt, TInt, TInt, TInt)

IMPORT_C voidSetRect(TIntaAx,
TIntaAy,
TIntaBx,
TIntaBy
)

Parameters

TInt aAx
TInt aAy
TInt aBx
TInt aBy

SetRect(const TPoint &, const TPoint &)

IMPORT_C voidSetRect(const TPoint &aPointTL,
const TPoint &aPointBR
)

Parameters

const TPoint & aPointTL
const TPoint & aPointBR

SetRect(const TPoint &, const TSize &)

IMPORT_C voidSetRect(const TPoint &aPoint,
const TSize &aSize
)

Parameters

const TPoint & aPoint
const TSize & aSize

SetSize(const TSize &)

IMPORT_C voidSetSize(const TSize &aSize)

Parameters

const TSize & aSize

SetWidth(TInt)

IMPORT_C voidSetWidth(TIntaWidth)

Parameters

TInt aWidth

Shrink(TInt, TInt)

IMPORT_C voidShrink(TIntaDx,
TIntaDy
)

Parameters

TInt aDx
TInt aDy

Shrink(const TSize &)

IMPORT_C voidShrink(const TSize &aSize)

Parameters

const TSize & aSize

Size()

IMPORT_C TSizeSize()const

Width()

IMPORT_C TIntWidth()const

operator!=(const TRect &)

IMPORT_C TBooloperator!=(const TRect &aRect)const

Parameters

const TRect & aRect

operator==(const TRect &)

IMPORT_C TBooloperator==(const TRect &aRect)const

Parameters

const TRect & aRect

Member Enumerations Documentation

Enum TUninitialized

Enumerators

EUninitialized

Member Data Documentation

TPoint iBr

TPoint iBr

The x and y co-ordinates of the bottom right hand corner of the rectangle.

TPoint iTl

TPoint iTl

The x and y co-ordinates of the top left hand corner of the rectangle.