os/kernelhwsrv/kernel/eka/euser/us_graph.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/euser/us_graph.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,1392 @@
     1.4 +// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32\euser\us_graph.cpp
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#include "us_std.h"
    1.22 +
    1.23 +
    1.24 +
    1.25 +
    1.26 +EXPORT_C TBool TPoint::operator==(const TPoint& aPoint) const
    1.27 +/**
    1.28 +Compares two points for equality.
    1.29 +
    1.30 +For two points to be equal, both their x and y co-ordinate values must be 
    1.31 +equal.
    1.32 +
    1.33 +@param aPoint The point to be compared with this point.
    1.34 +
    1.35 +@return True, if the two points are equal; false, otherwise.
    1.36 +*/
    1.37 +	{
    1.38 +
    1.39 +	return(iX==aPoint.iX && iY==aPoint.iY);
    1.40 +	}
    1.41 +
    1.42 +
    1.43 +
    1.44 +
    1.45 +EXPORT_C TBool TPoint::operator!=(const TPoint& aPoint) const
    1.46 +/**
    1.47 +Compares two points for inequality.
    1.48 +
    1.49 +For two points to be unequal, either their x or their y co-ordinate values 
    1.50 +must be different.
    1.51 +
    1.52 +@param aPoint The point to be compared with this point.
    1.53 +
    1.54 +@return True, if the two points are unequal; false, otherwise.
    1.55 +*/
    1.56 +	{
    1.57 +
    1.58 +	return(iX!=aPoint.iX || iY!=aPoint.iY);
    1.59 +	}
    1.60 +
    1.61 +
    1.62 +
    1.63 +
    1.64 +EXPORT_C TPoint& TPoint::operator-=(const TPoint& aPoint)
    1.65 +/**
    1.66 +TPoint subtraction assignment operator.
    1.67 +
    1.68 +The operator subtracts the specified point from this point, and assigns the 
    1.69 +result back to this point.
    1.70 +
    1.71 +@param aPoint The point to be subtracted.
    1.72 +
    1.73 +@return A reference to this point object.
    1.74 +*/
    1.75 +	{
    1.76 +
    1.77 +	iX-=aPoint.iX;
    1.78 +	iY-=aPoint.iY;
    1.79 +	return(*this);
    1.80 +	}
    1.81 +
    1.82 +
    1.83 +
    1.84 +
    1.85 +EXPORT_C TPoint& TPoint::operator-=(const TSize& aSize)
    1.86 +/**
    1.87 +TSize subtraction assignment operator.
    1.88 +
    1.89 +The operator subtracts the specified TSize from this point, and assigns the 
    1.90 +result back to this point.
    1.91 +
    1.92 +The operation proceeds by:
    1.93 +
    1.94 +1. subtracting the width value of the TSize from the x co-ordinate value
    1.95 +
    1.96 +2. subtracting the height value of the TSize from the y co-ordinate value
    1.97 +
    1.98 +@param aSize The TSize to be subtracted.
    1.99 +
   1.100 +@return A reference to this point object.
   1.101 +*/
   1.102 +	{
   1.103 +
   1.104 +	iX-=aSize.iWidth;
   1.105 +	iY-=aSize.iHeight;
   1.106 +	return(*this);
   1.107 +	}
   1.108 +
   1.109 +
   1.110 +
   1.111 +
   1.112 +EXPORT_C TPoint& TPoint::operator+=(const TPoint& aPoint)
   1.113 +/**
   1.114 +TPoint addition assignment operator. 
   1.115 +
   1.116 +The operator adds the specified point to this point, and assigns the result 
   1.117 +back to this point.
   1.118 +
   1.119 +@param aPoint The point to be added.
   1.120 +
   1.121 +@return A reference to this point object.
   1.122 +*/
   1.123 +	{
   1.124 +
   1.125 +	iX+=aPoint.iX;
   1.126 +	iY+=aPoint.iY;
   1.127 +	return(*this);
   1.128 +	}
   1.129 +
   1.130 +
   1.131 +
   1.132 +
   1.133 +EXPORT_C TPoint& TPoint::operator+=(const TSize& aSize)
   1.134 +/**
   1.135 +TSize addition assignment operator. 
   1.136 +
   1.137 +The operator adds the specified TSize to this point, and assigns the result 
   1.138 +back to this point.
   1.139 +
   1.140 +The operation proceeds by:
   1.141 +
   1.142 +1. adding the width value of the TSize to the x co-ordinate value
   1.143 +
   1.144 +2. adding the height value of the TSize to the y co-ordinate value
   1.145 +
   1.146 +@param aSize The TSize to be added to this point. 
   1.147 +
   1.148 +@return A reference to this point object.
   1.149 +*/
   1.150 +	{
   1.151 +
   1.152 +	iX+=aSize.iWidth;
   1.153 +	iY+=aSize.iHeight;
   1.154 +	return(*this);
   1.155 +	}
   1.156 +
   1.157 +
   1.158 +
   1.159 +
   1.160 +EXPORT_C TPoint TPoint::operator-(const TPoint& aPoint) const
   1.161 +/**
   1.162 +TPoint subtraction operator.
   1.163 +
   1.164 +The operator subtracts the specified point from this point, and returns the 
   1.165 +resulting value.
   1.166 +
   1.167 +@param aPoint The point to be subtracted from this point. 
   1.168 +
   1.169 +@return The result of the operation.
   1.170 +*/
   1.171 +	{
   1.172 +
   1.173 +	TPoint ret=* this;
   1.174 +	ret-= aPoint;
   1.175 +	return(ret);
   1.176 +	}
   1.177 +
   1.178 +
   1.179 +
   1.180 +
   1.181 +EXPORT_C TPoint TPoint::operator-(const TSize& aSize) const
   1.182 +/**
   1.183 +TSize subtraction operator. 
   1.184 +
   1.185 +The operator subtracts the specified TSize from this point, and returns the 
   1.186 +resulting value.
   1.187 +
   1.188 +The operation proceeds by:
   1.189 +
   1.190 +1. subtracting the width value of the TSize from the x co-ordinate value
   1.191 +
   1.192 +2. subtracting the height value of the TSize from the y co-ordinate value.
   1.193 +
   1.194 +@param aSize The TSize to be subtracted.
   1.195 +
   1.196 +@return The result of the operation.
   1.197 +*/
   1.198 +	{
   1.199 +
   1.200 +	TPoint ret=* this;
   1.201 +	ret-= aSize;
   1.202 +	return(ret);
   1.203 +	}
   1.204 +
   1.205 +
   1.206 +
   1.207 +
   1.208 +EXPORT_C TPoint TPoint::operator+(const TPoint& aPoint) const
   1.209 +/**
   1.210 +The operator adds the specified point to this point, and returns the resulting 
   1.211 +value.
   1.212 +
   1.213 +@param aPoint The point to be added to this point.
   1.214 +
   1.215 +@return The result of the operation.
   1.216 +*/
   1.217 +	{
   1.218 +
   1.219 +	TPoint ret=* this;
   1.220 +	ret+= aPoint;
   1.221 +	return(ret);
   1.222 +	}
   1.223 +
   1.224 +
   1.225 +
   1.226 +
   1.227 +EXPORT_C TPoint TPoint::operator+(const TSize& aSize) const
   1.228 +/**
   1.229 +TSize addition operator. 
   1.230 +
   1.231 +The operator adds the specified TSize to this point, and returns the resulting 
   1.232 +value.
   1.233 +
   1.234 +The operation proceeds by:
   1.235 +
   1.236 +1. adding the width value of the TSize to the x co-ordinate value
   1.237 +
   1.238 +2. adding the height value of the TSize to the y co-ordinate value.
   1.239 +
   1.240 +@param aSize The TSize to be added to this TPoint. 
   1.241 +
   1.242 +@return The result of the operation.
   1.243 +*/
   1.244 +	{
   1.245 +
   1.246 +	TPoint ret=* this;
   1.247 +	ret+= aSize;
   1.248 +	return(ret);
   1.249 +	}
   1.250 +
   1.251 +
   1.252 +
   1.253 +
   1.254 +EXPORT_C TPoint TPoint::operator-() const
   1.255 +/**
   1.256 +Unary minus operator.
   1.257 +
   1.258 +The operator returns the negation of this point.
   1.259 +
   1.260 +@return The result of the operation.
   1.261 +*/
   1.262 +	{
   1.263 +
   1.264 +	return TPoint(-iX,-iY);
   1.265 +	}
   1.266 +
   1.267 +
   1.268 +
   1.269 +
   1.270 +EXPORT_C void TPoint::SetXY(TInt aX,TInt aY)
   1.271 +/**
   1.272 +Sets the x and y co-ordinates for this point.
   1.273 +
   1.274 +@param aX The value to assign to the x co-ordinate. 
   1.275 +@param aY The value to assign to the y co-ordinate.
   1.276 +*/
   1.277 +	{
   1.278 +
   1.279 +	iX=aX;
   1.280 +	iY=aY;
   1.281 +	}
   1.282 +
   1.283 +
   1.284 +
   1.285 +
   1.286 +EXPORT_C TSize TPoint::AsSize() const
   1.287 +/**
   1.288 +Gets the size of the rectangle whose top left hand corner is the origin of 
   1.289 +the screen co-ordinates and whose bottom right hand corner is this point.
   1.290 +
   1.291 +@return The co-ordinates of this point converted to a size.
   1.292 +*/
   1.293 +	{
   1.294 +	return(TSize(iX,iY));
   1.295 +	}
   1.296 +
   1.297 +
   1.298 +
   1.299 +
   1.300 +
   1.301 +EXPORT_C TBool TPoint3D::operator==(const TPoint3D& aPoint3D) const
   1.302 +/**
   1.303 +Compares two 3D points(TPoint3D) for equality.
   1.304 +
   1.305 +For two TPoint3D to be equal, their x , y and zco-ordinate values must be 
   1.306 +equal.
   1.307 +
   1.308 +@param aPoint3D The point to be compared with this point.
   1.309 +
   1.310 +@return True, if the two points are equal; false, otherwise.
   1.311 +*/
   1.312 +	{
   1.313 +	return(iX==aPoint3D.iX && iY==aPoint3D.iY && iZ==aPoint3D.iZ);
   1.314 +	}
   1.315 +
   1.316 +
   1.317 +
   1.318 +
   1.319 +EXPORT_C TBool TPoint3D::operator!=(const TPoint3D& aPoint3D) const
   1.320 +/**
   1.321 +Compares two 3D points for inequality.
   1.322 +
   1.323 +For two points to be unequal, their x  or y or z co-ordinate values 
   1.324 +must be different.
   1.325 +
   1.326 +@param aPoint3D The point to be compared with this point.
   1.327 +
   1.328 +@return True, if the two points are unequal; false, otherwise.
   1.329 +*/
   1.330 +	{
   1.331 +	return(iX!=aPoint3D.iX || iY!=aPoint3D.iY || iZ!=aPoint3D.iZ);
   1.332 +	}
   1.333 +
   1.334 +
   1.335 +
   1.336 +
   1.337 +
   1.338 +
   1.339 +EXPORT_C TPoint3D& TPoint3D::operator-=(const TPoint3D& aPoint3D)
   1.340 +/**
   1.341 +TPoint3D subtraction assignment operator.
   1.342 +
   1.343 +The operator subtracts the specified point from this point, and assigns the 
   1.344 +result back to this point.
   1.345 +
   1.346 +@param aPoint The point to be subtracted.
   1.347 +
   1.348 +@return A reference to this point object.
   1.349 +*/
   1.350 +	{
   1.351 +	iX-=aPoint3D.iX;
   1.352 +	iY-=aPoint3D.iY;
   1.353 +	iZ-=aPoint3D.iZ;
   1.354 +	return(*this);
   1.355 +	}
   1.356 +
   1.357 +
   1.358 +
   1.359 +EXPORT_C TPoint3D& TPoint3D::operator-=(const TPoint& aPoint)
   1.360 +
   1.361 +/**
   1.362 +TPoint subtraction assignment operator.
   1.363 +
   1.364 +The operator subtracts the specified TPoint from this point(TPoint3D), and assigns the 
   1.365 +result back to this point.
   1.366 +
   1.367 +The operation proceeds by
   1.368 +subtracting x and y cordinates of the TPoin to this point and no changes  to the Z-coordinatete value
   1.369 +
   1.370 +@param aPoint The aPoint to be subtracted.
   1.371 +
   1.372 +@return A reference to this point object.
   1.373 +*/
   1.374 +	{
   1.375 +	iX-=aPoint.iX;
   1.376 +	iY-=aPoint.iY;
   1.377 +	//No Changes to the z co-ordinate
   1.378 +	return(*this);
   1.379 +	}
   1.380 +
   1.381 +
   1.382 +
   1.383 +EXPORT_C TPoint3D& TPoint3D::operator+=(const TPoint3D& aPoint3D)
   1.384 +/**
   1.385 +TPoint3D addition assignment operator. 
   1.386 +
   1.387 +The operator adds the specified point to this point, and assigns the result 
   1.388 +back to this point.
   1.389 +
   1.390 +@param aPoint3D The point to be added.
   1.391 +
   1.392 +@return A reference to this point object.
   1.393 +*/
   1.394 +	{
   1.395 +	iX+=aPoint3D.iX;
   1.396 +	iY+=aPoint3D.iY;
   1.397 +	iZ+=aPoint3D.iZ;
   1.398 +	return(*this);
   1.399 +	}
   1.400 +
   1.401 +EXPORT_C TPoint3D& TPoint3D::operator+=(const TPoint& aPoint)
   1.402 +/**
   1.403 +TPoint addition assignment operator. 
   1.404 +
   1.405 +The operator adds the specified TPoint to this point, and assigns the result 
   1.406 +back to this point.
   1.407 +
   1.408 +The operation proceeds by:
   1.409 +adding  x and y cordinates of the TPoin to this point and no changes  to the Z-coordinatete value
   1.410 +
   1.411 +@param aPoint The TPoint to be added to this point. 
   1.412 +
   1.413 +@return A reference to this point object.
   1.414 +*/
   1.415 +	{
   1.416 +
   1.417 +	iX+=aPoint.iX;
   1.418 +	iY+=aPoint.iY;
   1.419 +	//No Changes to the z co-ordinate
   1.420 +	return(*this);
   1.421 +	}
   1.422 +EXPORT_C TPoint3D TPoint3D::operator-(const TPoint3D& aPoint3D) const
   1.423 +/**
   1.424 +TPoint3D subtraction operator.
   1.425 +
   1.426 +The operator subtracts the specified point from this point, and returns the 
   1.427 +resulting value.
   1.428 +
   1.429 +@param aPoint3D The point to be subtracted from this point. 
   1.430 +
   1.431 +@return the point(TPoint3D) which is the  result of the operation.
   1.432 +*/
   1.433 +	{
   1.434 +
   1.435 +	TPoint3D ret=* this;
   1.436 +	ret-= aPoint3D;
   1.437 +	return(ret);
   1.438 +	}
   1.439 +
   1.440 +
   1.441 +
   1.442 +EXPORT_C TPoint3D TPoint3D::operator-(const TPoint& aPoint) const
   1.443 +/**
   1.444 +TPoint subtraction operator. 
   1.445 +
   1.446 +The operator subtracts the specified TPoint from this point, and returns the 
   1.447 +resulting value.
   1.448 +
   1.449 +@param aPoint The TPoint to be subtracted.
   1.450 +
   1.451 +@return the point(TPoint3D) which is the  result of the operation.
   1.452 +*/
   1.453 +	{
   1.454 +
   1.455 +	TPoint3D ret=* this;
   1.456 +	ret-= aPoint;
   1.457 +	return(ret);
   1.458 +	}
   1.459 +
   1.460 +
   1.461 +EXPORT_C TPoint3D TPoint3D::operator+(const TPoint3D& aPoint3D) const
   1.462 +/**
   1.463 +The operator adds the specified point to this point, and returns the resulting 
   1.464 +value.
   1.465 +
   1.466 +@param aPoint3D The point to be added to this point.
   1.467 +
   1.468 +@return the point(TPoint3D) which is the  result of the operation.
   1.469 +*/
   1.470 +	{
   1.471 +
   1.472 +	TPoint3D ret=* this;
   1.473 +	ret+= aPoint3D;
   1.474 +	return(ret);
   1.475 +	}
   1.476 +
   1.477 +EXPORT_C TPoint3D TPoint3D::operator+(const TPoint& aPoint) const
   1.478 +/**
   1.479 +TPoint addition operator. 
   1.480 +
   1.481 +The operator adds the specified TPoint to this point, and returns the resulting 
   1.482 +value.
   1.483 +
   1.484 +@param aSize The TSize to be added to this TPoint. 
   1.485 +
   1.486 +@return the point(TPoint3D) which is the  result of the operation.
   1.487 +*/
   1.488 +	{
   1.489 +
   1.490 +	TPoint3D ret=* this;
   1.491 +	ret+= aPoint;
   1.492 +	return(ret);
   1.493 +	}
   1.494 +
   1.495 +
   1.496 +EXPORT_C TPoint3D TPoint3D::operator-() const
   1.497 +/**
   1.498 +Unary minus operator.
   1.499 +
   1.500 +The operator returns the negation of this point.
   1.501 +
   1.502 +@return the point(TPoint3D) which is the  result of Unary minus operation.
   1.503 +*/
   1.504 +	{
   1.505 +	return TPoint3D(-iX,-iY,-iZ);
   1.506 +	}
   1.507 +
   1.508 +
   1.509 +
   1.510 +EXPORT_C void TPoint3D::SetXYZ(TInt aX,TInt aY,TInt aZ)
   1.511 +/**
   1.512 +Sets the x , y and z co-ordinates for this point.
   1.513 +
   1.514 +@param aX The value to assign to the x co-ordinate. 
   1.515 +@param aY The value to assign to the y co-ordinate.
   1.516 +@param aZ The value to assign to the z co-ordinate.
   1.517 +*/
   1.518 +	{
   1.519 +	iX=aX;
   1.520 +	iY=aY;
   1.521 +	iZ=aZ;
   1.522 +	}
   1.523 +
   1.524 +EXPORT_C void TPoint3D::SetPoint(const TPoint& aPoint)
   1.525 +/*
   1.526 +TPoint3D from TPoint, sets the Z co-ordinate to  Zero
   1.527 +@param aPoint The TPoint to add to this point 
   1.528 +*/
   1.529 +	{
   1.530 +	iX=aPoint.iX;
   1.531 +	iY=aPoint.iY;
   1.532 +	iZ=0;
   1.533 +	}
   1.534 +	
   1.535 +
   1.536 +EXPORT_C TPoint TPoint3D::AsPoint() const
   1.537 +/**
   1.538 +Gets Tpoint from Tpoint3D
   1.539 +@return TPoint from X and Y cordinates of Tpoint3D
   1.540 +*/
   1.541 +	{
   1.542 +	return(TPoint(iX,iY));
   1.543 +	}
   1.544 +
   1.545 +
   1.546 +
   1.547 +
   1.548 +
   1.549 +
   1.550 +EXPORT_C TBool TSize::operator==(const TSize& aSize) const
   1.551 +/**
   1.552 +Compares this TSize with the specified TSize for equality. 
   1.553 +
   1.554 +For two TSizes to be equal, both their width and height values must be equal.
   1.555 +
   1.556 +@param aSize The TSize to be compared with this TSize.
   1.557 +
   1.558 +@return True, if the two TSize are equal; false, otherwise.
   1.559 +*/
   1.560 +	{
   1.561 +	return(iWidth==aSize.iWidth && iHeight==aSize.iHeight);
   1.562 +	}
   1.563 +
   1.564 +
   1.565 +
   1.566 +
   1.567 +EXPORT_C TBool TSize::operator!=(const TSize& aSize) const
   1.568 +/**
   1.569 +Compares two TSize for inequality.
   1.570 +
   1.571 +For two TSize to be unequal, either their width or height values must be different.
   1.572 +
   1.573 +@param aSize The TSize to be compared with this TSize. 
   1.574 +
   1.575 +@return True, if the two TSize are unequal; false, otherwise.
   1.576 +*/
   1.577 +	{
   1.578 +	return(iWidth!=aSize.iWidth || iHeight!=aSize.iHeight);
   1.579 +	}
   1.580 +
   1.581 +
   1.582 +
   1.583 +
   1.584 +EXPORT_C TSize& TSize::operator-=(const TSize& aSize)
   1.585 +/**
   1.586 +TSize subtraction assignment operator.
   1.587 +
   1.588 +The operator subtracts the specified TSize from this TSize, and assigns the 
   1.589 +result back to this TSize.
   1.590 +
   1.591 +@param aSize The TSize to be subtracted. 
   1.592 +
   1.593 +@return A reference to this TSize object.
   1.594 +*/
   1.595 +	{
   1.596 +	iWidth-=aSize.iWidth;iHeight-=aSize.iHeight;return(*this);
   1.597 +	}
   1.598 +
   1.599 +
   1.600 +
   1.601 +
   1.602 +EXPORT_C TSize& TSize::operator-=(const TPoint& aPoint)
   1.603 +/**
   1.604 +TPoint subtraction assignment operator.
   1.605 +
   1.606 +The operator subtracts the specified point from this TSize, and assigns the 
   1.607 +result back to this TSize.
   1.608 +
   1.609 +The operation proceeds by:
   1.610 +
   1.611 +1. subtracting the point's x co-ordinate value from the width
   1.612 +
   1.613 +2. subtracting the point's y co-ordinate value from the height.
   1.614 +
   1.615 +@param aPoint The point to be subtracted.
   1.616 +
   1.617 +@return A reference to this size object.
   1.618 +*/
   1.619 +	{
   1.620 +	iWidth-=aPoint.iX;iHeight-=aPoint.iY;return(*this);
   1.621 +	}
   1.622 +
   1.623 +
   1.624 +
   1.625 +
   1.626 +EXPORT_C TSize& TSize::operator+=(const TSize& aSize)
   1.627 +/**
   1.628 +TSize addition assignment operator.
   1.629 +
   1.630 +The operator adds the specified TSize to this TSize, and assigns the result 
   1.631 +back to this TSize.
   1.632 +
   1.633 +@param aSize The TSize to be added.
   1.634 +
   1.635 +@return A reference to this size object.
   1.636 +*/
   1.637 +	{
   1.638 +	iWidth+=aSize.iWidth;iHeight+=aSize.iHeight;return(*this);
   1.639 +	}
   1.640 +
   1.641 +
   1.642 +
   1.643 +
   1.644 +EXPORT_C TSize& TSize::operator+=(const TPoint& aPoint)
   1.645 +/**
   1.646 +TPoint addition assignment operator.
   1.647 +
   1.648 +The operator adds the specified point to this TSize, and assigns the result 
   1.649 +back to this TSize.
   1.650 +
   1.651 +The operation proceeds by:
   1.652 +
   1.653 +1. adding the point's x co-ordinate value to the width
   1.654 +
   1.655 +2. adding the point's y co-ordinate value to the height.
   1.656 +
   1.657 +@param aPoint The point to be added.
   1.658 +
   1.659 +@return A reference to this size object.
   1.660 +*/
   1.661 +	{
   1.662 +	iWidth+=aPoint.iX;iHeight+=aPoint.iY;return(*this);
   1.663 +	}
   1.664 +
   1.665 +
   1.666 +
   1.667 +
   1.668 +EXPORT_C TSize TSize::operator-(const TSize& aSize) const
   1.669 +/**
   1.670 +TSize subtraction operator.
   1.671 +
   1.672 +This operator subtracts the specified TSize from this TSize, and returns the 
   1.673 +resulting value.
   1.674 +
   1.675 +@param aSize The TSize to be subtracted from this Tsize.
   1.676 +
   1.677 +@return The result of the operation.
   1.678 +*/
   1.679 +	{
   1.680 +	TSize ret=* this; ret-= aSize ;return(ret);
   1.681 +	}
   1.682 +
   1.683 +
   1.684 +
   1.685 +
   1.686 +EXPORT_C TSize TSize::operator-(const TPoint& aPoint) const
   1.687 +/**
   1.688 +TPoint subtraction operator.
   1.689 +
   1.690 +This operator subtracts the specified point from this TSize, and returns the 
   1.691 +resulting value.
   1.692 +
   1.693 +The operation proceeds by:
   1.694 +
   1.695 +1. subtracting the x co-ordinate value from the width
   1.696 +
   1.697 +2. subtracting the y co-ordinate value from the height
   1.698 +
   1.699 +@param aPoint The point to be subtracted.
   1.700 +
   1.701 +@return The result of the operation.
   1.702 +*/
   1.703 +	{
   1.704 +	TSize ret=* this; ret-= aPoint ;return(ret);
   1.705 +	}
   1.706 +
   1.707 +
   1.708 +
   1.709 +
   1.710 +EXPORT_C TSize TSize::operator+(const TSize& aSize) const
   1.711 +/**
   1.712 +TSize addition operator.
   1.713 +
   1.714 +This operator adds the specified TSize to this TSize, and returns the resulting 
   1.715 +value.
   1.716 +
   1.717 +@param aSize The TSize to be added to this Tsize. 
   1.718 +
   1.719 +@return The result of the operation.
   1.720 +*/
   1.721 +	{
   1.722 +	TSize ret=* this; ret+= aSize ;return(ret);
   1.723 +	}
   1.724 +
   1.725 +
   1.726 +
   1.727 +
   1.728 +EXPORT_C TSize TSize::operator+(const TPoint& aPoint) const
   1.729 +/**
   1.730 +TPoint addition operator.
   1.731 +
   1.732 +This operator adds the specified point to this TSize, and returns the resulting 
   1.733 +value.
   1.734 +
   1.735 +The operation proceeds by:
   1.736 +
   1.737 +1. adding the x co-ordinate value to the width
   1.738 +
   1.739 +2. adding the y co-ordinate value to the height
   1.740 +
   1.741 +@param aPoint The point to be added to this TSize. 
   1.742 +
   1.743 +@return The result of the operation.
   1.744 +*/
   1.745 +	{
   1.746 +	TSize ret=* this; ret+= aPoint ;return(ret);
   1.747 +	}
   1.748 +
   1.749 +
   1.750 +
   1.751 +
   1.752 +EXPORT_C TSize TSize::operator-() const
   1.753 +/**
   1.754 +Unary minus operator.
   1.755 +
   1.756 +The operator returns the negation of this TSize.
   1.757 +
   1.758 +@return The result of the operation.
   1.759 +*/
   1.760 +	{
   1.761 +
   1.762 +	return TSize(-iWidth,-iHeight);
   1.763 +	}
   1.764 +
   1.765 +
   1.766 +
   1.767 +
   1.768 +EXPORT_C void TSize::SetSize(TInt aWidth,TInt aHeight)
   1.769 +/**
   1.770 +Sets the width and height.
   1.771 +
   1.772 +@param aWidth The width value. 
   1.773 +@param aHeight The height value.
   1.774 +*/
   1.775 +	{
   1.776 +	iWidth=aWidth;iHeight=aHeight;
   1.777 +	}
   1.778 +
   1.779 +
   1.780 +
   1.781 +
   1.782 +EXPORT_C TPoint TSize::AsPoint() const
   1.783 +/**
   1.784 +Gets a TPoint object whose co-ordinates are the width and height of this TSize.
   1.785 +
   1.786 +@return The co-ordinates of this TSize converted to a point.
   1.787 +*/
   1.788 +	{
   1.789 +	return(TPoint(iWidth,iHeight));
   1.790 +	}
   1.791 +
   1.792 +
   1.793 +
   1.794 +
   1.795 +EXPORT_C TRect::TRect()	: iTl(0,0),iBr(0,0)
   1.796 +/**
   1.797 +Constructs a default rectangle.
   1.798 +
   1.799 +This initialises the co-ordinates of its top 
   1.800 +left and bottom right corners to (0,0).
   1.801 +*/
   1.802 +	{}
   1.803 +	
   1.804 +	
   1.805 +	
   1.806 +	
   1.807 +EXPORT_C TRect::TRect(TInt aAx,TInt aAy,TInt aBx,TInt aBy) : iTl(aAx,aAy),iBr(aBx,aBy)
   1.808 +/**
   1.809 +Constructs the rectangle, initialising its top left and bottom right hand corners 
   1.810 +with four TInt values.
   1.811 +
   1.812 +@param aAx The horizontal co-ordinate of the left hand side of the rectangle. 
   1.813 +@param aAy The vertical co-ordinate of the top of the rectangle. 
   1.814 +@param aBx The horizontal co-ordinate of the right hand side of the rectangle. 
   1.815 +@param aBy The vertical co-ordinate of the bottom of the rectangle.
   1.816 +*/
   1.817 +	{}
   1.818 +	
   1.819 +	
   1.820 +	
   1.821 +	
   1.822 +EXPORT_C TRect::TRect(const TPoint& aPointA,const TPoint& aPointB) : iTl(aPointA),iBr(aPointB)
   1.823 +/**
   1.824 +Constructs the rectangle with two TPoints, corresponding to its top left and 
   1.825 +bottom right hand corners.
   1.826 +
   1.827 +@param aPointA The co-ordinates of the rectangle's top left hand corner. 
   1.828 +@param aPointB The co-ordinates of the rectangle's bottom right hand corner.
   1.829 +*/
   1.830 +	{}
   1.831 +	
   1.832 +	
   1.833 +	
   1.834 +	
   1.835 +EXPORT_C TRect::TRect(const TPoint& aPoint,const TSize& aSize) : iTl(aPoint),iBr(aPoint+aSize)
   1.836 +/**
   1.837 +Constructs the rectangle with a TPoint for its top left corner, and a TSize 
   1.838 +for its width and height.
   1.839 +
   1.840 +@param aPoint The rectangle's top left hand corner. 
   1.841 +@param aSize  The rectangle's width and height.
   1.842 +*/
   1.843 +	{}
   1.844 +	
   1.845 +	
   1.846 +	
   1.847 +	
   1.848 +EXPORT_C TRect::TRect(const TSize& aSize) : iTl(0,0), iBr(aSize.iWidth, aSize.iHeight)
   1.849 +/**
   1.850 +Constructs the rectangle with a TSize.
   1.851 +
   1.852 +The co-ordinates of its top left hand corner are initialised to (0,0) and
   1.853 +its width and height are initialised to the values contained in the argument.
   1.854 +
   1.855 +@param aSize The width and height of the rectangle.
   1.856 +*/
   1.857 +	{}
   1.858 +	
   1.859 +	
   1.860 +	
   1.861 +
   1.862 +EXPORT_C void TRect::SetRect(TInt aTlX,TInt aTlY,TInt aBrX,TInt aBrY)
   1.863 +/**
   1.864 +Sets the rectangle's position using four TInts.
   1.865 +	
   1.866 +@param aTlX The horizontal co-ordinate of the left hand side of the rectangle. 
   1.867 +@param aTlY The vertical co-ordinate of the top of the rectangle. 
   1.868 +@param aBrX The horizontal co-ordinate of the right hand side of the rectangle. 
   1.869 +@param aBrY The vertical co-ordinate of the bottom of the rectangle.
   1.870 +*/
   1.871 +	{
   1.872 +	iTl.iX=aTlX;iTl.iY=aTlY;iBr.iX=aBrX;iBr.iY=aBrY;
   1.873 +	}
   1.874 +	
   1.875 +	
   1.876 +	
   1.877 +
   1.878 +EXPORT_C void TRect::SetRect(const TPoint& aPointTL,const TPoint& aPointBR)
   1.879 +/**
   1.880 +Sets the rectangle's position using two TPoints.
   1.881 +
   1.882 +@param aPointTL The co-ordinates of the rectangle's top left hand corner. 
   1.883 +@param aPointBR The co-ordinates of the rectangle's bottom right hand corner.
   1.884 +*/
   1.885 +	{
   1.886 +	iTl=aPointTL;iBr=aPointBR;
   1.887 +	}
   1.888 +
   1.889 +
   1.890 +
   1.891 +
   1.892 +EXPORT_C void TRect::SetRect(const TPoint& aTL,const TSize& aSize)
   1.893 +/**
   1.894 +Sets the rectangle's position using a TPoint and a TSize.
   1.895 +	
   1.896 +@param aTL    The co-ordinates of the rectangle's top left hand corner. 
   1.897 +@param aSize  The rectangle's width and height.
   1.898 +*/
   1.899 +	{
   1.900 +	iTl=aTL;iBr=aTL+aSize;
   1.901 +	}
   1.902 +
   1.903 +
   1.904 +
   1.905 +
   1.906 +EXPORT_C void TRect::Shrink(TInt aDx,TInt aDy)
   1.907 +/**
   1.908 +Shrinks a rectangle using specified horizontal and vertical offsets. 
   1.909 +
   1.910 +The offset values are added to the co-ordinates of its top left hand corner, 
   1.911 +and the same values are subtracted from the co-ordinates of its bottom right 
   1.912 +hand corner. The co-ordinates of the centre of the rectangle remain unchanged. 
   1.913 +If either value is negative, the rectangle expands in the corresponding direction.
   1.914 +
   1.915 +@param aDx The number of pixels by which to move the left and right hand sides 
   1.916 +           of the rectangle. A positive value reduces the width, a negative
   1.917 +           value increases it. 
   1.918 +@param aDy The number of pixels by which to move the top and bottom of the 
   1.919 +           rectangle. A positive value reduces the height, a negative value
   1.920 +           increases it.
   1.921 +*/
   1.922 +	{
   1.923 +	Adjust(aDx,aDy);
   1.924 +	}
   1.925 +
   1.926 +
   1.927 +
   1.928 +
   1.929 +EXPORT_C void TRect::Shrink(const TSize& aSize)
   1.930 +/**
   1.931 +Shrinks a rectangle using a specified TSize offset.
   1.932 +
   1.933 +The rectangle shrinks by twice the value of the height and width specified 
   1.934 +in the TSize. The co-ordinates of the centre of the rectangle remain unchanged. 
   1.935 +If either value is negative, the rectangle expands in the
   1.936 +corresponding direction.
   1.937 +
   1.938 +@param aSize The number of pixels by which to move the left and right hand 
   1.939 +             sides of the rectangle (by aSize.iWidth) and the top and bottom
   1.940 +             (by aSize.iHeight).
   1.941 +*/
   1.942 +	{
   1.943 +	Adjust(aSize.iWidth,aSize.iHeight);
   1.944 +	}
   1.945 +
   1.946 +
   1.947 +
   1.948 +
   1.949 +EXPORT_C void TRect::Resize(const TSize& aSize)
   1.950 +/**
   1.951 +Resizes a rectangle by adding a TSize offset.
   1.952 +
   1.953 +The offset is added to the co-ordinates of its bottom right hand corner. If 
   1.954 +either value in the TSize is negative, the rectangle shrinks in the
   1.955 +corresponding direction. The co-ordinates of the rectangle's top left hand
   1.956 +corner are unaffected.
   1.957 +
   1.958 +@param aSize The number of pixels by which to move the rectangle; the right 
   1.959 +             hand side by aSize.iWidth and the bottom by aSize.iHeight.
   1.960 +*/
   1.961 +	{
   1.962 +	iBr+=aSize;
   1.963 +	}
   1.964 +
   1.965 +
   1.966 +
   1.967 +
   1.968 +EXPORT_C void TRect::Resize(TInt aDx, TInt aDy)
   1.969 +/**
   1.970 +Resizes a rectangle by adding a horizontal and vertical offset.
   1.971 +
   1.972 +The offset is added to the co-ordinates of its bottom right hand corner. If 
   1.973 +either value is negative, the rectangle shrinks in the corresponding direction.
   1.974 +The co-ordinates of the rectangle's top left hand corner are unaffected.
   1.975 +
   1.976 +@param aDx The number of pixels by which to move the right hand side of the 
   1.977 +           rectangle. 
   1.978 +@param aDy The number of pixels by which to move the bottom of the rectangle.
   1.979 +*/
   1.980 +	{
   1.981 +	iBr.iX+=aDx;iBr.iY+=aDy;
   1.982 +	}
   1.983 +
   1.984 +
   1.985 +
   1.986 +
   1.987 +EXPORT_C TBool TRect::operator==(const TRect &aRect) const
   1.988 +/**
   1.989 +Compares two rectangles for equality.
   1.990 +
   1.991 +For two rectangles to be equal, the co-ordinates of both their top left and 
   1.992 +bottom right hand corners must be equal.
   1.993 +
   1.994 +@param aRect The rectangle to compare with this rectangle.
   1.995 +
   1.996 +@return True, if the rectangles have the same co-ordinates; false, otherwise.
   1.997 +*/
   1.998 +	{
   1.999 +
  1.1000 +	return(iTl==aRect.iTl && iBr==aRect.iBr);
  1.1001 +	}
  1.1002 +
  1.1003 +
  1.1004 +
  1.1005 +
  1.1006 +EXPORT_C TBool TRect::operator!=(const TRect &aRect) const
  1.1007 +/**
  1.1008 +Compares two rectangles for inequality.
  1.1009 +
  1.1010 +Two rectangles are unequal if any of their co-ordinates differ.
  1.1011 +
  1.1012 +@param aRect The rectangle to compare with this rectangle.
  1.1013 +@return True, if the rectangles do not have the same co-ordinates; false, if 
  1.1014 +        all co-ordinates are equal.
  1.1015 +*/
  1.1016 +	{
  1.1017 +
  1.1018 +	return(iTl!=aRect.iTl || iBr!=aRect.iBr);
  1.1019 +	}
  1.1020 +
  1.1021 +
  1.1022 +
  1.1023 +
  1.1024 +EXPORT_C void TRect::Move(const TPoint &aOffset)
  1.1025 +/**
  1.1026 +Moves the rectangle by adding a TPoint offset.
  1.1027 +
  1.1028 +The offset is added to the co-ordinates of both its top left and bottom right 
  1.1029 +hand corners. The size of the rectangle is unchanged.
  1.1030 +
  1.1031 +@param aOffset The number of pixels to move the rectangle; horizontally by 
  1.1032 +               aOffset.iX and vertically by aOffset.iY.
  1.1033 +*/
  1.1034 +	{
  1.1035 +
  1.1036 +	iTl+=aOffset;
  1.1037 +	iBr+=aOffset;
  1.1038 +	}
  1.1039 +
  1.1040 +
  1.1041 +
  1.1042 +
  1.1043 +EXPORT_C void TRect::Move(TInt aDx,TInt aDy)
  1.1044 +/**
  1.1045 +Moves the rectangle by adding an x, y offset.
  1.1046 +
  1.1047 +The offset is added to the co-ordinates of both its top left and bottom right 
  1.1048 +hand corners. The size of the rectangle is unchanged.
  1.1049 +
  1.1050 +@param aDx The number of pixels to move the rectangle horizontally. If negative, 
  1.1051 +           the rectangle moves leftwards. 
  1.1052 +@param aDy The number of pixels to move the rectangle vertically. If negative, 
  1.1053 +           the rectangle moves upwards.
  1.1054 +*/
  1.1055 +	{
  1.1056 +
  1.1057 +	iTl.iX+=aDx;
  1.1058 +	iTl.iY+=aDy;
  1.1059 +	iBr.iX+=aDx;
  1.1060 +	iBr.iY+=aDy;
  1.1061 +	}
  1.1062 +
  1.1063 +
  1.1064 +
  1.1065 +
  1.1066 +// private function, hence not exported
  1.1067 +void TRect::Adjust(TInt aDx,TInt aDy)
  1.1068 +//
  1.1069 +// Adjust by a delta.
  1.1070 +//
  1.1071 +	{
  1.1072 +
  1.1073 +	iTl.iX+=aDx;
  1.1074 +	iTl.iY+=aDy;
  1.1075 +	iBr.iX-=aDx;
  1.1076 +	iBr.iY-=aDy;
  1.1077 +	}
  1.1078 +
  1.1079 +
  1.1080 +
  1.1081 +
  1.1082 +EXPORT_C void TRect::Grow(TInt aDx,TInt aDy)
  1.1083 +//
  1.1084 +// Grow by a delta.
  1.1085 +//
  1.1086 +/**
  1.1087 +Grows the rectangle using the specified horizontal and vertical offsets.
  1.1088 +
  1.1089 +The offset values are subtracted from the co-ordinates of its top left hand 
  1.1090 +corner, and the same values are added to the co-ordinates of its bottom right 
  1.1091 +hand corner. The co-ordinates of the centre of the rectangle remain unchanged. 
  1.1092 +If either value is negative, the rectangle shrinks in the corresponding direction.
  1.1093 +
  1.1094 +@param aDx The number of pixels by which to move the left and right hand sides 
  1.1095 +           of the rectangle. A positive value increases the width, a negative
  1.1096 +           value reduces it. 
  1.1097 +@param aDy The number of pixels by which to move the top and bottom of the 
  1.1098 +           rectangle. A positive value increases the height, a negative
  1.1099 +           value reduces it.
  1.1100 +*/
  1.1101 +	{
  1.1102 +
  1.1103 +	iTl.iX-=aDx;
  1.1104 +	iTl.iY-=aDy;
  1.1105 +	iBr.iX+=aDx;
  1.1106 +	iBr.iY+=aDy;
  1.1107 +	}
  1.1108 +
  1.1109 +
  1.1110 +
  1.1111 +
  1.1112 +EXPORT_C void TRect::Grow(const TSize &aSize)
  1.1113 +//
  1.1114 +// Grow by a size.
  1.1115 +//
  1.1116 +/**
  1.1117 +Grows a rectangle using the specified TSize offset.
  1.1118 +
  1.1119 +The rectangle grows by twice the value of the height and width specified in 
  1.1120 +the TSize. The co-ordinates of the centre of the rectangle remain unchanged. 
  1.1121 +If either value is negative, the rectangle shrinks in the
  1.1122 +corresponding direction.
  1.1123 +
  1.1124 +@param aSize The number of pixels by which to move the left and right hand 
  1.1125 +             sides of the rectangle (by aSize.iWidth) and the top and bottom
  1.1126 +             (by aSize.iHeight).
  1.1127 +*/
  1.1128 +	{
  1.1129 +
  1.1130 +	iTl-=aSize;
  1.1131 +	iBr+=aSize;
  1.1132 +	}
  1.1133 +
  1.1134 +
  1.1135 +
  1.1136 +
  1.1137 +EXPORT_C void TRect::BoundingRect(const TRect &aRect)
  1.1138 +//
  1.1139 +// Union of this and aRect, a union is defined as the minimum rectangle that encloses
  1.1140 +// both source rectangles
  1.1141 +//
  1.1142 +/** 
  1.1143 +Gets the minimal rectangle which bounds both this rectangle and the specified 
  1.1144 +rectangle, and assigns it to this rectangle.
  1.1145 +
  1.1146 +@param aRect The rectangle to use with this rectangle to get the minimal bounding 
  1.1147 +             rectangle.
  1.1148 +*/
  1.1149 +	{
  1.1150 +
  1.1151 +	if (iTl.iX>aRect.iTl.iX)
  1.1152 +		iTl.iX=aRect.iTl.iX;
  1.1153 +	if (iTl.iY>aRect.iTl.iY)
  1.1154 +		iTl.iY=aRect.iTl.iY;
  1.1155 +	if (iBr.iX<aRect.iBr.iX)
  1.1156 +		iBr.iX=aRect.iBr.iX;
  1.1157 +	if (iBr.iY<aRect.iBr.iY)
  1.1158 +		iBr.iY=aRect.iBr.iY;
  1.1159 +	}
  1.1160 +
  1.1161 +
  1.1162 +
  1.1163 +
  1.1164 +EXPORT_C TBool TRect::IsEmpty() const
  1.1165 +//
  1.1166 +// True if the rectangle is empty.
  1.1167 +//
  1.1168 +/**
  1.1169 +Tests whether the rectangle is empty.
  1.1170 +
  1.1171 +@return True, if empty; false, if not.
  1.1172 +*/
  1.1173 +	{
  1.1174 +
  1.1175 +	return(iTl.iX>=iBr.iX || iTl.iY>=iBr.iY);
  1.1176 +	}
  1.1177 +
  1.1178 +
  1.1179 +
  1.1180 +
  1.1181 +EXPORT_C void TRect::Intersection(const TRect &aRect)
  1.1182 +//
  1.1183 +// Intersect this with aRect.
  1.1184 +//
  1.1185 +/**
  1.1186 +Gets the area of intersection between this rectangle and the specified
  1.1187 +rectangle, and assigns it to this rectangle.
  1.1188 +
  1.1189 +It is usual to call TRect::Intersects() first to verify whether the two rectangles 
  1.1190 +intersect. If the two rectangles do not intersect, then, on return, this rectangle 
  1.1191 +is set to be empty.
  1.1192 +
  1.1193 +@param aRect The rectangle to be used with this rectangle to get the area
  1.1194 +             of intersection.
  1.1195 +             
  1.1196 +@see TRect::Intersects             
  1.1197 +*/
  1.1198 +	{
  1.1199 +
  1.1200 +	if (iTl.iX<aRect.iTl.iX)
  1.1201 +		iTl.iX=aRect.iTl.iX;
  1.1202 +	if (iTl.iY<aRect.iTl.iY)
  1.1203 +		iTl.iY=aRect.iTl.iY;
  1.1204 +	if (iBr.iX>aRect.iBr.iX)
  1.1205 +		iBr.iX=aRect.iBr.iX;
  1.1206 +	if (iBr.iY>aRect.iBr.iY)
  1.1207 +		iBr.iY=aRect.iBr.iY;
  1.1208 +	}
  1.1209 +
  1.1210 +
  1.1211 +
  1.1212 +
  1.1213 +EXPORT_C TBool TRect::Intersects(const TRect &aRect) const
  1.1214 +//
  1.1215 +// If aRect Intersects with this return True.
  1.1216 +//
  1.1217 +/**
  1.1218 +Tests whether this rectangle overlaps with the specified rectangle.
  1.1219 +
  1.1220 +Two rectangles overlap if any point is located within both rectangles. There 
  1.1221 +is no intersection if two adjacent sides touch without overlapping, or if 
  1.1222 +either rectangle is empty.
  1.1223 +
  1.1224 +@param aRect The rectangle to compare with this rectangle for an intersection. 
  1.1225 +
  1.1226 +@return True, if the two rectangles overlap; false, if there is no overlap.
  1.1227 +*/
  1.1228 +	{
  1.1229 +
  1.1230 +	return(!(IsEmpty() || aRect.IsEmpty() || iBr.iX<=aRect.iTl.iX || iBr.iY<=aRect.iTl.iY || iTl.iX>=aRect.iBr.iX || iTl.iY>=aRect.iBr.iY));
  1.1231 +	}
  1.1232 +
  1.1233 +
  1.1234 +
  1.1235 +
  1.1236 +EXPORT_C void TRect::Normalize()
  1.1237 +//
  1.1238 +// Make the conditions top left bottom right true.
  1.1239 +//
  1.1240 +/**
  1.1241 +Ensures that the rectangle's width and height have positive values.
  1.1242 +
  1.1243 +For example, if the rectangle's co-ordinates are such that the top is below 
  1.1244 +the bottom, or the right hand side is to the left of the left hand side, normalisation 
  1.1245 +swaps the co-ordinates of the top and bottom or of the left and right.
  1.1246 +*/
  1.1247 +	{
  1.1248 +
  1.1249 +	if (iTl.iX>iBr.iX)
  1.1250 +		{
  1.1251 +		TInt temp=iTl.iX;
  1.1252 +		iTl.iX=iBr.iX;
  1.1253 +		iBr.iX=temp;
  1.1254 +		}
  1.1255 +	if (iTl.iY>iBr.iY)
  1.1256 +		{
  1.1257 +		TInt temp=iTl.iY;
  1.1258 +		iTl.iY=iBr.iY;
  1.1259 +		iBr.iY=temp;
  1.1260 +		}
  1.1261 +	}
  1.1262 +
  1.1263 +
  1.1264 +
  1.1265 +
  1.1266 +EXPORT_C TBool TRect::Contains(const TPoint &aPoint) const
  1.1267 +/**
  1.1268 +Tests whether a point is located within the rectangle.
  1.1269 +
  1.1270 +Note that a point located on the top or left hand side of the rectangle is 
  1.1271 +within the rectangle. A point located on the right hand side or bottom is 
  1.1272 +considered to be outside the rectangle.
  1.1273 +
  1.1274 +@param aPoint The point to be tested.
  1.1275 +
  1.1276 +@return True, if the point is within the rectangle; false, otherwise.
  1.1277 +*/
  1.1278 +	{
  1.1279 +	if (aPoint.iX<iTl.iX || aPoint.iX>=iBr.iX || aPoint.iY<iTl.iY || aPoint.iY>=iBr.iY)
  1.1280 +		return(EFalse);
  1.1281 +	return(ETrue);
  1.1282 +	}
  1.1283 +
  1.1284 +
  1.1285 +
  1.1286 +
  1.1287 +EXPORT_C TSize TRect::Size() const
  1.1288 +/**
  1.1289 +Gets the size of the rectangle.
  1.1290 +
  1.1291 +@return The size of the rectangle.
  1.1292 +*/
  1.1293 +	{
  1.1294 +	return((iBr-iTl).AsSize());
  1.1295 +	}
  1.1296 +
  1.1297 +
  1.1298 +
  1.1299 +
  1.1300 +EXPORT_C TInt TRect::Width() const
  1.1301 +/**
  1.1302 +Gets the width of the rectangle.
  1.1303 +
  1.1304 +@return The width of the rectangle.
  1.1305 +*/
  1.1306 +	{
  1.1307 +	return(iBr.iX-iTl.iX);
  1.1308 +	}
  1.1309 +
  1.1310 +
  1.1311 +
  1.1312 +
  1.1313 +EXPORT_C TInt TRect::Height() const
  1.1314 +/**
  1.1315 +Gets the height of the rectangle.
  1.1316 +
  1.1317 +@return The height of the rectangle.
  1.1318 +*/
  1.1319 +	{
  1.1320 +	return(iBr.iY-iTl.iY);
  1.1321 +	}
  1.1322 +
  1.1323 +
  1.1324 +
  1.1325 +
  1.1326 +EXPORT_C TBool TRect::IsNormalized() const
  1.1327 +/**
  1.1328 +Tests whether the rectangle is normalised.
  1.1329 +
  1.1330 +A rectangle is normalised when its width and height are both zero or greater.
  1.1331 +
  1.1332 +@return True, if normalised; false, if not.
  1.1333 +*/
  1.1334 +	{
  1.1335 +	return((iBr.iX>=iTl.iX) && (iBr.iY>=iTl.iY));
  1.1336 +	}
  1.1337 +
  1.1338 +
  1.1339 +
  1.1340 +
  1.1341 +EXPORT_C TPoint TRect::Center() const
  1.1342 +/**
  1.1343 +Gets the point at the centre of the rectangle.
  1.1344 +
  1.1345 +@return The point at the centre of the rectangle.
  1.1346 +*/
  1.1347 +	{
  1.1348 +	return(TPoint((iTl.iX+iBr.iX)/2,(iTl.iY+iBr.iY)/2));
  1.1349 +	}
  1.1350 +
  1.1351 +
  1.1352 +
  1.1353 +
  1.1354 +EXPORT_C void TRect::SetSize(const TSize &aSize)
  1.1355 +/**
  1.1356 +Sets the size of the rectangle.
  1.1357 +
  1.1358 +Only the co-ordinates of the bottom right hand corner of the rectangle are 
  1.1359 +affected.
  1.1360 +
  1.1361 +@param aSize The new width is aSize.iWidth. The new height is aSize.iHeight.
  1.1362 +*/
  1.1363 +	{
  1.1364 +	iBr=iTl+aSize;
  1.1365 +	}
  1.1366 +
  1.1367 +
  1.1368 +
  1.1369 +
  1.1370 +EXPORT_C void TRect::SetWidth(TInt aWidth)
  1.1371 +/**
  1.1372 +Sets the width of the rectangle.
  1.1373 +
  1.1374 +Only the position of the rectangle's right hand side is affected.
  1.1375 +
  1.1376 +@param aWidth The new width of the rectangle.
  1.1377 +*/
  1.1378 +	{
  1.1379 +	iBr.iX=iTl.iX+aWidth;
  1.1380 +	}
  1.1381 +
  1.1382 +
  1.1383 +
  1.1384 +
  1.1385 +EXPORT_C void TRect::SetHeight(TInt aHeight)
  1.1386 +/**
  1.1387 +Sets the height of the rectangle.
  1.1388 +
  1.1389 +Only the position of the bottom of the rectangle is affected.
  1.1390 +
  1.1391 +@param aHeight The new height of the rectangle.
  1.1392 +*/
  1.1393 +	{
  1.1394 +	iBr.iY=iTl.iY+aHeight;
  1.1395 +	}