os/kernelhwsrv/kernel/eka/euser/us_graph.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// e32\euser\us_graph.cpp
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#include "us_std.h"
sl@0
    19
sl@0
    20
sl@0
    21
sl@0
    22
sl@0
    23
EXPORT_C TBool TPoint::operator==(const TPoint& aPoint) const
sl@0
    24
/**
sl@0
    25
Compares two points for equality.
sl@0
    26
sl@0
    27
For two points to be equal, both their x and y co-ordinate values must be 
sl@0
    28
equal.
sl@0
    29
sl@0
    30
@param aPoint The point to be compared with this point.
sl@0
    31
sl@0
    32
@return True, if the two points are equal; false, otherwise.
sl@0
    33
*/
sl@0
    34
	{
sl@0
    35
sl@0
    36
	return(iX==aPoint.iX && iY==aPoint.iY);
sl@0
    37
	}
sl@0
    38
sl@0
    39
sl@0
    40
sl@0
    41
sl@0
    42
EXPORT_C TBool TPoint::operator!=(const TPoint& aPoint) const
sl@0
    43
/**
sl@0
    44
Compares two points for inequality.
sl@0
    45
sl@0
    46
For two points to be unequal, either their x or their y co-ordinate values 
sl@0
    47
must be different.
sl@0
    48
sl@0
    49
@param aPoint The point to be compared with this point.
sl@0
    50
sl@0
    51
@return True, if the two points are unequal; false, otherwise.
sl@0
    52
*/
sl@0
    53
	{
sl@0
    54
sl@0
    55
	return(iX!=aPoint.iX || iY!=aPoint.iY);
sl@0
    56
	}
sl@0
    57
sl@0
    58
sl@0
    59
sl@0
    60
sl@0
    61
EXPORT_C TPoint& TPoint::operator-=(const TPoint& aPoint)
sl@0
    62
/**
sl@0
    63
TPoint subtraction assignment operator.
sl@0
    64
sl@0
    65
The operator subtracts the specified point from this point, and assigns the 
sl@0
    66
result back to this point.
sl@0
    67
sl@0
    68
@param aPoint The point to be subtracted.
sl@0
    69
sl@0
    70
@return A reference to this point object.
sl@0
    71
*/
sl@0
    72
	{
sl@0
    73
sl@0
    74
	iX-=aPoint.iX;
sl@0
    75
	iY-=aPoint.iY;
sl@0
    76
	return(*this);
sl@0
    77
	}
sl@0
    78
sl@0
    79
sl@0
    80
sl@0
    81
sl@0
    82
EXPORT_C TPoint& TPoint::operator-=(const TSize& aSize)
sl@0
    83
/**
sl@0
    84
TSize subtraction assignment operator.
sl@0
    85
sl@0
    86
The operator subtracts the specified TSize from this point, and assigns the 
sl@0
    87
result back to this point.
sl@0
    88
sl@0
    89
The operation proceeds by:
sl@0
    90
sl@0
    91
1. subtracting the width value of the TSize from the x co-ordinate value
sl@0
    92
sl@0
    93
2. subtracting the height value of the TSize from the y co-ordinate value
sl@0
    94
sl@0
    95
@param aSize The TSize to be subtracted.
sl@0
    96
sl@0
    97
@return A reference to this point object.
sl@0
    98
*/
sl@0
    99
	{
sl@0
   100
sl@0
   101
	iX-=aSize.iWidth;
sl@0
   102
	iY-=aSize.iHeight;
sl@0
   103
	return(*this);
sl@0
   104
	}
sl@0
   105
sl@0
   106
sl@0
   107
sl@0
   108
sl@0
   109
EXPORT_C TPoint& TPoint::operator+=(const TPoint& aPoint)
sl@0
   110
/**
sl@0
   111
TPoint addition assignment operator. 
sl@0
   112
sl@0
   113
The operator adds the specified point to this point, and assigns the result 
sl@0
   114
back to this point.
sl@0
   115
sl@0
   116
@param aPoint The point to be added.
sl@0
   117
sl@0
   118
@return A reference to this point object.
sl@0
   119
*/
sl@0
   120
	{
sl@0
   121
sl@0
   122
	iX+=aPoint.iX;
sl@0
   123
	iY+=aPoint.iY;
sl@0
   124
	return(*this);
sl@0
   125
	}
sl@0
   126
sl@0
   127
sl@0
   128
sl@0
   129
sl@0
   130
EXPORT_C TPoint& TPoint::operator+=(const TSize& aSize)
sl@0
   131
/**
sl@0
   132
TSize addition assignment operator. 
sl@0
   133
sl@0
   134
The operator adds the specified TSize to this point, and assigns the result 
sl@0
   135
back to this point.
sl@0
   136
sl@0
   137
The operation proceeds by:
sl@0
   138
sl@0
   139
1. adding the width value of the TSize to the x co-ordinate value
sl@0
   140
sl@0
   141
2. adding the height value of the TSize to the y co-ordinate value
sl@0
   142
sl@0
   143
@param aSize The TSize to be added to this point. 
sl@0
   144
sl@0
   145
@return A reference to this point object.
sl@0
   146
*/
sl@0
   147
	{
sl@0
   148
sl@0
   149
	iX+=aSize.iWidth;
sl@0
   150
	iY+=aSize.iHeight;
sl@0
   151
	return(*this);
sl@0
   152
	}
sl@0
   153
sl@0
   154
sl@0
   155
sl@0
   156
sl@0
   157
EXPORT_C TPoint TPoint::operator-(const TPoint& aPoint) const
sl@0
   158
/**
sl@0
   159
TPoint subtraction operator.
sl@0
   160
sl@0
   161
The operator subtracts the specified point from this point, and returns the 
sl@0
   162
resulting value.
sl@0
   163
sl@0
   164
@param aPoint The point to be subtracted from this point. 
sl@0
   165
sl@0
   166
@return The result of the operation.
sl@0
   167
*/
sl@0
   168
	{
sl@0
   169
sl@0
   170
	TPoint ret=* this;
sl@0
   171
	ret-= aPoint;
sl@0
   172
	return(ret);
sl@0
   173
	}
sl@0
   174
sl@0
   175
sl@0
   176
sl@0
   177
sl@0
   178
EXPORT_C TPoint TPoint::operator-(const TSize& aSize) const
sl@0
   179
/**
sl@0
   180
TSize subtraction operator. 
sl@0
   181
sl@0
   182
The operator subtracts the specified TSize from this point, and returns the 
sl@0
   183
resulting value.
sl@0
   184
sl@0
   185
The operation proceeds by:
sl@0
   186
sl@0
   187
1. subtracting the width value of the TSize from the x co-ordinate value
sl@0
   188
sl@0
   189
2. subtracting the height value of the TSize from the y co-ordinate value.
sl@0
   190
sl@0
   191
@param aSize The TSize to be subtracted.
sl@0
   192
sl@0
   193
@return The result of the operation.
sl@0
   194
*/
sl@0
   195
	{
sl@0
   196
sl@0
   197
	TPoint ret=* this;
sl@0
   198
	ret-= aSize;
sl@0
   199
	return(ret);
sl@0
   200
	}
sl@0
   201
sl@0
   202
sl@0
   203
sl@0
   204
sl@0
   205
EXPORT_C TPoint TPoint::operator+(const TPoint& aPoint) const
sl@0
   206
/**
sl@0
   207
The operator adds the specified point to this point, and returns the resulting 
sl@0
   208
value.
sl@0
   209
sl@0
   210
@param aPoint The point to be added to this point.
sl@0
   211
sl@0
   212
@return The result of the operation.
sl@0
   213
*/
sl@0
   214
	{
sl@0
   215
sl@0
   216
	TPoint ret=* this;
sl@0
   217
	ret+= aPoint;
sl@0
   218
	return(ret);
sl@0
   219
	}
sl@0
   220
sl@0
   221
sl@0
   222
sl@0
   223
sl@0
   224
EXPORT_C TPoint TPoint::operator+(const TSize& aSize) const
sl@0
   225
/**
sl@0
   226
TSize addition operator. 
sl@0
   227
sl@0
   228
The operator adds the specified TSize to this point, and returns the resulting 
sl@0
   229
value.
sl@0
   230
sl@0
   231
The operation proceeds by:
sl@0
   232
sl@0
   233
1. adding the width value of the TSize to the x co-ordinate value
sl@0
   234
sl@0
   235
2. adding the height value of the TSize to the y co-ordinate value.
sl@0
   236
sl@0
   237
@param aSize The TSize to be added to this TPoint. 
sl@0
   238
sl@0
   239
@return The result of the operation.
sl@0
   240
*/
sl@0
   241
	{
sl@0
   242
sl@0
   243
	TPoint ret=* this;
sl@0
   244
	ret+= aSize;
sl@0
   245
	return(ret);
sl@0
   246
	}
sl@0
   247
sl@0
   248
sl@0
   249
sl@0
   250
sl@0
   251
EXPORT_C TPoint TPoint::operator-() const
sl@0
   252
/**
sl@0
   253
Unary minus operator.
sl@0
   254
sl@0
   255
The operator returns the negation of this point.
sl@0
   256
sl@0
   257
@return The result of the operation.
sl@0
   258
*/
sl@0
   259
	{
sl@0
   260
sl@0
   261
	return TPoint(-iX,-iY);
sl@0
   262
	}
sl@0
   263
sl@0
   264
sl@0
   265
sl@0
   266
sl@0
   267
EXPORT_C void TPoint::SetXY(TInt aX,TInt aY)
sl@0
   268
/**
sl@0
   269
Sets the x and y co-ordinates for this point.
sl@0
   270
sl@0
   271
@param aX The value to assign to the x co-ordinate. 
sl@0
   272
@param aY The value to assign to the y co-ordinate.
sl@0
   273
*/
sl@0
   274
	{
sl@0
   275
sl@0
   276
	iX=aX;
sl@0
   277
	iY=aY;
sl@0
   278
	}
sl@0
   279
sl@0
   280
sl@0
   281
sl@0
   282
sl@0
   283
EXPORT_C TSize TPoint::AsSize() const
sl@0
   284
/**
sl@0
   285
Gets the size of the rectangle whose top left hand corner is the origin of 
sl@0
   286
the screen co-ordinates and whose bottom right hand corner is this point.
sl@0
   287
sl@0
   288
@return The co-ordinates of this point converted to a size.
sl@0
   289
*/
sl@0
   290
	{
sl@0
   291
	return(TSize(iX,iY));
sl@0
   292
	}
sl@0
   293
sl@0
   294
sl@0
   295
sl@0
   296
sl@0
   297
sl@0
   298
EXPORT_C TBool TPoint3D::operator==(const TPoint3D& aPoint3D) const
sl@0
   299
/**
sl@0
   300
Compares two 3D points(TPoint3D) for equality.
sl@0
   301
sl@0
   302
For two TPoint3D to be equal, their x , y and zco-ordinate values must be 
sl@0
   303
equal.
sl@0
   304
sl@0
   305
@param aPoint3D The point to be compared with this point.
sl@0
   306
sl@0
   307
@return True, if the two points are equal; false, otherwise.
sl@0
   308
*/
sl@0
   309
	{
sl@0
   310
	return(iX==aPoint3D.iX && iY==aPoint3D.iY && iZ==aPoint3D.iZ);
sl@0
   311
	}
sl@0
   312
sl@0
   313
sl@0
   314
sl@0
   315
sl@0
   316
EXPORT_C TBool TPoint3D::operator!=(const TPoint3D& aPoint3D) const
sl@0
   317
/**
sl@0
   318
Compares two 3D points for inequality.
sl@0
   319
sl@0
   320
For two points to be unequal, their x  or y or z co-ordinate values 
sl@0
   321
must be different.
sl@0
   322
sl@0
   323
@param aPoint3D The point to be compared with this point.
sl@0
   324
sl@0
   325
@return True, if the two points are unequal; false, otherwise.
sl@0
   326
*/
sl@0
   327
	{
sl@0
   328
	return(iX!=aPoint3D.iX || iY!=aPoint3D.iY || iZ!=aPoint3D.iZ);
sl@0
   329
	}
sl@0
   330
sl@0
   331
sl@0
   332
sl@0
   333
sl@0
   334
sl@0
   335
sl@0
   336
EXPORT_C TPoint3D& TPoint3D::operator-=(const TPoint3D& aPoint3D)
sl@0
   337
/**
sl@0
   338
TPoint3D subtraction assignment operator.
sl@0
   339
sl@0
   340
The operator subtracts the specified point from this point, and assigns the 
sl@0
   341
result back to this point.
sl@0
   342
sl@0
   343
@param aPoint The point to be subtracted.
sl@0
   344
sl@0
   345
@return A reference to this point object.
sl@0
   346
*/
sl@0
   347
	{
sl@0
   348
	iX-=aPoint3D.iX;
sl@0
   349
	iY-=aPoint3D.iY;
sl@0
   350
	iZ-=aPoint3D.iZ;
sl@0
   351
	return(*this);
sl@0
   352
	}
sl@0
   353
sl@0
   354
sl@0
   355
sl@0
   356
EXPORT_C TPoint3D& TPoint3D::operator-=(const TPoint& aPoint)
sl@0
   357
sl@0
   358
/**
sl@0
   359
TPoint subtraction assignment operator.
sl@0
   360
sl@0
   361
The operator subtracts the specified TPoint from this point(TPoint3D), and assigns the 
sl@0
   362
result back to this point.
sl@0
   363
sl@0
   364
The operation proceeds by
sl@0
   365
subtracting x and y cordinates of the TPoin to this point and no changes  to the Z-coordinatete value
sl@0
   366
sl@0
   367
@param aPoint The aPoint to be subtracted.
sl@0
   368
sl@0
   369
@return A reference to this point object.
sl@0
   370
*/
sl@0
   371
	{
sl@0
   372
	iX-=aPoint.iX;
sl@0
   373
	iY-=aPoint.iY;
sl@0
   374
	//No Changes to the z co-ordinate
sl@0
   375
	return(*this);
sl@0
   376
	}
sl@0
   377
sl@0
   378
sl@0
   379
sl@0
   380
EXPORT_C TPoint3D& TPoint3D::operator+=(const TPoint3D& aPoint3D)
sl@0
   381
/**
sl@0
   382
TPoint3D addition assignment operator. 
sl@0
   383
sl@0
   384
The operator adds the specified point to this point, and assigns the result 
sl@0
   385
back to this point.
sl@0
   386
sl@0
   387
@param aPoint3D The point to be added.
sl@0
   388
sl@0
   389
@return A reference to this point object.
sl@0
   390
*/
sl@0
   391
	{
sl@0
   392
	iX+=aPoint3D.iX;
sl@0
   393
	iY+=aPoint3D.iY;
sl@0
   394
	iZ+=aPoint3D.iZ;
sl@0
   395
	return(*this);
sl@0
   396
	}
sl@0
   397
sl@0
   398
EXPORT_C TPoint3D& TPoint3D::operator+=(const TPoint& aPoint)
sl@0
   399
/**
sl@0
   400
TPoint addition assignment operator. 
sl@0
   401
sl@0
   402
The operator adds the specified TPoint to this point, and assigns the result 
sl@0
   403
back to this point.
sl@0
   404
sl@0
   405
The operation proceeds by:
sl@0
   406
adding  x and y cordinates of the TPoin to this point and no changes  to the Z-coordinatete value
sl@0
   407
sl@0
   408
@param aPoint The TPoint to be added to this point. 
sl@0
   409
sl@0
   410
@return A reference to this point object.
sl@0
   411
*/
sl@0
   412
	{
sl@0
   413
sl@0
   414
	iX+=aPoint.iX;
sl@0
   415
	iY+=aPoint.iY;
sl@0
   416
	//No Changes to the z co-ordinate
sl@0
   417
	return(*this);
sl@0
   418
	}
sl@0
   419
EXPORT_C TPoint3D TPoint3D::operator-(const TPoint3D& aPoint3D) const
sl@0
   420
/**
sl@0
   421
TPoint3D subtraction operator.
sl@0
   422
sl@0
   423
The operator subtracts the specified point from this point, and returns the 
sl@0
   424
resulting value.
sl@0
   425
sl@0
   426
@param aPoint3D The point to be subtracted from this point. 
sl@0
   427
sl@0
   428
@return the point(TPoint3D) which is the  result of the operation.
sl@0
   429
*/
sl@0
   430
	{
sl@0
   431
sl@0
   432
	TPoint3D ret=* this;
sl@0
   433
	ret-= aPoint3D;
sl@0
   434
	return(ret);
sl@0
   435
	}
sl@0
   436
sl@0
   437
sl@0
   438
sl@0
   439
EXPORT_C TPoint3D TPoint3D::operator-(const TPoint& aPoint) const
sl@0
   440
/**
sl@0
   441
TPoint subtraction operator. 
sl@0
   442
sl@0
   443
The operator subtracts the specified TPoint from this point, and returns the 
sl@0
   444
resulting value.
sl@0
   445
sl@0
   446
@param aPoint The TPoint to be subtracted.
sl@0
   447
sl@0
   448
@return the point(TPoint3D) which is the  result of the operation.
sl@0
   449
*/
sl@0
   450
	{
sl@0
   451
sl@0
   452
	TPoint3D ret=* this;
sl@0
   453
	ret-= aPoint;
sl@0
   454
	return(ret);
sl@0
   455
	}
sl@0
   456
sl@0
   457
sl@0
   458
EXPORT_C TPoint3D TPoint3D::operator+(const TPoint3D& aPoint3D) const
sl@0
   459
/**
sl@0
   460
The operator adds the specified point to this point, and returns the resulting 
sl@0
   461
value.
sl@0
   462
sl@0
   463
@param aPoint3D The point to be added to this point.
sl@0
   464
sl@0
   465
@return the point(TPoint3D) which is the  result of the operation.
sl@0
   466
*/
sl@0
   467
	{
sl@0
   468
sl@0
   469
	TPoint3D ret=* this;
sl@0
   470
	ret+= aPoint3D;
sl@0
   471
	return(ret);
sl@0
   472
	}
sl@0
   473
sl@0
   474
EXPORT_C TPoint3D TPoint3D::operator+(const TPoint& aPoint) const
sl@0
   475
/**
sl@0
   476
TPoint addition operator. 
sl@0
   477
sl@0
   478
The operator adds the specified TPoint to this point, and returns the resulting 
sl@0
   479
value.
sl@0
   480
sl@0
   481
@param aSize The TSize to be added to this TPoint. 
sl@0
   482
sl@0
   483
@return the point(TPoint3D) which is the  result of the operation.
sl@0
   484
*/
sl@0
   485
	{
sl@0
   486
sl@0
   487
	TPoint3D ret=* this;
sl@0
   488
	ret+= aPoint;
sl@0
   489
	return(ret);
sl@0
   490
	}
sl@0
   491
sl@0
   492
sl@0
   493
EXPORT_C TPoint3D TPoint3D::operator-() const
sl@0
   494
/**
sl@0
   495
Unary minus operator.
sl@0
   496
sl@0
   497
The operator returns the negation of this point.
sl@0
   498
sl@0
   499
@return the point(TPoint3D) which is the  result of Unary minus operation.
sl@0
   500
*/
sl@0
   501
	{
sl@0
   502
	return TPoint3D(-iX,-iY,-iZ);
sl@0
   503
	}
sl@0
   504
sl@0
   505
sl@0
   506
sl@0
   507
EXPORT_C void TPoint3D::SetXYZ(TInt aX,TInt aY,TInt aZ)
sl@0
   508
/**
sl@0
   509
Sets the x , y and z co-ordinates for this point.
sl@0
   510
sl@0
   511
@param aX The value to assign to the x co-ordinate. 
sl@0
   512
@param aY The value to assign to the y co-ordinate.
sl@0
   513
@param aZ The value to assign to the z co-ordinate.
sl@0
   514
*/
sl@0
   515
	{
sl@0
   516
	iX=aX;
sl@0
   517
	iY=aY;
sl@0
   518
	iZ=aZ;
sl@0
   519
	}
sl@0
   520
sl@0
   521
EXPORT_C void TPoint3D::SetPoint(const TPoint& aPoint)
sl@0
   522
/*
sl@0
   523
TPoint3D from TPoint, sets the Z co-ordinate to  Zero
sl@0
   524
@param aPoint The TPoint to add to this point 
sl@0
   525
*/
sl@0
   526
	{
sl@0
   527
	iX=aPoint.iX;
sl@0
   528
	iY=aPoint.iY;
sl@0
   529
	iZ=0;
sl@0
   530
	}
sl@0
   531
	
sl@0
   532
sl@0
   533
EXPORT_C TPoint TPoint3D::AsPoint() const
sl@0
   534
/**
sl@0
   535
Gets Tpoint from Tpoint3D
sl@0
   536
@return TPoint from X and Y cordinates of Tpoint3D
sl@0
   537
*/
sl@0
   538
	{
sl@0
   539
	return(TPoint(iX,iY));
sl@0
   540
	}
sl@0
   541
sl@0
   542
sl@0
   543
sl@0
   544
sl@0
   545
sl@0
   546
sl@0
   547
EXPORT_C TBool TSize::operator==(const TSize& aSize) const
sl@0
   548
/**
sl@0
   549
Compares this TSize with the specified TSize for equality. 
sl@0
   550
sl@0
   551
For two TSizes to be equal, both their width and height values must be equal.
sl@0
   552
sl@0
   553
@param aSize The TSize to be compared with this TSize.
sl@0
   554
sl@0
   555
@return True, if the two TSize are equal; false, otherwise.
sl@0
   556
*/
sl@0
   557
	{
sl@0
   558
	return(iWidth==aSize.iWidth && iHeight==aSize.iHeight);
sl@0
   559
	}
sl@0
   560
sl@0
   561
sl@0
   562
sl@0
   563
sl@0
   564
EXPORT_C TBool TSize::operator!=(const TSize& aSize) const
sl@0
   565
/**
sl@0
   566
Compares two TSize for inequality.
sl@0
   567
sl@0
   568
For two TSize to be unequal, either their width or height values must be different.
sl@0
   569
sl@0
   570
@param aSize The TSize to be compared with this TSize. 
sl@0
   571
sl@0
   572
@return True, if the two TSize are unequal; false, otherwise.
sl@0
   573
*/
sl@0
   574
	{
sl@0
   575
	return(iWidth!=aSize.iWidth || iHeight!=aSize.iHeight);
sl@0
   576
	}
sl@0
   577
sl@0
   578
sl@0
   579
sl@0
   580
sl@0
   581
EXPORT_C TSize& TSize::operator-=(const TSize& aSize)
sl@0
   582
/**
sl@0
   583
TSize subtraction assignment operator.
sl@0
   584
sl@0
   585
The operator subtracts the specified TSize from this TSize, and assigns the 
sl@0
   586
result back to this TSize.
sl@0
   587
sl@0
   588
@param aSize The TSize to be subtracted. 
sl@0
   589
sl@0
   590
@return A reference to this TSize object.
sl@0
   591
*/
sl@0
   592
	{
sl@0
   593
	iWidth-=aSize.iWidth;iHeight-=aSize.iHeight;return(*this);
sl@0
   594
	}
sl@0
   595
sl@0
   596
sl@0
   597
sl@0
   598
sl@0
   599
EXPORT_C TSize& TSize::operator-=(const TPoint& aPoint)
sl@0
   600
/**
sl@0
   601
TPoint subtraction assignment operator.
sl@0
   602
sl@0
   603
The operator subtracts the specified point from this TSize, and assigns the 
sl@0
   604
result back to this TSize.
sl@0
   605
sl@0
   606
The operation proceeds by:
sl@0
   607
sl@0
   608
1. subtracting the point's x co-ordinate value from the width
sl@0
   609
sl@0
   610
2. subtracting the point's y co-ordinate value from the height.
sl@0
   611
sl@0
   612
@param aPoint The point to be subtracted.
sl@0
   613
sl@0
   614
@return A reference to this size object.
sl@0
   615
*/
sl@0
   616
	{
sl@0
   617
	iWidth-=aPoint.iX;iHeight-=aPoint.iY;return(*this);
sl@0
   618
	}
sl@0
   619
sl@0
   620
sl@0
   621
sl@0
   622
sl@0
   623
EXPORT_C TSize& TSize::operator+=(const TSize& aSize)
sl@0
   624
/**
sl@0
   625
TSize addition assignment operator.
sl@0
   626
sl@0
   627
The operator adds the specified TSize to this TSize, and assigns the result 
sl@0
   628
back to this TSize.
sl@0
   629
sl@0
   630
@param aSize The TSize to be added.
sl@0
   631
sl@0
   632
@return A reference to this size object.
sl@0
   633
*/
sl@0
   634
	{
sl@0
   635
	iWidth+=aSize.iWidth;iHeight+=aSize.iHeight;return(*this);
sl@0
   636
	}
sl@0
   637
sl@0
   638
sl@0
   639
sl@0
   640
sl@0
   641
EXPORT_C TSize& TSize::operator+=(const TPoint& aPoint)
sl@0
   642
/**
sl@0
   643
TPoint addition assignment operator.
sl@0
   644
sl@0
   645
The operator adds the specified point to this TSize, and assigns the result 
sl@0
   646
back to this TSize.
sl@0
   647
sl@0
   648
The operation proceeds by:
sl@0
   649
sl@0
   650
1. adding the point's x co-ordinate value to the width
sl@0
   651
sl@0
   652
2. adding the point's y co-ordinate value to the height.
sl@0
   653
sl@0
   654
@param aPoint The point to be added.
sl@0
   655
sl@0
   656
@return A reference to this size object.
sl@0
   657
*/
sl@0
   658
	{
sl@0
   659
	iWidth+=aPoint.iX;iHeight+=aPoint.iY;return(*this);
sl@0
   660
	}
sl@0
   661
sl@0
   662
sl@0
   663
sl@0
   664
sl@0
   665
EXPORT_C TSize TSize::operator-(const TSize& aSize) const
sl@0
   666
/**
sl@0
   667
TSize subtraction operator.
sl@0
   668
sl@0
   669
This operator subtracts the specified TSize from this TSize, and returns the 
sl@0
   670
resulting value.
sl@0
   671
sl@0
   672
@param aSize The TSize to be subtracted from this Tsize.
sl@0
   673
sl@0
   674
@return The result of the operation.
sl@0
   675
*/
sl@0
   676
	{
sl@0
   677
	TSize ret=* this; ret-= aSize ;return(ret);
sl@0
   678
	}
sl@0
   679
sl@0
   680
sl@0
   681
sl@0
   682
sl@0
   683
EXPORT_C TSize TSize::operator-(const TPoint& aPoint) const
sl@0
   684
/**
sl@0
   685
TPoint subtraction operator.
sl@0
   686
sl@0
   687
This operator subtracts the specified point from this TSize, and returns the 
sl@0
   688
resulting value.
sl@0
   689
sl@0
   690
The operation proceeds by:
sl@0
   691
sl@0
   692
1. subtracting the x co-ordinate value from the width
sl@0
   693
sl@0
   694
2. subtracting the y co-ordinate value from the height
sl@0
   695
sl@0
   696
@param aPoint The point to be subtracted.
sl@0
   697
sl@0
   698
@return The result of the operation.
sl@0
   699
*/
sl@0
   700
	{
sl@0
   701
	TSize ret=* this; ret-= aPoint ;return(ret);
sl@0
   702
	}
sl@0
   703
sl@0
   704
sl@0
   705
sl@0
   706
sl@0
   707
EXPORT_C TSize TSize::operator+(const TSize& aSize) const
sl@0
   708
/**
sl@0
   709
TSize addition operator.
sl@0
   710
sl@0
   711
This operator adds the specified TSize to this TSize, and returns the resulting 
sl@0
   712
value.
sl@0
   713
sl@0
   714
@param aSize The TSize to be added to this Tsize. 
sl@0
   715
sl@0
   716
@return The result of the operation.
sl@0
   717
*/
sl@0
   718
	{
sl@0
   719
	TSize ret=* this; ret+= aSize ;return(ret);
sl@0
   720
	}
sl@0
   721
sl@0
   722
sl@0
   723
sl@0
   724
sl@0
   725
EXPORT_C TSize TSize::operator+(const TPoint& aPoint) const
sl@0
   726
/**
sl@0
   727
TPoint addition operator.
sl@0
   728
sl@0
   729
This operator adds the specified point to this TSize, and returns the resulting 
sl@0
   730
value.
sl@0
   731
sl@0
   732
The operation proceeds by:
sl@0
   733
sl@0
   734
1. adding the x co-ordinate value to the width
sl@0
   735
sl@0
   736
2. adding the y co-ordinate value to the height
sl@0
   737
sl@0
   738
@param aPoint The point to be added to this TSize. 
sl@0
   739
sl@0
   740
@return The result of the operation.
sl@0
   741
*/
sl@0
   742
	{
sl@0
   743
	TSize ret=* this; ret+= aPoint ;return(ret);
sl@0
   744
	}
sl@0
   745
sl@0
   746
sl@0
   747
sl@0
   748
sl@0
   749
EXPORT_C TSize TSize::operator-() const
sl@0
   750
/**
sl@0
   751
Unary minus operator.
sl@0
   752
sl@0
   753
The operator returns the negation of this TSize.
sl@0
   754
sl@0
   755
@return The result of the operation.
sl@0
   756
*/
sl@0
   757
	{
sl@0
   758
sl@0
   759
	return TSize(-iWidth,-iHeight);
sl@0
   760
	}
sl@0
   761
sl@0
   762
sl@0
   763
sl@0
   764
sl@0
   765
EXPORT_C void TSize::SetSize(TInt aWidth,TInt aHeight)
sl@0
   766
/**
sl@0
   767
Sets the width and height.
sl@0
   768
sl@0
   769
@param aWidth The width value. 
sl@0
   770
@param aHeight The height value.
sl@0
   771
*/
sl@0
   772
	{
sl@0
   773
	iWidth=aWidth;iHeight=aHeight;
sl@0
   774
	}
sl@0
   775
sl@0
   776
sl@0
   777
sl@0
   778
sl@0
   779
EXPORT_C TPoint TSize::AsPoint() const
sl@0
   780
/**
sl@0
   781
Gets a TPoint object whose co-ordinates are the width and height of this TSize.
sl@0
   782
sl@0
   783
@return The co-ordinates of this TSize converted to a point.
sl@0
   784
*/
sl@0
   785
	{
sl@0
   786
	return(TPoint(iWidth,iHeight));
sl@0
   787
	}
sl@0
   788
sl@0
   789
sl@0
   790
sl@0
   791
sl@0
   792
EXPORT_C TRect::TRect()	: iTl(0,0),iBr(0,0)
sl@0
   793
/**
sl@0
   794
Constructs a default rectangle.
sl@0
   795
sl@0
   796
This initialises the co-ordinates of its top 
sl@0
   797
left and bottom right corners to (0,0).
sl@0
   798
*/
sl@0
   799
	{}
sl@0
   800
	
sl@0
   801
	
sl@0
   802
	
sl@0
   803
	
sl@0
   804
EXPORT_C TRect::TRect(TInt aAx,TInt aAy,TInt aBx,TInt aBy) : iTl(aAx,aAy),iBr(aBx,aBy)
sl@0
   805
/**
sl@0
   806
Constructs the rectangle, initialising its top left and bottom right hand corners 
sl@0
   807
with four TInt values.
sl@0
   808
sl@0
   809
@param aAx The horizontal co-ordinate of the left hand side of the rectangle. 
sl@0
   810
@param aAy The vertical co-ordinate of the top of the rectangle. 
sl@0
   811
@param aBx The horizontal co-ordinate of the right hand side of the rectangle. 
sl@0
   812
@param aBy The vertical co-ordinate of the bottom of the rectangle.
sl@0
   813
*/
sl@0
   814
	{}
sl@0
   815
	
sl@0
   816
	
sl@0
   817
	
sl@0
   818
	
sl@0
   819
EXPORT_C TRect::TRect(const TPoint& aPointA,const TPoint& aPointB) : iTl(aPointA),iBr(aPointB)
sl@0
   820
/**
sl@0
   821
Constructs the rectangle with two TPoints, corresponding to its top left and 
sl@0
   822
bottom right hand corners.
sl@0
   823
sl@0
   824
@param aPointA The co-ordinates of the rectangle's top left hand corner. 
sl@0
   825
@param aPointB The co-ordinates of the rectangle's bottom right hand corner.
sl@0
   826
*/
sl@0
   827
	{}
sl@0
   828
	
sl@0
   829
	
sl@0
   830
	
sl@0
   831
	
sl@0
   832
EXPORT_C TRect::TRect(const TPoint& aPoint,const TSize& aSize) : iTl(aPoint),iBr(aPoint+aSize)
sl@0
   833
/**
sl@0
   834
Constructs the rectangle with a TPoint for its top left corner, and a TSize 
sl@0
   835
for its width and height.
sl@0
   836
sl@0
   837
@param aPoint The rectangle's top left hand corner. 
sl@0
   838
@param aSize  The rectangle's width and height.
sl@0
   839
*/
sl@0
   840
	{}
sl@0
   841
	
sl@0
   842
	
sl@0
   843
	
sl@0
   844
	
sl@0
   845
EXPORT_C TRect::TRect(const TSize& aSize) : iTl(0,0), iBr(aSize.iWidth, aSize.iHeight)
sl@0
   846
/**
sl@0
   847
Constructs the rectangle with a TSize.
sl@0
   848
sl@0
   849
The co-ordinates of its top left hand corner are initialised to (0,0) and
sl@0
   850
its width and height are initialised to the values contained in the argument.
sl@0
   851
sl@0
   852
@param aSize The width and height of the rectangle.
sl@0
   853
*/
sl@0
   854
	{}
sl@0
   855
	
sl@0
   856
	
sl@0
   857
	
sl@0
   858
sl@0
   859
EXPORT_C void TRect::SetRect(TInt aTlX,TInt aTlY,TInt aBrX,TInt aBrY)
sl@0
   860
/**
sl@0
   861
Sets the rectangle's position using four TInts.
sl@0
   862
	
sl@0
   863
@param aTlX The horizontal co-ordinate of the left hand side of the rectangle. 
sl@0
   864
@param aTlY The vertical co-ordinate of the top of the rectangle. 
sl@0
   865
@param aBrX The horizontal co-ordinate of the right hand side of the rectangle. 
sl@0
   866
@param aBrY The vertical co-ordinate of the bottom of the rectangle.
sl@0
   867
*/
sl@0
   868
	{
sl@0
   869
	iTl.iX=aTlX;iTl.iY=aTlY;iBr.iX=aBrX;iBr.iY=aBrY;
sl@0
   870
	}
sl@0
   871
	
sl@0
   872
	
sl@0
   873
	
sl@0
   874
sl@0
   875
EXPORT_C void TRect::SetRect(const TPoint& aPointTL,const TPoint& aPointBR)
sl@0
   876
/**
sl@0
   877
Sets the rectangle's position using two TPoints.
sl@0
   878
sl@0
   879
@param aPointTL The co-ordinates of the rectangle's top left hand corner. 
sl@0
   880
@param aPointBR The co-ordinates of the rectangle's bottom right hand corner.
sl@0
   881
*/
sl@0
   882
	{
sl@0
   883
	iTl=aPointTL;iBr=aPointBR;
sl@0
   884
	}
sl@0
   885
sl@0
   886
sl@0
   887
sl@0
   888
sl@0
   889
EXPORT_C void TRect::SetRect(const TPoint& aTL,const TSize& aSize)
sl@0
   890
/**
sl@0
   891
Sets the rectangle's position using a TPoint and a TSize.
sl@0
   892
	
sl@0
   893
@param aTL    The co-ordinates of the rectangle's top left hand corner. 
sl@0
   894
@param aSize  The rectangle's width and height.
sl@0
   895
*/
sl@0
   896
	{
sl@0
   897
	iTl=aTL;iBr=aTL+aSize;
sl@0
   898
	}
sl@0
   899
sl@0
   900
sl@0
   901
sl@0
   902
sl@0
   903
EXPORT_C void TRect::Shrink(TInt aDx,TInt aDy)
sl@0
   904
/**
sl@0
   905
Shrinks a rectangle using specified horizontal and vertical offsets. 
sl@0
   906
sl@0
   907
The offset values are added to the co-ordinates of its top left hand corner, 
sl@0
   908
and the same values are subtracted from the co-ordinates of its bottom right 
sl@0
   909
hand corner. The co-ordinates of the centre of the rectangle remain unchanged. 
sl@0
   910
If either value is negative, the rectangle expands in the corresponding direction.
sl@0
   911
sl@0
   912
@param aDx The number of pixels by which to move the left and right hand sides 
sl@0
   913
           of the rectangle. A positive value reduces the width, a negative
sl@0
   914
           value increases it. 
sl@0
   915
@param aDy The number of pixels by which to move the top and bottom of the 
sl@0
   916
           rectangle. A positive value reduces the height, a negative value
sl@0
   917
           increases it.
sl@0
   918
*/
sl@0
   919
	{
sl@0
   920
	Adjust(aDx,aDy);
sl@0
   921
	}
sl@0
   922
sl@0
   923
sl@0
   924
sl@0
   925
sl@0
   926
EXPORT_C void TRect::Shrink(const TSize& aSize)
sl@0
   927
/**
sl@0
   928
Shrinks a rectangle using a specified TSize offset.
sl@0
   929
sl@0
   930
The rectangle shrinks by twice the value of the height and width specified 
sl@0
   931
in the TSize. The co-ordinates of the centre of the rectangle remain unchanged. 
sl@0
   932
If either value is negative, the rectangle expands in the
sl@0
   933
corresponding direction.
sl@0
   934
sl@0
   935
@param aSize The number of pixels by which to move the left and right hand 
sl@0
   936
             sides of the rectangle (by aSize.iWidth) and the top and bottom
sl@0
   937
             (by aSize.iHeight).
sl@0
   938
*/
sl@0
   939
	{
sl@0
   940
	Adjust(aSize.iWidth,aSize.iHeight);
sl@0
   941
	}
sl@0
   942
sl@0
   943
sl@0
   944
sl@0
   945
sl@0
   946
EXPORT_C void TRect::Resize(const TSize& aSize)
sl@0
   947
/**
sl@0
   948
Resizes a rectangle by adding a TSize offset.
sl@0
   949
sl@0
   950
The offset is added to the co-ordinates of its bottom right hand corner. If 
sl@0
   951
either value in the TSize is negative, the rectangle shrinks in the
sl@0
   952
corresponding direction. The co-ordinates of the rectangle's top left hand
sl@0
   953
corner are unaffected.
sl@0
   954
sl@0
   955
@param aSize The number of pixels by which to move the rectangle; the right 
sl@0
   956
             hand side by aSize.iWidth and the bottom by aSize.iHeight.
sl@0
   957
*/
sl@0
   958
	{
sl@0
   959
	iBr+=aSize;
sl@0
   960
	}
sl@0
   961
sl@0
   962
sl@0
   963
sl@0
   964
sl@0
   965
EXPORT_C void TRect::Resize(TInt aDx, TInt aDy)
sl@0
   966
/**
sl@0
   967
Resizes a rectangle by adding a horizontal and vertical offset.
sl@0
   968
sl@0
   969
The offset is added to the co-ordinates of its bottom right hand corner. If 
sl@0
   970
either value is negative, the rectangle shrinks in the corresponding direction.
sl@0
   971
The co-ordinates of the rectangle's top left hand corner are unaffected.
sl@0
   972
sl@0
   973
@param aDx The number of pixels by which to move the right hand side of the 
sl@0
   974
           rectangle. 
sl@0
   975
@param aDy The number of pixels by which to move the bottom of the rectangle.
sl@0
   976
*/
sl@0
   977
	{
sl@0
   978
	iBr.iX+=aDx;iBr.iY+=aDy;
sl@0
   979
	}
sl@0
   980
sl@0
   981
sl@0
   982
sl@0
   983
sl@0
   984
EXPORT_C TBool TRect::operator==(const TRect &aRect) const
sl@0
   985
/**
sl@0
   986
Compares two rectangles for equality.
sl@0
   987
sl@0
   988
For two rectangles to be equal, the co-ordinates of both their top left and 
sl@0
   989
bottom right hand corners must be equal.
sl@0
   990
sl@0
   991
@param aRect The rectangle to compare with this rectangle.
sl@0
   992
sl@0
   993
@return True, if the rectangles have the same co-ordinates; false, otherwise.
sl@0
   994
*/
sl@0
   995
	{
sl@0
   996
sl@0
   997
	return(iTl==aRect.iTl && iBr==aRect.iBr);
sl@0
   998
	}
sl@0
   999
sl@0
  1000
sl@0
  1001
sl@0
  1002
sl@0
  1003
EXPORT_C TBool TRect::operator!=(const TRect &aRect) const
sl@0
  1004
/**
sl@0
  1005
Compares two rectangles for inequality.
sl@0
  1006
sl@0
  1007
Two rectangles are unequal if any of their co-ordinates differ.
sl@0
  1008
sl@0
  1009
@param aRect The rectangle to compare with this rectangle.
sl@0
  1010
@return True, if the rectangles do not have the same co-ordinates; false, if 
sl@0
  1011
        all co-ordinates are equal.
sl@0
  1012
*/
sl@0
  1013
	{
sl@0
  1014
sl@0
  1015
	return(iTl!=aRect.iTl || iBr!=aRect.iBr);
sl@0
  1016
	}
sl@0
  1017
sl@0
  1018
sl@0
  1019
sl@0
  1020
sl@0
  1021
EXPORT_C void TRect::Move(const TPoint &aOffset)
sl@0
  1022
/**
sl@0
  1023
Moves the rectangle by adding a TPoint offset.
sl@0
  1024
sl@0
  1025
The offset is added to the co-ordinates of both its top left and bottom right 
sl@0
  1026
hand corners. The size of the rectangle is unchanged.
sl@0
  1027
sl@0
  1028
@param aOffset The number of pixels to move the rectangle; horizontally by 
sl@0
  1029
               aOffset.iX and vertically by aOffset.iY.
sl@0
  1030
*/
sl@0
  1031
	{
sl@0
  1032
sl@0
  1033
	iTl+=aOffset;
sl@0
  1034
	iBr+=aOffset;
sl@0
  1035
	}
sl@0
  1036
sl@0
  1037
sl@0
  1038
sl@0
  1039
sl@0
  1040
EXPORT_C void TRect::Move(TInt aDx,TInt aDy)
sl@0
  1041
/**
sl@0
  1042
Moves the rectangle by adding an x, y offset.
sl@0
  1043
sl@0
  1044
The offset is added to the co-ordinates of both its top left and bottom right 
sl@0
  1045
hand corners. The size of the rectangle is unchanged.
sl@0
  1046
sl@0
  1047
@param aDx The number of pixels to move the rectangle horizontally. If negative, 
sl@0
  1048
           the rectangle moves leftwards. 
sl@0
  1049
@param aDy The number of pixels to move the rectangle vertically. If negative, 
sl@0
  1050
           the rectangle moves upwards.
sl@0
  1051
*/
sl@0
  1052
	{
sl@0
  1053
sl@0
  1054
	iTl.iX+=aDx;
sl@0
  1055
	iTl.iY+=aDy;
sl@0
  1056
	iBr.iX+=aDx;
sl@0
  1057
	iBr.iY+=aDy;
sl@0
  1058
	}
sl@0
  1059
sl@0
  1060
sl@0
  1061
sl@0
  1062
sl@0
  1063
// private function, hence not exported
sl@0
  1064
void TRect::Adjust(TInt aDx,TInt aDy)
sl@0
  1065
//
sl@0
  1066
// Adjust by a delta.
sl@0
  1067
//
sl@0
  1068
	{
sl@0
  1069
sl@0
  1070
	iTl.iX+=aDx;
sl@0
  1071
	iTl.iY+=aDy;
sl@0
  1072
	iBr.iX-=aDx;
sl@0
  1073
	iBr.iY-=aDy;
sl@0
  1074
	}
sl@0
  1075
sl@0
  1076
sl@0
  1077
sl@0
  1078
sl@0
  1079
EXPORT_C void TRect::Grow(TInt aDx,TInt aDy)
sl@0
  1080
//
sl@0
  1081
// Grow by a delta.
sl@0
  1082
//
sl@0
  1083
/**
sl@0
  1084
Grows the rectangle using the specified horizontal and vertical offsets.
sl@0
  1085
sl@0
  1086
The offset values are subtracted from the co-ordinates of its top left hand 
sl@0
  1087
corner, and the same values are added to the co-ordinates of its bottom right 
sl@0
  1088
hand corner. The co-ordinates of the centre of the rectangle remain unchanged. 
sl@0
  1089
If either value is negative, the rectangle shrinks in the corresponding direction.
sl@0
  1090
sl@0
  1091
@param aDx The number of pixels by which to move the left and right hand sides 
sl@0
  1092
           of the rectangle. A positive value increases the width, a negative
sl@0
  1093
           value reduces it. 
sl@0
  1094
@param aDy The number of pixels by which to move the top and bottom of the 
sl@0
  1095
           rectangle. A positive value increases the height, a negative
sl@0
  1096
           value reduces it.
sl@0
  1097
*/
sl@0
  1098
	{
sl@0
  1099
sl@0
  1100
	iTl.iX-=aDx;
sl@0
  1101
	iTl.iY-=aDy;
sl@0
  1102
	iBr.iX+=aDx;
sl@0
  1103
	iBr.iY+=aDy;
sl@0
  1104
	}
sl@0
  1105
sl@0
  1106
sl@0
  1107
sl@0
  1108
sl@0
  1109
EXPORT_C void TRect::Grow(const TSize &aSize)
sl@0
  1110
//
sl@0
  1111
// Grow by a size.
sl@0
  1112
//
sl@0
  1113
/**
sl@0
  1114
Grows a rectangle using the specified TSize offset.
sl@0
  1115
sl@0
  1116
The rectangle grows by twice the value of the height and width specified in 
sl@0
  1117
the TSize. The co-ordinates of the centre of the rectangle remain unchanged. 
sl@0
  1118
If either value is negative, the rectangle shrinks in the
sl@0
  1119
corresponding direction.
sl@0
  1120
sl@0
  1121
@param aSize The number of pixels by which to move the left and right hand 
sl@0
  1122
             sides of the rectangle (by aSize.iWidth) and the top and bottom
sl@0
  1123
             (by aSize.iHeight).
sl@0
  1124
*/
sl@0
  1125
	{
sl@0
  1126
sl@0
  1127
	iTl-=aSize;
sl@0
  1128
	iBr+=aSize;
sl@0
  1129
	}
sl@0
  1130
sl@0
  1131
sl@0
  1132
sl@0
  1133
sl@0
  1134
EXPORT_C void TRect::BoundingRect(const TRect &aRect)
sl@0
  1135
//
sl@0
  1136
// Union of this and aRect, a union is defined as the minimum rectangle that encloses
sl@0
  1137
// both source rectangles
sl@0
  1138
//
sl@0
  1139
/** 
sl@0
  1140
Gets the minimal rectangle which bounds both this rectangle and the specified 
sl@0
  1141
rectangle, and assigns it to this rectangle.
sl@0
  1142
sl@0
  1143
@param aRect The rectangle to use with this rectangle to get the minimal bounding 
sl@0
  1144
             rectangle.
sl@0
  1145
*/
sl@0
  1146
	{
sl@0
  1147
sl@0
  1148
	if (iTl.iX>aRect.iTl.iX)
sl@0
  1149
		iTl.iX=aRect.iTl.iX;
sl@0
  1150
	if (iTl.iY>aRect.iTl.iY)
sl@0
  1151
		iTl.iY=aRect.iTl.iY;
sl@0
  1152
	if (iBr.iX<aRect.iBr.iX)
sl@0
  1153
		iBr.iX=aRect.iBr.iX;
sl@0
  1154
	if (iBr.iY<aRect.iBr.iY)
sl@0
  1155
		iBr.iY=aRect.iBr.iY;
sl@0
  1156
	}
sl@0
  1157
sl@0
  1158
sl@0
  1159
sl@0
  1160
sl@0
  1161
EXPORT_C TBool TRect::IsEmpty() const
sl@0
  1162
//
sl@0
  1163
// True if the rectangle is empty.
sl@0
  1164
//
sl@0
  1165
/**
sl@0
  1166
Tests whether the rectangle is empty.
sl@0
  1167
sl@0
  1168
@return True, if empty; false, if not.
sl@0
  1169
*/
sl@0
  1170
	{
sl@0
  1171
sl@0
  1172
	return(iTl.iX>=iBr.iX || iTl.iY>=iBr.iY);
sl@0
  1173
	}
sl@0
  1174
sl@0
  1175
sl@0
  1176
sl@0
  1177
sl@0
  1178
EXPORT_C void TRect::Intersection(const TRect &aRect)
sl@0
  1179
//
sl@0
  1180
// Intersect this with aRect.
sl@0
  1181
//
sl@0
  1182
/**
sl@0
  1183
Gets the area of intersection between this rectangle and the specified
sl@0
  1184
rectangle, and assigns it to this rectangle.
sl@0
  1185
sl@0
  1186
It is usual to call TRect::Intersects() first to verify whether the two rectangles 
sl@0
  1187
intersect. If the two rectangles do not intersect, then, on return, this rectangle 
sl@0
  1188
is set to be empty.
sl@0
  1189
sl@0
  1190
@param aRect The rectangle to be used with this rectangle to get the area
sl@0
  1191
             of intersection.
sl@0
  1192
             
sl@0
  1193
@see TRect::Intersects             
sl@0
  1194
*/
sl@0
  1195
	{
sl@0
  1196
sl@0
  1197
	if (iTl.iX<aRect.iTl.iX)
sl@0
  1198
		iTl.iX=aRect.iTl.iX;
sl@0
  1199
	if (iTl.iY<aRect.iTl.iY)
sl@0
  1200
		iTl.iY=aRect.iTl.iY;
sl@0
  1201
	if (iBr.iX>aRect.iBr.iX)
sl@0
  1202
		iBr.iX=aRect.iBr.iX;
sl@0
  1203
	if (iBr.iY>aRect.iBr.iY)
sl@0
  1204
		iBr.iY=aRect.iBr.iY;
sl@0
  1205
	}
sl@0
  1206
sl@0
  1207
sl@0
  1208
sl@0
  1209
sl@0
  1210
EXPORT_C TBool TRect::Intersects(const TRect &aRect) const
sl@0
  1211
//
sl@0
  1212
// If aRect Intersects with this return True.
sl@0
  1213
//
sl@0
  1214
/**
sl@0
  1215
Tests whether this rectangle overlaps with the specified rectangle.
sl@0
  1216
sl@0
  1217
Two rectangles overlap if any point is located within both rectangles. There 
sl@0
  1218
is no intersection if two adjacent sides touch without overlapping, or if 
sl@0
  1219
either rectangle is empty.
sl@0
  1220
sl@0
  1221
@param aRect The rectangle to compare with this rectangle for an intersection. 
sl@0
  1222
sl@0
  1223
@return True, if the two rectangles overlap; false, if there is no overlap.
sl@0
  1224
*/
sl@0
  1225
	{
sl@0
  1226
sl@0
  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));
sl@0
  1228
	}
sl@0
  1229
sl@0
  1230
sl@0
  1231
sl@0
  1232
sl@0
  1233
EXPORT_C void TRect::Normalize()
sl@0
  1234
//
sl@0
  1235
// Make the conditions top left bottom right true.
sl@0
  1236
//
sl@0
  1237
/**
sl@0
  1238
Ensures that the rectangle's width and height have positive values.
sl@0
  1239
sl@0
  1240
For example, if the rectangle's co-ordinates are such that the top is below 
sl@0
  1241
the bottom, or the right hand side is to the left of the left hand side, normalisation 
sl@0
  1242
swaps the co-ordinates of the top and bottom or of the left and right.
sl@0
  1243
*/
sl@0
  1244
	{
sl@0
  1245
sl@0
  1246
	if (iTl.iX>iBr.iX)
sl@0
  1247
		{
sl@0
  1248
		TInt temp=iTl.iX;
sl@0
  1249
		iTl.iX=iBr.iX;
sl@0
  1250
		iBr.iX=temp;
sl@0
  1251
		}
sl@0
  1252
	if (iTl.iY>iBr.iY)
sl@0
  1253
		{
sl@0
  1254
		TInt temp=iTl.iY;
sl@0
  1255
		iTl.iY=iBr.iY;
sl@0
  1256
		iBr.iY=temp;
sl@0
  1257
		}
sl@0
  1258
	}
sl@0
  1259
sl@0
  1260
sl@0
  1261
sl@0
  1262
sl@0
  1263
EXPORT_C TBool TRect::Contains(const TPoint &aPoint) const
sl@0
  1264
/**
sl@0
  1265
Tests whether a point is located within the rectangle.
sl@0
  1266
sl@0
  1267
Note that a point located on the top or left hand side of the rectangle is 
sl@0
  1268
within the rectangle. A point located on the right hand side or bottom is 
sl@0
  1269
considered to be outside the rectangle.
sl@0
  1270
sl@0
  1271
@param aPoint The point to be tested.
sl@0
  1272
sl@0
  1273
@return True, if the point is within the rectangle; false, otherwise.
sl@0
  1274
*/
sl@0
  1275
	{
sl@0
  1276
	if (aPoint.iX<iTl.iX || aPoint.iX>=iBr.iX || aPoint.iY<iTl.iY || aPoint.iY>=iBr.iY)
sl@0
  1277
		return(EFalse);
sl@0
  1278
	return(ETrue);
sl@0
  1279
	}
sl@0
  1280
sl@0
  1281
sl@0
  1282
sl@0
  1283
sl@0
  1284
EXPORT_C TSize TRect::Size() const
sl@0
  1285
/**
sl@0
  1286
Gets the size of the rectangle.
sl@0
  1287
sl@0
  1288
@return The size of the rectangle.
sl@0
  1289
*/
sl@0
  1290
	{
sl@0
  1291
	return((iBr-iTl).AsSize());
sl@0
  1292
	}
sl@0
  1293
sl@0
  1294
sl@0
  1295
sl@0
  1296
sl@0
  1297
EXPORT_C TInt TRect::Width() const
sl@0
  1298
/**
sl@0
  1299
Gets the width of the rectangle.
sl@0
  1300
sl@0
  1301
@return The width of the rectangle.
sl@0
  1302
*/
sl@0
  1303
	{
sl@0
  1304
	return(iBr.iX-iTl.iX);
sl@0
  1305
	}
sl@0
  1306
sl@0
  1307
sl@0
  1308
sl@0
  1309
sl@0
  1310
EXPORT_C TInt TRect::Height() const
sl@0
  1311
/**
sl@0
  1312
Gets the height of the rectangle.
sl@0
  1313
sl@0
  1314
@return The height of the rectangle.
sl@0
  1315
*/
sl@0
  1316
	{
sl@0
  1317
	return(iBr.iY-iTl.iY);
sl@0
  1318
	}
sl@0
  1319
sl@0
  1320
sl@0
  1321
sl@0
  1322
sl@0
  1323
EXPORT_C TBool TRect::IsNormalized() const
sl@0
  1324
/**
sl@0
  1325
Tests whether the rectangle is normalised.
sl@0
  1326
sl@0
  1327
A rectangle is normalised when its width and height are both zero or greater.
sl@0
  1328
sl@0
  1329
@return True, if normalised; false, if not.
sl@0
  1330
*/
sl@0
  1331
	{
sl@0
  1332
	return((iBr.iX>=iTl.iX) && (iBr.iY>=iTl.iY));
sl@0
  1333
	}
sl@0
  1334
sl@0
  1335
sl@0
  1336
sl@0
  1337
sl@0
  1338
EXPORT_C TPoint TRect::Center() const
sl@0
  1339
/**
sl@0
  1340
Gets the point at the centre of the rectangle.
sl@0
  1341
sl@0
  1342
@return The point at the centre of the rectangle.
sl@0
  1343
*/
sl@0
  1344
	{
sl@0
  1345
	return(TPoint((iTl.iX+iBr.iX)/2,(iTl.iY+iBr.iY)/2));
sl@0
  1346
	}
sl@0
  1347
sl@0
  1348
sl@0
  1349
sl@0
  1350
sl@0
  1351
EXPORT_C void TRect::SetSize(const TSize &aSize)
sl@0
  1352
/**
sl@0
  1353
Sets the size of the rectangle.
sl@0
  1354
sl@0
  1355
Only the co-ordinates of the bottom right hand corner of the rectangle are 
sl@0
  1356
affected.
sl@0
  1357
sl@0
  1358
@param aSize The new width is aSize.iWidth. The new height is aSize.iHeight.
sl@0
  1359
*/
sl@0
  1360
	{
sl@0
  1361
	iBr=iTl+aSize;
sl@0
  1362
	}
sl@0
  1363
sl@0
  1364
sl@0
  1365
sl@0
  1366
sl@0
  1367
EXPORT_C void TRect::SetWidth(TInt aWidth)
sl@0
  1368
/**
sl@0
  1369
Sets the width of the rectangle.
sl@0
  1370
sl@0
  1371
Only the position of the rectangle's right hand side is affected.
sl@0
  1372
sl@0
  1373
@param aWidth The new width of the rectangle.
sl@0
  1374
*/
sl@0
  1375
	{
sl@0
  1376
	iBr.iX=iTl.iX+aWidth;
sl@0
  1377
	}
sl@0
  1378
sl@0
  1379
sl@0
  1380
sl@0
  1381
sl@0
  1382
EXPORT_C void TRect::SetHeight(TInt aHeight)
sl@0
  1383
/**
sl@0
  1384
Sets the height of the rectangle.
sl@0
  1385
sl@0
  1386
Only the position of the bottom of the rectangle is affected.
sl@0
  1387
sl@0
  1388
@param aHeight The new height of the rectangle.
sl@0
  1389
*/
sl@0
  1390
	{
sl@0
  1391
	iBr.iY=iTl.iY+aHeight;
sl@0
  1392
	}