Update contrib.
1 // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\euser\us_graph.cpp
23 EXPORT_C TBool TPoint::operator==(const TPoint& aPoint) const
25 Compares two points for equality.
27 For two points to be equal, both their x and y co-ordinate values must be
30 @param aPoint The point to be compared with this point.
32 @return True, if the two points are equal; false, otherwise.
36 return(iX==aPoint.iX && iY==aPoint.iY);
42 EXPORT_C TBool TPoint::operator!=(const TPoint& aPoint) const
44 Compares two points for inequality.
46 For two points to be unequal, either their x or their y co-ordinate values
49 @param aPoint The point to be compared with this point.
51 @return True, if the two points are unequal; false, otherwise.
55 return(iX!=aPoint.iX || iY!=aPoint.iY);
61 EXPORT_C TPoint& TPoint::operator-=(const TPoint& aPoint)
63 TPoint subtraction assignment operator.
65 The operator subtracts the specified point from this point, and assigns the
66 result back to this point.
68 @param aPoint The point to be subtracted.
70 @return A reference to this point object.
82 EXPORT_C TPoint& TPoint::operator-=(const TSize& aSize)
84 TSize subtraction assignment operator.
86 The operator subtracts the specified TSize from this point, and assigns the
87 result back to this point.
89 The operation proceeds by:
91 1. subtracting the width value of the TSize from the x co-ordinate value
93 2. subtracting the height value of the TSize from the y co-ordinate value
95 @param aSize The TSize to be subtracted.
97 @return A reference to this point object.
109 EXPORT_C TPoint& TPoint::operator+=(const TPoint& aPoint)
111 TPoint addition assignment operator.
113 The operator adds the specified point to this point, and assigns the result
116 @param aPoint The point to be added.
118 @return A reference to this point object.
130 EXPORT_C TPoint& TPoint::operator+=(const TSize& aSize)
132 TSize addition assignment operator.
134 The operator adds the specified TSize to this point, and assigns the result
137 The operation proceeds by:
139 1. adding the width value of the TSize to the x co-ordinate value
141 2. adding the height value of the TSize to the y co-ordinate value
143 @param aSize The TSize to be added to this point.
145 @return A reference to this point object.
157 EXPORT_C TPoint TPoint::operator-(const TPoint& aPoint) const
159 TPoint subtraction operator.
161 The operator subtracts the specified point from this point, and returns the
164 @param aPoint The point to be subtracted from this point.
166 @return The result of the operation.
178 EXPORT_C TPoint TPoint::operator-(const TSize& aSize) const
180 TSize subtraction operator.
182 The operator subtracts the specified TSize from this point, and returns the
185 The operation proceeds by:
187 1. subtracting the width value of the TSize from the x co-ordinate value
189 2. subtracting the height value of the TSize from the y co-ordinate value.
191 @param aSize The TSize to be subtracted.
193 @return The result of the operation.
205 EXPORT_C TPoint TPoint::operator+(const TPoint& aPoint) const
207 The operator adds the specified point to this point, and returns the resulting
210 @param aPoint The point to be added to this point.
212 @return The result of the operation.
224 EXPORT_C TPoint TPoint::operator+(const TSize& aSize) const
226 TSize addition operator.
228 The operator adds the specified TSize to this point, and returns the resulting
231 The operation proceeds by:
233 1. adding the width value of the TSize to the x co-ordinate value
235 2. adding the height value of the TSize to the y co-ordinate value.
237 @param aSize The TSize to be added to this TPoint.
239 @return The result of the operation.
251 EXPORT_C TPoint TPoint::operator-() const
253 Unary minus operator.
255 The operator returns the negation of this point.
257 @return The result of the operation.
261 return TPoint(-iX,-iY);
267 EXPORT_C void TPoint::SetXY(TInt aX,TInt aY)
269 Sets the x and y co-ordinates for this point.
271 @param aX The value to assign to the x co-ordinate.
272 @param aY The value to assign to the y co-ordinate.
283 EXPORT_C TSize TPoint::AsSize() const
285 Gets the size of the rectangle whose top left hand corner is the origin of
286 the screen co-ordinates and whose bottom right hand corner is this point.
288 @return The co-ordinates of this point converted to a size.
291 return(TSize(iX,iY));
298 EXPORT_C TBool TPoint3D::operator==(const TPoint3D& aPoint3D) const
300 Compares two 3D points(TPoint3D) for equality.
302 For two TPoint3D to be equal, their x , y and zco-ordinate values must be
305 @param aPoint3D The point to be compared with this point.
307 @return True, if the two points are equal; false, otherwise.
310 return(iX==aPoint3D.iX && iY==aPoint3D.iY && iZ==aPoint3D.iZ);
316 EXPORT_C TBool TPoint3D::operator!=(const TPoint3D& aPoint3D) const
318 Compares two 3D points for inequality.
320 For two points to be unequal, their x or y or z co-ordinate values
323 @param aPoint3D The point to be compared with this point.
325 @return True, if the two points are unequal; false, otherwise.
328 return(iX!=aPoint3D.iX || iY!=aPoint3D.iY || iZ!=aPoint3D.iZ);
336 EXPORT_C TPoint3D& TPoint3D::operator-=(const TPoint3D& aPoint3D)
338 TPoint3D subtraction assignment operator.
340 The operator subtracts the specified point from this point, and assigns the
341 result back to this point.
343 @param aPoint The point to be subtracted.
345 @return A reference to this point object.
356 EXPORT_C TPoint3D& TPoint3D::operator-=(const TPoint& aPoint)
359 TPoint subtraction assignment operator.
361 The operator subtracts the specified TPoint from this point(TPoint3D), and assigns the
362 result back to this point.
364 The operation proceeds by
365 subtracting x and y cordinates of the TPoin to this point and no changes to the Z-coordinatete value
367 @param aPoint The aPoint to be subtracted.
369 @return A reference to this point object.
374 //No Changes to the z co-ordinate
380 EXPORT_C TPoint3D& TPoint3D::operator+=(const TPoint3D& aPoint3D)
382 TPoint3D addition assignment operator.
384 The operator adds the specified point to this point, and assigns the result
387 @param aPoint3D The point to be added.
389 @return A reference to this point object.
398 EXPORT_C TPoint3D& TPoint3D::operator+=(const TPoint& aPoint)
400 TPoint addition assignment operator.
402 The operator adds the specified TPoint to this point, and assigns the result
405 The operation proceeds by:
406 adding x and y cordinates of the TPoin to this point and no changes to the Z-coordinatete value
408 @param aPoint The TPoint to be added to this point.
410 @return A reference to this point object.
416 //No Changes to the z co-ordinate
419 EXPORT_C TPoint3D TPoint3D::operator-(const TPoint3D& aPoint3D) const
421 TPoint3D subtraction operator.
423 The operator subtracts the specified point from this point, and returns the
426 @param aPoint3D The point to be subtracted from this point.
428 @return the point(TPoint3D) which is the result of the operation.
439 EXPORT_C TPoint3D TPoint3D::operator-(const TPoint& aPoint) const
441 TPoint subtraction operator.
443 The operator subtracts the specified TPoint from this point, and returns the
446 @param aPoint The TPoint to be subtracted.
448 @return the point(TPoint3D) which is the result of the operation.
458 EXPORT_C TPoint3D TPoint3D::operator+(const TPoint3D& aPoint3D) const
460 The operator adds the specified point to this point, and returns the resulting
463 @param aPoint3D The point to be added to this point.
465 @return the point(TPoint3D) which is the result of the operation.
474 EXPORT_C TPoint3D TPoint3D::operator+(const TPoint& aPoint) const
476 TPoint addition operator.
478 The operator adds the specified TPoint to this point, and returns the resulting
481 @param aSize The TSize to be added to this TPoint.
483 @return the point(TPoint3D) which is the result of the operation.
493 EXPORT_C TPoint3D TPoint3D::operator-() const
495 Unary minus operator.
497 The operator returns the negation of this point.
499 @return the point(TPoint3D) which is the result of Unary minus operation.
502 return TPoint3D(-iX,-iY,-iZ);
507 EXPORT_C void TPoint3D::SetXYZ(TInt aX,TInt aY,TInt aZ)
509 Sets the x , y and z co-ordinates for this point.
511 @param aX The value to assign to the x co-ordinate.
512 @param aY The value to assign to the y co-ordinate.
513 @param aZ The value to assign to the z co-ordinate.
521 EXPORT_C void TPoint3D::SetPoint(const TPoint& aPoint)
523 TPoint3D from TPoint, sets the Z co-ordinate to Zero
524 @param aPoint The TPoint to add to this point
533 EXPORT_C TPoint TPoint3D::AsPoint() const
535 Gets Tpoint from Tpoint3D
536 @return TPoint from X and Y cordinates of Tpoint3D
539 return(TPoint(iX,iY));
547 EXPORT_C TBool TSize::operator==(const TSize& aSize) const
549 Compares this TSize with the specified TSize for equality.
551 For two TSizes to be equal, both their width and height values must be equal.
553 @param aSize The TSize to be compared with this TSize.
555 @return True, if the two TSize are equal; false, otherwise.
558 return(iWidth==aSize.iWidth && iHeight==aSize.iHeight);
564 EXPORT_C TBool TSize::operator!=(const TSize& aSize) const
566 Compares two TSize for inequality.
568 For two TSize to be unequal, either their width or height values must be different.
570 @param aSize The TSize to be compared with this TSize.
572 @return True, if the two TSize are unequal; false, otherwise.
575 return(iWidth!=aSize.iWidth || iHeight!=aSize.iHeight);
581 EXPORT_C TSize& TSize::operator-=(const TSize& aSize)
583 TSize subtraction assignment operator.
585 The operator subtracts the specified TSize from this TSize, and assigns the
586 result back to this TSize.
588 @param aSize The TSize to be subtracted.
590 @return A reference to this TSize object.
593 iWidth-=aSize.iWidth;iHeight-=aSize.iHeight;return(*this);
599 EXPORT_C TSize& TSize::operator-=(const TPoint& aPoint)
601 TPoint subtraction assignment operator.
603 The operator subtracts the specified point from this TSize, and assigns the
604 result back to this TSize.
606 The operation proceeds by:
608 1. subtracting the point's x co-ordinate value from the width
610 2. subtracting the point's y co-ordinate value from the height.
612 @param aPoint The point to be subtracted.
614 @return A reference to this size object.
617 iWidth-=aPoint.iX;iHeight-=aPoint.iY;return(*this);
623 EXPORT_C TSize& TSize::operator+=(const TSize& aSize)
625 TSize addition assignment operator.
627 The operator adds the specified TSize to this TSize, and assigns the result
630 @param aSize The TSize to be added.
632 @return A reference to this size object.
635 iWidth+=aSize.iWidth;iHeight+=aSize.iHeight;return(*this);
641 EXPORT_C TSize& TSize::operator+=(const TPoint& aPoint)
643 TPoint addition assignment operator.
645 The operator adds the specified point to this TSize, and assigns the result
648 The operation proceeds by:
650 1. adding the point's x co-ordinate value to the width
652 2. adding the point's y co-ordinate value to the height.
654 @param aPoint The point to be added.
656 @return A reference to this size object.
659 iWidth+=aPoint.iX;iHeight+=aPoint.iY;return(*this);
665 EXPORT_C TSize TSize::operator-(const TSize& aSize) const
667 TSize subtraction operator.
669 This operator subtracts the specified TSize from this TSize, and returns the
672 @param aSize The TSize to be subtracted from this Tsize.
674 @return The result of the operation.
677 TSize ret=* this; ret-= aSize ;return(ret);
683 EXPORT_C TSize TSize::operator-(const TPoint& aPoint) const
685 TPoint subtraction operator.
687 This operator subtracts the specified point from this TSize, and returns the
690 The operation proceeds by:
692 1. subtracting the x co-ordinate value from the width
694 2. subtracting the y co-ordinate value from the height
696 @param aPoint The point to be subtracted.
698 @return The result of the operation.
701 TSize ret=* this; ret-= aPoint ;return(ret);
707 EXPORT_C TSize TSize::operator+(const TSize& aSize) const
709 TSize addition operator.
711 This operator adds the specified TSize to this TSize, and returns the resulting
714 @param aSize The TSize to be added to this Tsize.
716 @return The result of the operation.
719 TSize ret=* this; ret+= aSize ;return(ret);
725 EXPORT_C TSize TSize::operator+(const TPoint& aPoint) const
727 TPoint addition operator.
729 This operator adds the specified point to this TSize, and returns the resulting
732 The operation proceeds by:
734 1. adding the x co-ordinate value to the width
736 2. adding the y co-ordinate value to the height
738 @param aPoint The point to be added to this TSize.
740 @return The result of the operation.
743 TSize ret=* this; ret+= aPoint ;return(ret);
749 EXPORT_C TSize TSize::operator-() const
751 Unary minus operator.
753 The operator returns the negation of this TSize.
755 @return The result of the operation.
759 return TSize(-iWidth,-iHeight);
765 EXPORT_C void TSize::SetSize(TInt aWidth,TInt aHeight)
767 Sets the width and height.
769 @param aWidth The width value.
770 @param aHeight The height value.
773 iWidth=aWidth;iHeight=aHeight;
779 EXPORT_C TPoint TSize::AsPoint() const
781 Gets a TPoint object whose co-ordinates are the width and height of this TSize.
783 @return The co-ordinates of this TSize converted to a point.
786 return(TPoint(iWidth,iHeight));
792 EXPORT_C TRect::TRect() : iTl(0,0),iBr(0,0)
794 Constructs a default rectangle.
796 This initialises the co-ordinates of its top
797 left and bottom right corners to (0,0).
804 EXPORT_C TRect::TRect(TInt aAx,TInt aAy,TInt aBx,TInt aBy) : iTl(aAx,aAy),iBr(aBx,aBy)
806 Constructs the rectangle, initialising its top left and bottom right hand corners
807 with four TInt values.
809 @param aAx The horizontal co-ordinate of the left hand side of the rectangle.
810 @param aAy The vertical co-ordinate of the top of the rectangle.
811 @param aBx The horizontal co-ordinate of the right hand side of the rectangle.
812 @param aBy The vertical co-ordinate of the bottom of the rectangle.
819 EXPORT_C TRect::TRect(const TPoint& aPointA,const TPoint& aPointB) : iTl(aPointA),iBr(aPointB)
821 Constructs the rectangle with two TPoints, corresponding to its top left and
822 bottom right hand corners.
824 @param aPointA The co-ordinates of the rectangle's top left hand corner.
825 @param aPointB The co-ordinates of the rectangle's bottom right hand corner.
832 EXPORT_C TRect::TRect(const TPoint& aPoint,const TSize& aSize) : iTl(aPoint),iBr(aPoint+aSize)
834 Constructs the rectangle with a TPoint for its top left corner, and a TSize
835 for its width and height.
837 @param aPoint The rectangle's top left hand corner.
838 @param aSize The rectangle's width and height.
845 EXPORT_C TRect::TRect(const TSize& aSize) : iTl(0,0), iBr(aSize.iWidth, aSize.iHeight)
847 Constructs the rectangle with a TSize.
849 The co-ordinates of its top left hand corner are initialised to (0,0) and
850 its width and height are initialised to the values contained in the argument.
852 @param aSize The width and height of the rectangle.
859 EXPORT_C void TRect::SetRect(TInt aTlX,TInt aTlY,TInt aBrX,TInt aBrY)
861 Sets the rectangle's position using four TInts.
863 @param aTlX The horizontal co-ordinate of the left hand side of the rectangle.
864 @param aTlY The vertical co-ordinate of the top of the rectangle.
865 @param aBrX The horizontal co-ordinate of the right hand side of the rectangle.
866 @param aBrY The vertical co-ordinate of the bottom of the rectangle.
869 iTl.iX=aTlX;iTl.iY=aTlY;iBr.iX=aBrX;iBr.iY=aBrY;
875 EXPORT_C void TRect::SetRect(const TPoint& aPointTL,const TPoint& aPointBR)
877 Sets the rectangle's position using two TPoints.
879 @param aPointTL The co-ordinates of the rectangle's top left hand corner.
880 @param aPointBR The co-ordinates of the rectangle's bottom right hand corner.
883 iTl=aPointTL;iBr=aPointBR;
889 EXPORT_C void TRect::SetRect(const TPoint& aTL,const TSize& aSize)
891 Sets the rectangle's position using a TPoint and a TSize.
893 @param aTL The co-ordinates of the rectangle's top left hand corner.
894 @param aSize The rectangle's width and height.
897 iTl=aTL;iBr=aTL+aSize;
903 EXPORT_C void TRect::Shrink(TInt aDx,TInt aDy)
905 Shrinks a rectangle using specified horizontal and vertical offsets.
907 The offset values are added to the co-ordinates of its top left hand corner,
908 and the same values are subtracted from the co-ordinates of its bottom right
909 hand corner. The co-ordinates of the centre of the rectangle remain unchanged.
910 If either value is negative, the rectangle expands in the corresponding direction.
912 @param aDx The number of pixels by which to move the left and right hand sides
913 of the rectangle. A positive value reduces the width, a negative
915 @param aDy The number of pixels by which to move the top and bottom of the
916 rectangle. A positive value reduces the height, a negative value
926 EXPORT_C void TRect::Shrink(const TSize& aSize)
928 Shrinks a rectangle using a specified TSize offset.
930 The rectangle shrinks by twice the value of the height and width specified
931 in the TSize. The co-ordinates of the centre of the rectangle remain unchanged.
932 If either value is negative, the rectangle expands in the
933 corresponding direction.
935 @param aSize The number of pixels by which to move the left and right hand
936 sides of the rectangle (by aSize.iWidth) and the top and bottom
940 Adjust(aSize.iWidth,aSize.iHeight);
946 EXPORT_C void TRect::Resize(const TSize& aSize)
948 Resizes a rectangle by adding a TSize offset.
950 The offset is added to the co-ordinates of its bottom right hand corner. If
951 either value in the TSize is negative, the rectangle shrinks in the
952 corresponding direction. The co-ordinates of the rectangle's top left hand
953 corner are unaffected.
955 @param aSize The number of pixels by which to move the rectangle; the right
956 hand side by aSize.iWidth and the bottom by aSize.iHeight.
965 EXPORT_C void TRect::Resize(TInt aDx, TInt aDy)
967 Resizes a rectangle by adding a horizontal and vertical offset.
969 The offset is added to the co-ordinates of its bottom right hand corner. If
970 either value is negative, the rectangle shrinks in the corresponding direction.
971 The co-ordinates of the rectangle's top left hand corner are unaffected.
973 @param aDx The number of pixels by which to move the right hand side of the
975 @param aDy The number of pixels by which to move the bottom of the rectangle.
978 iBr.iX+=aDx;iBr.iY+=aDy;
984 EXPORT_C TBool TRect::operator==(const TRect &aRect) const
986 Compares two rectangles for equality.
988 For two rectangles to be equal, the co-ordinates of both their top left and
989 bottom right hand corners must be equal.
991 @param aRect The rectangle to compare with this rectangle.
993 @return True, if the rectangles have the same co-ordinates; false, otherwise.
997 return(iTl==aRect.iTl && iBr==aRect.iBr);
1003 EXPORT_C TBool TRect::operator!=(const TRect &aRect) const
1005 Compares two rectangles for inequality.
1007 Two rectangles are unequal if any of their co-ordinates differ.
1009 @param aRect The rectangle to compare with this rectangle.
1010 @return True, if the rectangles do not have the same co-ordinates; false, if
1011 all co-ordinates are equal.
1015 return(iTl!=aRect.iTl || iBr!=aRect.iBr);
1021 EXPORT_C void TRect::Move(const TPoint &aOffset)
1023 Moves the rectangle by adding a TPoint offset.
1025 The offset is added to the co-ordinates of both its top left and bottom right
1026 hand corners. The size of the rectangle is unchanged.
1028 @param aOffset The number of pixels to move the rectangle; horizontally by
1029 aOffset.iX and vertically by aOffset.iY.
1040 EXPORT_C void TRect::Move(TInt aDx,TInt aDy)
1042 Moves the rectangle by adding an x, y offset.
1044 The offset is added to the co-ordinates of both its top left and bottom right
1045 hand corners. The size of the rectangle is unchanged.
1047 @param aDx The number of pixels to move the rectangle horizontally. If negative,
1048 the rectangle moves leftwards.
1049 @param aDy The number of pixels to move the rectangle vertically. If negative,
1050 the rectangle moves upwards.
1063 // private function, hence not exported
1064 void TRect::Adjust(TInt aDx,TInt aDy)
1066 // Adjust by a delta.
1079 EXPORT_C void TRect::Grow(TInt aDx,TInt aDy)
1084 Grows the rectangle using the specified horizontal and vertical offsets.
1086 The offset values are subtracted from the co-ordinates of its top left hand
1087 corner, and the same values are added to the co-ordinates of its bottom right
1088 hand corner. The co-ordinates of the centre of the rectangle remain unchanged.
1089 If either value is negative, the rectangle shrinks in the corresponding direction.
1091 @param aDx The number of pixels by which to move the left and right hand sides
1092 of the rectangle. A positive value increases the width, a negative
1094 @param aDy The number of pixels by which to move the top and bottom of the
1095 rectangle. A positive value increases the height, a negative
1109 EXPORT_C void TRect::Grow(const TSize &aSize)
1114 Grows a rectangle using the specified TSize offset.
1116 The rectangle grows by twice the value of the height and width specified in
1117 the TSize. The co-ordinates of the centre of the rectangle remain unchanged.
1118 If either value is negative, the rectangle shrinks in the
1119 corresponding direction.
1121 @param aSize The number of pixels by which to move the left and right hand
1122 sides of the rectangle (by aSize.iWidth) and the top and bottom
1134 EXPORT_C void TRect::BoundingRect(const TRect &aRect)
1136 // Union of this and aRect, a union is defined as the minimum rectangle that encloses
1137 // both source rectangles
1140 Gets the minimal rectangle which bounds both this rectangle and the specified
1141 rectangle, and assigns it to this rectangle.
1143 @param aRect The rectangle to use with this rectangle to get the minimal bounding
1148 if (iTl.iX>aRect.iTl.iX)
1149 iTl.iX=aRect.iTl.iX;
1150 if (iTl.iY>aRect.iTl.iY)
1151 iTl.iY=aRect.iTl.iY;
1152 if (iBr.iX<aRect.iBr.iX)
1153 iBr.iX=aRect.iBr.iX;
1154 if (iBr.iY<aRect.iBr.iY)
1155 iBr.iY=aRect.iBr.iY;
1161 EXPORT_C TBool TRect::IsEmpty() const
1163 // True if the rectangle is empty.
1166 Tests whether the rectangle is empty.
1168 @return True, if empty; false, if not.
1172 return(iTl.iX>=iBr.iX || iTl.iY>=iBr.iY);
1178 EXPORT_C void TRect::Intersection(const TRect &aRect)
1180 // Intersect this with aRect.
1183 Gets the area of intersection between this rectangle and the specified
1184 rectangle, and assigns it to this rectangle.
1186 It is usual to call TRect::Intersects() first to verify whether the two rectangles
1187 intersect. If the two rectangles do not intersect, then, on return, this rectangle
1190 @param aRect The rectangle to be used with this rectangle to get the area
1193 @see TRect::Intersects
1197 if (iTl.iX<aRect.iTl.iX)
1198 iTl.iX=aRect.iTl.iX;
1199 if (iTl.iY<aRect.iTl.iY)
1200 iTl.iY=aRect.iTl.iY;
1201 if (iBr.iX>aRect.iBr.iX)
1202 iBr.iX=aRect.iBr.iX;
1203 if (iBr.iY>aRect.iBr.iY)
1204 iBr.iY=aRect.iBr.iY;
1210 EXPORT_C TBool TRect::Intersects(const TRect &aRect) const
1212 // If aRect Intersects with this return True.
1215 Tests whether this rectangle overlaps with the specified rectangle.
1217 Two rectangles overlap if any point is located within both rectangles. There
1218 is no intersection if two adjacent sides touch without overlapping, or if
1219 either rectangle is empty.
1221 @param aRect The rectangle to compare with this rectangle for an intersection.
1223 @return True, if the two rectangles overlap; false, if there is no overlap.
1227 return(!(IsEmpty() || aRect.IsEmpty() || iBr.iX<=aRect.iTl.iX || iBr.iY<=aRect.iTl.iY || iTl.iX>=aRect.iBr.iX || iTl.iY>=aRect.iBr.iY));
1233 EXPORT_C void TRect::Normalize()
1235 // Make the conditions top left bottom right true.
1238 Ensures that the rectangle's width and height have positive values.
1240 For example, if the rectangle's co-ordinates are such that the top is below
1241 the bottom, or the right hand side is to the left of the left hand side, normalisation
1242 swaps the co-ordinates of the top and bottom or of the left and right.
1263 EXPORT_C TBool TRect::Contains(const TPoint &aPoint) const
1265 Tests whether a point is located within the rectangle.
1267 Note that a point located on the top or left hand side of the rectangle is
1268 within the rectangle. A point located on the right hand side or bottom is
1269 considered to be outside the rectangle.
1271 @param aPoint The point to be tested.
1273 @return True, if the point is within the rectangle; false, otherwise.
1276 if (aPoint.iX<iTl.iX || aPoint.iX>=iBr.iX || aPoint.iY<iTl.iY || aPoint.iY>=iBr.iY)
1284 EXPORT_C TSize TRect::Size() const
1286 Gets the size of the rectangle.
1288 @return The size of the rectangle.
1291 return((iBr-iTl).AsSize());
1297 EXPORT_C TInt TRect::Width() const
1299 Gets the width of the rectangle.
1301 @return The width of the rectangle.
1304 return(iBr.iX-iTl.iX);
1310 EXPORT_C TInt TRect::Height() const
1312 Gets the height of the rectangle.
1314 @return The height of the rectangle.
1317 return(iBr.iY-iTl.iY);
1323 EXPORT_C TBool TRect::IsNormalized() const
1325 Tests whether the rectangle is normalised.
1327 A rectangle is normalised when its width and height are both zero or greater.
1329 @return True, if normalised; false, if not.
1332 return((iBr.iX>=iTl.iX) && (iBr.iY>=iTl.iY));
1338 EXPORT_C TPoint TRect::Center() const
1340 Gets the point at the centre of the rectangle.
1342 @return The point at the centre of the rectangle.
1345 return(TPoint((iTl.iX+iBr.iX)/2,(iTl.iY+iBr.iY)/2));
1351 EXPORT_C void TRect::SetSize(const TSize &aSize)
1353 Sets the size of the rectangle.
1355 Only the co-ordinates of the bottom right hand corner of the rectangle are
1358 @param aSize The new width is aSize.iWidth. The new height is aSize.iHeight.
1367 EXPORT_C void TRect::SetWidth(TInt aWidth)
1369 Sets the width of the rectangle.
1371 Only the position of the rectangle's right hand side is affected.
1373 @param aWidth The new width of the rectangle.
1376 iBr.iX=iTl.iX+aWidth;
1382 EXPORT_C void TRect::SetHeight(TInt aHeight)
1384 Sets the height of the rectangle.
1386 Only the position of the bottom of the rectangle is affected.
1388 @param aHeight The new height of the rectangle.
1391 iBr.iY=iTl.iY+aHeight;