os/graphics/graphicsdeviceinterface/gdi/inc/GDI.H
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 1998-2010 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 "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
//
sl@0
    15
sl@0
    16
#ifndef __GDI_H__
sl@0
    17
#define __GDI_H__
sl@0
    18
sl@0
    19
#include <e32base.h>
sl@0
    20
#include <f32file.h>
sl@0
    21
#include <s32std.h>
sl@0
    22
#include <displaymode.h>
sl@0
    23
sl@0
    24
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS	
sl@0
    25
#include <graphics/gdi/glyphsample.h>
sl@0
    26
#include <graphics/gdi/gdiconsts.h>
sl@0
    27
#endif //SYMBIAN_ENABLE_SPLIT_HEADERS	
sl@0
    28
sl@0
    29
class TOpenFontCharMetrics;
sl@0
    30
class RShapeInfo;
sl@0
    31
class CGraphicsContext;
sl@0
    32
class TTextParameters;
sl@0
    33
sl@0
    34
/**
sl@0
    35
Number of twips per inch. 
sl@0
    36
@publishedAll
sl@0
    37
@released
sl@0
    38
*/
sl@0
    39
const TInt KTwipsPerInch=1440;
sl@0
    40
sl@0
    41
/**
sl@0
    42
Number of twips per point.
sl@0
    43
@publishedAll
sl@0
    44
@released
sl@0
    45
*/
sl@0
    46
const TInt KTwipsPerPoint=20;
sl@0
    47
sl@0
    48
/**
sl@0
    49
Number of points per inch. 
sl@0
    50
@publishedAll
sl@0
    51
@released
sl@0
    52
*/
sl@0
    53
const TInt KPointsPerInch=72;
sl@0
    54
sl@0
    55
/**
sl@0
    56
Number of twips per cm.
sl@0
    57
@publishedAll
sl@0
    58
@released
sl@0
    59
*/
sl@0
    60
const TInt KTwipsPerCm=567;
sl@0
    61
#if defined(__NO_CLASS_CONSTS__)
sl@0
    62
/**
sl@0
    63
A4 paper size in twips. 
sl@0
    64
@publishedAll
sl@0
    65
@released
sl@0
    66
*/
sl@0
    67
#define KA4PaperSizeInTwips TSize(11906,16838)
sl@0
    68
sl@0
    69
/** Legal paper size in twips.
sl@0
    70
@publishedAll
sl@0
    71
@released
sl@0
    72
*/
sl@0
    73
#define KLegalPaperSizeInTwips TSize(12240,20160)
sl@0
    74
sl@0
    75
/**
sl@0
    76
Executive paper size in twips. 
sl@0
    77
@publishedAll
sl@0
    78
@released
sl@0
    79
*/
sl@0
    80
#define KExecutivePaperSizeInTwips TSize(10440,15120)
sl@0
    81
/** 
sl@0
    82
Letter paper size in twips. 
sl@0
    83
@publishedAll
sl@0
    84
@released
sl@0
    85
*/
sl@0
    86
#define KLetterPaperSizeInTwips TSize(12240,15840)
sl@0
    87
sl@0
    88
/**
sl@0
    89
Com-10 paper size in twips. 
sl@0
    90
@publishedAll
sl@0
    91
@released
sl@0
    92
*/
sl@0
    93
#define KCom_10PaperSizeInTwips TSize(5940,13680)
sl@0
    94
sl@0
    95
/**
sl@0
    96
Monarch paper size in twips. 
sl@0
    97
@publishedAll
sl@0
    98
@released
sl@0
    99
*/
sl@0
   100
#define KMonarchPaperSizeInTwips TSize(5580,10800)
sl@0
   101
sl@0
   102
/**
sl@0
   103
DL paper size in twips. 
sl@0
   104
@publishedAll
sl@0
   105
@released
sl@0
   106
*/
sl@0
   107
#define KDLPaperSizeInTwips TSize(6236,12472)
sl@0
   108
sl@0
   109
/**
sl@0
   110
C5 paper size in twips. 
sl@0
   111
@publishedAll
sl@0
   112
@released
sl@0
   113
*/
sl@0
   114
#define KC5PaperSizeInTwips TSize(9184,12983)
sl@0
   115
#else
sl@0
   116
/**
sl@0
   117
@publishedAll
sl@0
   118
@released
sl@0
   119
*/
sl@0
   120
const TSize KA4PaperSizeInTwips(11906,16838);
sl@0
   121
const TSize KLegalPaperSizeInTwips(12240,20160);
sl@0
   122
const TSize KExecutivePaperSizeInTwips(10440,15120);
sl@0
   123
const TSize KLetterPaperSizeInTwips(12240,15840);
sl@0
   124
const TSize KCom_10PaperSizeInTwips(5940,13680);
sl@0
   125
const TSize KMonarchPaperSizeInTwips(5580,10800);
sl@0
   126
const TSize KDLPaperSizeInTwips(6236,12472);
sl@0
   127
const TSize KC5PaperSizeInTwips(9184,12983);
sl@0
   128
#endif
sl@0
   129
sl@0
   130
sl@0
   131
/**
sl@0
   132
This enumeration holds the possible panic codes that may be raised 
sl@0
   133
by the GDI API on detecting an unrecoverable error. */
sl@0
   134
enum TGdiPanic
sl@0
   135
	{
sl@0
   136
	/** Not used */
sl@0
   137
	EGdiPanic_Unknown				= 0,
sl@0
   138
	/** One or more of the input parameters to the interface were invalid */
sl@0
   139
	EGdiPanic_InvalidInputParam		= 1,
sl@0
   140
	/** Insufficient text for successful completion of the method */
sl@0
   141
	EGdiPanic_OutOfText				= 2,
sl@0
   142
	/** Internal failure. */
sl@0
   143
	EGdiPanic_Invariant				= 3,
sl@0
   144
	/** Unused panic codes. Can be reused if needed. */
sl@0
   145
	EGdiPanic_Unused1				= 4,
sl@0
   146
	EGdiPanic_Unused2				= 5,
sl@0
   147
	/** Setting a typeface name that is too long */
sl@0
   148
	EGdiPanic_TypefaceNameOverflow	= 6,
sl@0
   149
	};
sl@0
   150
sl@0
   151
sl@0
   152
/** 24-bit RGB colour value with 8 bits each for red, green and blue.
sl@0
   153
sl@0
   154
All Graphics drawing functions are specified in terms of a 32-bit TRgb colour 
sl@0
   155
containing the three colour values plus 8 bits for alpha channel. For hardware which 
sl@0
   156
does not support 24-bit colour, a mapping from TRgb to display colours is 
sl@0
   157
performed. 
sl@0
   158
sl@0
   159
Generally, the convention for the alpha blending fact is 0 = transparent, 
sl@0
   160
255 = opaque, unless otherwise stated.  The exception to this are the TRgb constructor 
sl@0
   161
taking a single value, where the top byte of the passed in parameter is used for 
sl@0
   162
alpha information and the function Value(), which returns alpha information in the top byte.
sl@0
   163
In both these cases, 0 means opaque, 255 means transparent.
sl@0
   164
sl@0
   165
The supported display modes are enumerated in the TDisplayMode type. In each 
sl@0
   166
display mode a unique index can represent each physical colours supported, 
sl@0
   167
and which can be mapped onto a full RGB value. The mappings are as follows: 
sl@0
   168
sl@0
   169
16-colour displays use the EGA colour set: black, white, and then both light 
sl@0
   170
and dark versions of grey, red, green, blue, cyan, magenta and yellow
sl@0
   171
sl@0
   172
256-colour displays support 216 colours made up of 6x6x6 RGB values, each 
sl@0
   173
containing all possible multiples of 51 for R,G,B values. Additionally, all 
sl@0
   174
remaining 10 shades of pure red, green, blue and grey are represented, by 
sl@0
   175
adding all remaining multiples of 17. This use of 256 colours is sometimes 
sl@0
   176
known as the Netscape colour cube.
sl@0
   177
sl@0
   178
4096-colour displays effectively support RGB values with 4 bits per primary 
sl@0
   179
colour
sl@0
   180
sl@0
   181
64k-colour displays effectively support RGB values with 5 bits allocated to 
sl@0
   182
red, 6 to green and 5 to blue
sl@0
   183
sl@0
   184
16 million-colour displays support true colour with 8 bits allocated to each 
sl@0
   185
primary colour
sl@0
   186
sl@0
   187
@publishedAll
sl@0
   188
@released
sl@0
   189
@see TDisplayMode
sl@0
   190
@see DynamicPalette */
sl@0
   191
class TRgb
sl@0
   192
	{
sl@0
   193
public:
sl@0
   194
	inline TRgb();
sl@0
   195
	inline TRgb(TUint32 aValue);
sl@0
   196
	inline TRgb(TUint32 aInternalValue, TInt aAlpha);
sl@0
   197
	inline TRgb(TInt aRed,TInt aGreen,TInt aBlue);
sl@0
   198
	inline TRgb(TInt aRed, TInt aGreen, TInt aBlue, TInt aAlpha);
sl@0
   199
	inline TInt Red() const;
sl@0
   200
	inline TInt Green() const;
sl@0
   201
	inline TInt Blue() const;
sl@0
   202
	inline TInt Alpha() const;
sl@0
   203
	IMPORT_C void SetRed(TInt aRed);
sl@0
   204
	IMPORT_C void SetGreen(TInt aGreen);
sl@0
   205
	IMPORT_C void SetBlue(TInt aBlue);
sl@0
   206
	IMPORT_C void SetAlpha(TInt aAlpha);
sl@0
   207
	IMPORT_C static TRgb Gray2(TInt aGray2);
sl@0
   208
	IMPORT_C static TRgb Gray4(TInt aGray4);
sl@0
   209
	IMPORT_C static TRgb Gray16(TInt aGray16);
sl@0
   210
	IMPORT_C static TRgb Gray256(TInt aGray256);
sl@0
   211
	IMPORT_C static TRgb Color16(TInt aColor16);
sl@0
   212
	IMPORT_C static TRgb Color256(TInt aColor256);
sl@0
   213
	IMPORT_C static TRgb Color4K(TInt aColor4K);
sl@0
   214
	IMPORT_C static TRgb Color64K(TInt aColor64K);
sl@0
   215
	IMPORT_C static TRgb Color16M(TInt aColor16M);
sl@0
   216
	IMPORT_C TInt Gray2() const;
sl@0
   217
	IMPORT_C TInt Gray4() const;
sl@0
   218
	IMPORT_C TInt Gray16() const;
sl@0
   219
	IMPORT_C TInt Gray256() const;
sl@0
   220
	IMPORT_C TInt Color16() const;
sl@0
   221
	IMPORT_C TInt Color256() const;
sl@0
   222
	IMPORT_C TInt Color4K() const;
sl@0
   223
	IMPORT_C TInt Color64K() const;
sl@0
   224
	IMPORT_C TInt Color16M() const;
sl@0
   225
	inline TBool operator==(const TRgb& aColor) const;
sl@0
   226
	inline TBool operator!=(const TRgb& aColor) const;
sl@0
   227
	inline TRgb operator~() const;
sl@0
   228
	inline TRgb operator&(const TRgb& aColor);
sl@0
   229
	inline TRgb operator|(const TRgb& aColor);
sl@0
   230
	inline TRgb operator^(const TRgb& aColor);
sl@0
   231
	inline TRgb& operator&=(const TRgb& aColor);
sl@0
   232
	inline TRgb& operator|=(const TRgb& aColor);
sl@0
   233
	inline TRgb& operator^=(const TRgb& aColor);
sl@0
   234
	inline TUint32 Value() const;
sl@0
   235
	inline TUint32 Internal() const;
sl@0
   236
	inline void SetInternal(TUint32 aInternal);
sl@0
   237
	IMPORT_C TInt Difference(const TRgb& aColor) const;
sl@0
   238
	IMPORT_C void InternalizeL(RReadStream& aStream);
sl@0
   239
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
sl@0
   240
	IMPORT_C static TRgb Color16MU(TInt a0RGB);
sl@0
   241
	IMPORT_C TInt Color16MU() const;
sl@0
   242
	IMPORT_C static TRgb Color16MA(TUint aARGB);
sl@0
   243
	IMPORT_C TUint Color16MA() const;
sl@0
   244
	IMPORT_C static TRgb Color16MAP(TUint aARGB);
sl@0
   245
	IMPORT_C TUint Color16MAP() const;
sl@0
   246
	IMPORT_C TUint _Color16MAP() const;
sl@0
   247
	IMPORT_C static TRgb _Color16MAP(TUint aARGB);
sl@0
   248
	inline TInt _Gray2() const;
sl@0
   249
	inline TInt _Gray4() const;
sl@0
   250
	inline TInt _Gray16() const;
sl@0
   251
	inline TInt _Gray256() const;
sl@0
   252
	inline TInt _Color4K() const;
sl@0
   253
	inline TInt _Color64K() const;
sl@0
   254
	inline TInt _Color16M() const;
sl@0
   255
	inline TInt _Color16MU() const;
sl@0
   256
	inline TUint _Color16MA() const;
sl@0
   257
	inline static TRgb _Gray2(TInt aGray2);
sl@0
   258
	inline static TRgb _Gray4(TInt aGray4);
sl@0
   259
	inline static TRgb _Gray16(TInt aGray16);
sl@0
   260
	inline static TRgb _Gray256(TInt aGray256);
sl@0
   261
	inline static TRgb _Color4K(TInt aColor4K);
sl@0
   262
	inline static TRgb _Color64K(TInt aColor64K);
sl@0
   263
	inline static TRgb _Color16M(TInt aColor16M);
sl@0
   264
	inline static TRgb _Color16MU(TInt a0RGB);
sl@0
   265
	inline static TRgb _Color16MA(TUint aARGB);
sl@0
   266
private:
sl@0
   267
	TUint32 iValue;
sl@0
   268
	};
sl@0
   269
sl@0
   270
sl@0
   271
/**
sl@0
   272
@publishedAll
sl@0
   273
@released
sl@0
   274
*/
sl@0
   275
#define KRgbBlack		TRgb(0x000000)
sl@0
   276
#define KRgbDarkGray	TRgb(0x555555)
sl@0
   277
#define KRgbDarkRed		TRgb(0x000080)
sl@0
   278
#define KRgbDarkGreen	TRgb(0x008000)
sl@0
   279
#define KRgbDarkYellow	TRgb(0x008080)
sl@0
   280
#define KRgbDarkBlue	TRgb(0x800000)
sl@0
   281
#define KRgbDarkMagenta	TRgb(0x800080)
sl@0
   282
#define KRgbDarkCyan	TRgb(0x808000)
sl@0
   283
#define KRgbRed			TRgb(0x0000ff)
sl@0
   284
#define KRgbGreen		TRgb(0x00ff00)
sl@0
   285
#define KRgbYellow		TRgb(0x00ffff)
sl@0
   286
#define KRgbBlue		TRgb(0xff0000)
sl@0
   287
#define KRgbMagenta		TRgb(0xff00ff)
sl@0
   288
#define KRgbCyan		TRgb(0xffff00)
sl@0
   289
#define KRgbGray		TRgb(0xaaaaaa)
sl@0
   290
#define KRgbWhite		TRgb(0xffffff)
sl@0
   291
#define KRgbTransparent	TRgb(0x000000,0x00)
sl@0
   292
sl@0
   293
/** A set of static utility functions to get information about a display mode. 
sl@0
   294
@publishedAll 
sl@0
   295
@released
sl@0
   296
*/
sl@0
   297
class TDisplayModeUtils
sl@0
   298
	{
sl@0
   299
public:
sl@0
   300
	IMPORT_C static TBool IsDisplayModeColor(TDisplayMode aDispMode);
sl@0
   301
	IMPORT_C static TBool IsDisplayModeValid(TDisplayMode aDispMode);
sl@0
   302
	IMPORT_C static TInt NumDisplayModeColors(TDisplayMode aDispMode);
sl@0
   303
	IMPORT_C static TInt NumDisplayModeBitsPerPixel(TDisplayMode aDispMode);
sl@0
   304
	};
sl@0
   305
sl@0
   306
/** Provides user-definable palette support to the GDI.
sl@0
   307
sl@0
   308
A palette is a user-defined set of colours, which is a subset of the full 
sl@0
   309
range of 24-bit colours. This allows users the advantages of having a low 
sl@0
   310
bpp colour mode whilst being able to specify the colours available in that 
sl@0
   311
mode. To give an example, the EColor16 mode provides a palette of 16 colours 
sl@0
   312
as it provides a mapping between an integer index and a TRgb colour (see the 
sl@0
   313
table EGA Low-colour constants). Only a palette of 16 colour enables you to 
sl@0
   314
change the palette. Palettes are also used to allow 24-bit bitmaps to be stored 
sl@0
   315
in a more compressed form by finding the actual number of different colours 
sl@0
   316
used in the bitmap, creating a palette to allow the mapping of these colours 
sl@0
   317
to a smaller index space, and encoding the bitmaps pixels using indexes 
sl@0
   318
to this new index space. 
sl@0
   319
sl@0
   320
A palette has a size which is set at its creation and cannot be altered 
sl@0
   321
the number of entries in the palette. Each entry in a palette is a mapping 
sl@0
   322
between that entrys index and a TRgb value. Palette entries can be got 
sl@0
   323
and set at any time between the palettes creation and destruction. The 
sl@0
   324
GDIs palette support also provides functions to find the nearest palette 
sl@0
   325
colour to a requested TRgb colour. 
sl@0
   326
@publishedAll
sl@0
   327
@released
sl@0
   328
*/
sl@0
   329
class CPalette : public CBase
sl@0
   330
	{
sl@0
   331
public:
sl@0
   332
	IMPORT_C static CPalette* NewL(TInt aNumberOfEntries);
sl@0
   333
	IMPORT_C static CPalette* NewDefaultL(TDisplayMode aDispMode);
sl@0
   334
	IMPORT_C ~CPalette();
sl@0
   335
	IMPORT_C void Clear();
sl@0
   336
	inline TInt Entries() const;
sl@0
   337
	IMPORT_C TRgb GetEntry(TInt aPaletteIndex) const;
sl@0
   338
	IMPORT_C TRgb NearestEntry(const TRgb& aColor) const;
sl@0
   339
	IMPORT_C TInt NearestIndex(const TRgb& aColor) const;
sl@0
   340
	IMPORT_C void SetEntry(TInt aPaletteIndex,const TRgb& aPaletteEntry);
sl@0
   341
	IMPORT_C void GetDataPtr(TInt aFirstColor,TInt aNumColors,TPtr8& aPtr);
sl@0
   342
protected:
sl@0
   343
	IMPORT_C CPalette();
sl@0
   344
	void ConstructL(TInt aNumberOfEntries);
sl@0
   345
protected:
sl@0
   346
	TRgb* iArray;
sl@0
   347
	TInt iNumEntries;
sl@0
   348
	};
sl@0
   349
sl@0
   350
sl@0
   351
/** Enables conversion, in both directions, between a TRgb object and an index 
sl@0
   352
into an arbitrary 256 colour palette. 
sl@0
   353
@publishedAll 
sl@0
   354
@released
sl@0
   355
*/
sl@0
   356
class TColor256Util
sl@0
   357
	{
sl@0
   358
public:
sl@0
   359
	IMPORT_C void Construct(const CPalette& aPalette);
sl@0
   360
	IMPORT_C TInt Color256(TRgb aRgb) const;
sl@0
   361
	IMPORT_C void Color256(TUint8* aDestination,const TRgb* aSource,TInt aNumPixels) const;
sl@0
   362
	inline TRgb Color256(TInt aColor256) const;
sl@0
   363
	IMPORT_C static const TColor256Util* Default();
sl@0
   364
public:
sl@0
   365
	/** 256 colour lookup table.
sl@0
   366
	
sl@0
   367
	Each entry is a 32 bit value which corresponds to a TRgb value in the 
sl@0
   368
	palette passed to Construct(). If there are more than 256 colours in the 
sl@0
   369
	palette, the first 256 colours are used in this table. If there are fewer 
sl@0
   370
	than 256 entries, the remaining entries in the table are set to zero. */
sl@0
   371
	TUint32	iColorTable[256];
sl@0
   372
sl@0
   373
	/** Inverse colour lookup table.
sl@0
   374
	
sl@0
   375
	It has 4096 entries. Each entry is the index of a colour in the palette 
sl@0
   376
	that the object was created with (see Construct()) that most closely 
sl@0
   377
	matches the 4096 degrees of intensity of red, green and blue on a uniform 
sl@0
   378
	16x16x16 colour cube.
sl@0
   379
	
sl@0
   380
	It is called "inverse" because iColorTable maps indices (0..255) to TRgb 
sl@0
   381
	values, but this table maps TRgb values to palette indices. */
sl@0
   382
	TUint8	iInverseColorTable[0x1000];
sl@0
   383
	};
sl@0
   384
sl@0
   385
sl@0
   386
/** Linear digital differential analyser.
sl@0
   387
sl@0
   388
This is used to calculate the pixels which most closely approximate a specified 
sl@0
   389
straight line, or when scaling a bitmap. Note that a line is infinitely thin, 
sl@0
   390
and can only be approximated by pixels with real width and height.
sl@0
   391
sl@0
   392
Functions are provided for: pixel line traversing; jumping to a rectangle or 
sl@0
   393
co-ordinate 
sl@0
   394
@publishedAll 
sl@0
   395
@released
sl@0
   396
*/
sl@0
   397
class TLinearDDA
sl@0
   398
	{
sl@0
   399
public:
sl@0
   400
	/** LDDA Line mode. */
sl@0
   401
	enum TLineMode
sl@0
   402
		{
sl@0
   403
		/** Centres scan-lines in the pixel line */
sl@0
   404
		ECenter,
sl@0
   405
		/** Starts at the beginning of a complete scan line. Used for bitmap 
sl@0
   406
		scaling. */
sl@0
   407
		ELeft
sl@0
   408
		};
sl@0
   409
public:
sl@0
   410
	IMPORT_C TLinearDDA();
sl@0
   411
	IMPORT_C TLinearDDA(const TLinearDDA& aLine);
sl@0
   412
	IMPORT_C void Construct(const TPoint& aStart,const TPoint& aFinish,TLineMode aMode=ECenter);
sl@0
   413
	IMPORT_C TBool SingleStep(TPoint& aPosition);
sl@0
   414
	IMPORT_C TBool SingleScanline(TPoint& aStartPosition,TPoint& aEndPosition);
sl@0
   415
	IMPORT_C TBool NextStep(TPoint& aPosition);
sl@0
   416
	IMPORT_C void JumpToRect(const TRect& aRect);
sl@0
   417
	IMPORT_C void JumpToXCoord(const TInt aXCoord,TInt& aYCoord);
sl@0
   418
	IMPORT_C void JumpToYCoord(TInt& aXCoord,const TInt aYCoord);
sl@0
   419
	IMPORT_C void JumpToXCoord2(TInt aXCoord,TInt& aYCoord);
sl@0
   420
	IMPORT_C void JumpToYCoord2(TInt& aXCoord,TInt aYCoord);
sl@0
   421
private:
sl@0
   422
	void UpdatePosition();
sl@0
   423
private:
sl@0
   424
	enum TLineStatus
sl@0
   425
		{
sl@0
   426
		EInitialised,
sl@0
   427
		ECurrent,
sl@0
   428
		EComplete
sl@0
   429
		};
sl@0
   430
private:
sl@0
   431
	TInt iCount;
sl@0
   432
	TSize iDifference;
sl@0
   433
	TPoint iFinish;
sl@0
   434
	TInt iGradient;
sl@0
   435
	TPoint iInc;
sl@0
   436
	TPoint iPos;
sl@0
   437
	TPoint iStart;
sl@0
   438
	TRect iBoundingRect;
sl@0
   439
	TBool iBoundingRectSet;
sl@0
   440
	TInt16 iInsideX; // boolean, defined as TInt16 to maintain binary compatibility
sl@0
   441
	TInt16 iInsideY; // boolean, defined as TInt16 to maintain binary compatibility
sl@0
   442
	TLineStatus iStatus;
sl@0
   443
	};
sl@0
   444
sl@0
   445
sl@0
   446
/**
sl@0
   447
Font posture flags.
sl@0
   448
Fonts can be either upright or italic. 
sl@0
   449
@publishedAll	
sl@0
   450
@released
sl@0
   451
*/
sl@0
   452
enum TFontPosture
sl@0
   453
	{
sl@0
   454
	/** Font posture is normal (upright). */
sl@0
   455
	EPostureUpright,
sl@0
   456
	/** Font posture is italic. */
sl@0
   457
	EPostureItalic
sl@0
   458
	};
sl@0
   459
sl@0
   460
/**
sl@0
   461
Font stroke weight flags. 
sl@0
   462
@publishedAll	
sl@0
   463
@released
sl@0
   464
*/
sl@0
   465
enum TFontStrokeWeight
sl@0
   466
	{
sl@0
   467
	/** Font stroke weight is normal. */
sl@0
   468
	EStrokeWeightNormal,
sl@0
   469
	/** Font stroke weight is bold. */
sl@0
   470
	EStrokeWeightBold
sl@0
   471
	};
sl@0
   472
sl@0
   473
/**
sl@0
   474
Font print position flags.
sl@0
   475
Fonts can be normal, superscript or subscript. 
sl@0
   476
@publishedAll	
sl@0
   477
@released
sl@0
   478
*/
sl@0
   479
enum TFontPrintPosition
sl@0
   480
	{
sl@0
   481
	/** Font is normal. */
sl@0
   482
	EPrintPosNormal,
sl@0
   483
	/** Font is superscript. */
sl@0
   484
	EPrintPosSuperscript,
sl@0
   485
	/** Font is subscript. */
sl@0
   486
	EPrintPosSubscript
sl@0
   487
	};
sl@0
   488
sl@0
   489
/**
sl@0
   490
Font underline flags. 
sl@0
   491
@publishedAll	
sl@0
   492
@released
sl@0
   493
*/
sl@0
   494
enum TFontUnderline
sl@0
   495
	{
sl@0
   496
	/** Font is not underlined. */
sl@0
   497
	EUnderlineOff,
sl@0
   498
	/** Font is underlined. */
sl@0
   499
	EUnderlineOn
sl@0
   500
	};
sl@0
   501
sl@0
   502
/**
sl@0
   503
Font strike-through flags. 
sl@0
   504
@publishedAll	
sl@0
   505
@released
sl@0
   506
*/
sl@0
   507
enum TFontStrikethrough
sl@0
   508
	{
sl@0
   509
	/** Font is not struck-through. */
sl@0
   510
	EStrikethroughOff,
sl@0
   511
	/** Font is struck-through. */
sl@0
   512
	EStrikethroughOn
sl@0
   513
	};
sl@0
   514
sl@0
   515
/**
sl@0
   516
The maximum length of a typeface name (in characters). 
sl@0
   517
@publishedAll	
sl@0
   518
@released
sl@0
   519
*/
sl@0
   520
const TInt KMaxTypefaceNameLength=0x18;
sl@0
   521
sl@0
   522
sl@0
   523
/** Typeface name and attributes.
sl@0
   524
sl@0
   525
This class identifies a typeface by name, and contains the combination of 
sl@0
   526
attributes of the typeface. These attributes define whether it is a symbol 
sl@0
   527
typeface, whether the typeface is proportional, and whether it is serif or 
sl@0
   528
sans-serif. 
sl@0
   529
sl@0
   530
The combination of attributes for a typeface are stored in a bitmask, with 
sl@0
   531
the various bits indicating different attributes. The bitmask is calculated 
sl@0
   532
for any particular attribute combination by ORing the enumerated value for 
sl@0
   533
each individual attribute. 
sl@0
   534
@publishedAll 
sl@0
   535
@released
sl@0
   536
*/
sl@0
   537
class TTypeface
sl@0
   538
    {
sl@0
   539
public:
sl@0
   540
	enum
sl@0
   541
		{
sl@0
   542
		/** Typeface is a proportional typeface (e.g. Swiss)
sl@0
   543
		*/
sl@0
   544
		EProportional = 1,
sl@0
   545
		/** Typeface is a serif typeface (e.g. Times)
sl@0
   546
		*/
sl@0
   547
		ESerif = 2,
sl@0
   548
		/** Typeface is a symbol typeface (e.g. Symbol)
sl@0
   549
		*/
sl@0
   550
		ESymbol = 4,
sl@0
   551
		};
sl@0
   552
public:
sl@0
   553
	IMPORT_C TTypeface();
sl@0
   554
	IMPORT_C TBool operator==(const TTypeface& aTypeface) const;
sl@0
   555
	IMPORT_C void InternalizeL(RReadStream& aStream);
sl@0
   556
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
sl@0
   557
	IMPORT_C void SetAttributes(TInt aAttributes);
sl@0
   558
	IMPORT_C void SetIsProportional(TBool aIsProportional);
sl@0
   559
	IMPORT_C void SetIsSerif(TBool aIsSerif);
sl@0
   560
	IMPORT_C void SetIsSymbol(TBool aIsSymbol);
sl@0
   561
	IMPORT_C TInt Attributes() const;
sl@0
   562
	IMPORT_C TBool IsProportional() const;
sl@0
   563
	IMPORT_C TBool IsSerif() const;
sl@0
   564
	IMPORT_C TBool IsSymbol() const;
sl@0
   565
	IMPORT_C void SetScriptTypeForMetrics(TLanguage aLanguage);
sl@0
   566
	IMPORT_C void SetScriptTypeForMetrics(TInt aScript);
sl@0
   567
	IMPORT_C TInt ScriptTypeForMetrics() const;
sl@0
   568
	IMPORT_C void SetName(const TDesC& aName);
sl@0
   569
	IMPORT_C const TDesC& Name() const;
sl@0
   570
private:
sl@0
   571
	void ResetAttributes();
sl@0
   572
	void ResetScriptType();
sl@0
   573
public:
sl@0
   574
	/** The typeface name. */
sl@0
   575
    TBufC<KMaxTypefaceNameLength> iName;
sl@0
   576
private:
sl@0
   577
    TUint32 iFlags;
sl@0
   578
    };
sl@0
   579
sl@0
   580
sl@0
   581
/**
sl@0
   582
An enumerated type for the format of a glyph bitmap. This type is currently 
sl@0
   583
used to indicate whether glyph bitmaps for scalable fonts are drawn anti-aliased. 
sl@0
   584
Additional values may be defined in the future.
sl@0
   585
sl@0
   586
@see TFontStyle::SetBitmapType()
sl@0
   587
@see CFbsTypefaceStore::SetDefaultBitmapType() 
sl@0
   588
@publishedAll
sl@0
   589
@released	
sl@0
   590
*/
sl@0
   591
enum TGlyphBitmapType
sl@0
   592
	{
sl@0
   593
	/** The font store's default glyph bitmap format is used. */
sl@0
   594
	EDefaultGlyphBitmap = 0,
sl@0
   595
	/** The standard monochrome format: no anti-aliasing, 1 bit per pixel, 
sl@0
   596
	run-length encoded. */
sl@0
   597
	EMonochromeGlyphBitmap,
sl@0
   598
	/** Standard 8-bits-per-pixel with anti-aliasing. */
sl@0
   599
	EAntiAliasedGlyphBitmap,
sl@0
   600
	/** The format used when sub-pixel font rendering is used. */
sl@0
   601
	ESubPixelGlyphBitmap,
sl@0
   602
	/** The format used when outline and shadow font rendering is used. 
sl@0
   603
sl@0
   604
	If the raterizer supports the outline and shadow fonts, it will set the bitmaptype as 
sl@0
   605
	EFourColourBlendGlyphBitmap but only when glyph bitmap type is set as EAntiAliasedGlyphBitmap and 
sl@0
   606
	when any of the EDropShadow or EOutline effect is on. Only rasterizer providers can use this enum.
sl@0
   607
	*/
sl@0
   608
	EFourColourBlendGlyphBitmap,
sl@0
   609
	/**
sl@0
   610
	This is used for glyphs, and not fonts, and is needed to inform the font drawing routines
sl@0
   611
	that the character should be drawn using the overall font setting. 
sl@0
   612
	For Internal Use Only.
sl@0
   613
	*/
sl@0
   614
	EGlyphBitmapTypeNotDefined,
sl@0
   615
	/**
sl@0
   616
	This is used to inform the rasterizer that the best match should be
sl@0
   617
	found for the bitmap type based upon its knowledge.
sl@0
   618
	For Internal Use Only.
sl@0
   619
	*/
sl@0
   620
	EAntiAliasedOrMonochromeGlyphBitmap,
sl@0
   621
	};
sl@0
   622
sl@0
   623
/**
sl@0
   624
Defines a set of font effects flags.
sl@0
   625
sl@0
   626
@publishedAll 
sl@0
   627
@released
sl@0
   628
WARNING: This Class is for use by system/UI software ONLY.
sl@0
   629
*/
sl@0
   630
NONSHARABLE_CLASS(FontEffect)
sl@0
   631
	{
sl@0
   632
public:
sl@0
   633
	enum TEffect
sl@0
   634
		{
sl@0
   635
		ENone			= 0x0,		// No effects.
sl@0
   636
		EAlgorithmicBold= 0x10,		// Font is algorithmic bold (a.k.a pseudo bold.)
sl@0
   637
		EDropShadow		= 0x20,		// Font has a drop shadow.
sl@0
   638
		EOutline		= 0x40,		// Font is an outline font.
sl@0
   639
		EEmbossed		= 0x80,		// Font is embossed.
sl@0
   640
		EEngraved		= 0x100,	// Font is engraved.
sl@0
   641
		ESoftEdge		= 0x200,	// Font is soft edged.
sl@0
   642
		EReserved1		= 0x400,	// Reserved for Symbian use.
sl@0
   643
		EReserved2		= 0x800,	// Reserved for Symbian use.
sl@0
   644
		EReserved3		= 0x1000,	// Reserved for Symbian use.
sl@0
   645
		EReserved4		= 0x2000,	// Reserved for Symbian use.
sl@0
   646
		EReserved5		= 0x4000,	// Reserved for Symbian use.
sl@0
   647
		EReserved6		= 0x8000,	// Reserved for Symbian use.
sl@0
   648
		};
sl@0
   649
public:
sl@0
   650
	IMPORT_C static TBool IsEffectOn(TEffect aEffect, TUint32 aFontEffect);
sl@0
   651
	IMPORT_C static void SetEffect(TEffect aEffect, TBool aOn, TUint32& aFontEffect);
sl@0
   652
	};
sl@0
   653
sl@0
   654
/** Encapsulates a font style. 
sl@0
   655
sl@0
   656
The font style information is comprised of:
sl@0
   657
sl@0
   658
the posture of the font upright or italic
sl@0
   659
sl@0
   660
the stroke weight of the font  normal or bold
sl@0
   661
sl@0
   662
the print position of the font normal, subscript or superscript
sl@0
   663
sl@0
   664
Note that the underline and strike-through attributes are not included in 
sl@0
   665
this class, but are set in the graphics context.
sl@0
   666
sl@0
   667
@see CGraphicsContext::SetUnderlineStyle()
sl@0
   668
@see CGraphicsContext::SetStrikethroughStyle() 
sl@0
   669
@publishedAll
sl@0
   670
@released
sl@0
   671
*/
sl@0
   672
class TFontStyle
sl@0
   673
	{
sl@0
   674
public:
sl@0
   675
	IMPORT_C TFontStyle();
sl@0
   676
	IMPORT_C TFontStyle(TFontPosture aPost,TFontStrokeWeight aStrWgt,TFontPrintPosition aPrintPos);
sl@0
   677
	IMPORT_C void InternalizeL(RReadStream& aStream);
sl@0
   678
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
sl@0
   679
	IMPORT_C TFontPosture Posture() const;
sl@0
   680
	IMPORT_C TFontStrokeWeight StrokeWeight() const;
sl@0
   681
	IMPORT_C TFontPrintPosition PrintPosition() const;
sl@0
   682
	IMPORT_C void SetPosture(TFontPosture aPosture);
sl@0
   683
	IMPORT_C void SetStrokeWeight(TFontStrokeWeight aStrokeWeight);
sl@0
   684
	IMPORT_C void SetPrintPosition(TFontPrintPosition aPrintPosition);
sl@0
   685
	inline TGlyphBitmapType BitmapType() const;
sl@0
   686
	inline void SetBitmapType(TGlyphBitmapType aBitmapType);
sl@0
   687
	IMPORT_C TBool operator==(const TFontStyle& aFontStyle) const;
sl@0
   688
	IMPORT_C TUint32 Effects() const;
sl@0
   689
	IMPORT_C TBool IsEffectOn(FontEffect::TEffect aEffect) const;
sl@0
   690
	IMPORT_C void SetEffects(TUint32 aEffects);
sl@0
   691
	IMPORT_C void SetEffects(FontEffect::TEffect aEffect, TBool aOn);
sl@0
   692
private:
sl@0
   693
	enum
sl@0
   694
		{
sl@0
   695
		EItalic=0x1,
sl@0
   696
		EBold=0x2,
sl@0
   697
		ESuper=0x4,
sl@0
   698
		ESub=0x8
sl@0
   699
		};
sl@0
   700
private:
sl@0
   701
	TUint32 iFlags; // bitmap type - 16 bits (high), font effects - 12 bits (middle), style - 4 bits (low)
sl@0
   702
	TAny* iReserved1;
sl@0
   703
	TAny* iReserved2;
sl@0
   704
	};
sl@0
   705
sl@0
   706
sl@0
   707
sl@0
   708
/**
sl@0
   709
Specifies the font specification in device independent terms.
sl@0
   710
@publishedAll 
sl@0
   711
@released
sl@0
   712
*/
sl@0
   713
class TFontSpec
sl@0
   714
	{
sl@0
   715
public:
sl@0
   716
	IMPORT_C TFontSpec();
sl@0
   717
	IMPORT_C TFontSpec(const TDesC& aTypefaceName,TInt aHeight);
sl@0
   718
	IMPORT_C TBool operator==(const TFontSpec& aFontSpec) const;
sl@0
   719
	IMPORT_C void InternalizeL(RReadStream& aStream);
sl@0
   720
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
sl@0
   721
	IMPORT_C void SetScriptTypeForMetrics(TLanguage aLanguage);
sl@0
   722
	IMPORT_C TInt ScriptTypeForMetrics() const;
sl@0
   723
public:
sl@0
   724
	/** The typeface. */
sl@0
   725
	TTypeface iTypeface;
sl@0
   726
	/** The height of the typeface (in twips). */
sl@0
   727
	TInt iHeight;
sl@0
   728
	/** The font style of the typeface. */
sl@0
   729
	TFontStyle iFontStyle;
sl@0
   730
	};
sl@0
   731
sl@0
   732
sl@0
   733
sl@0
   734
/** Typeface family support information.
sl@0
   735
sl@0
   736
This data-only class includes the name and attributes of a typeface, how many 
sl@0
   737
font heights are available, its minimum and maximum heights, and whether or 
sl@0
   738
not it is scaleable  a typeface is scaleable if it supports heights at 
sl@0
   739
fixed intervals between the minimum and maximum heights. 
sl@0
   740
@publishedAll 
sl@0
   741
@released
sl@0
   742
*/
sl@0
   743
class TTypefaceSupport
sl@0
   744
    {
sl@0
   745
public:
sl@0
   746
	/** The name and attributes of the typeface. */
sl@0
   747
    TTypeface iTypeface;
sl@0
   748
	/** The number of distinct font heights available in the typeface. */
sl@0
   749
    TInt iNumHeights;
sl@0
   750
	/** The typeface's minimum font height, in twips. */
sl@0
   751
    TInt iMinHeightInTwips;
sl@0
   752
	/** The typeface's maximum font height, in twips. */
sl@0
   753
    TInt iMaxHeightInTwips;
sl@0
   754
	/** Whether the typeface is scaleable. ETrue if it is scaleable, otherwise 
sl@0
   755
	EFalse. */
sl@0
   756
    TBool iIsScalable; // supports heights from min to max at fixed interval
sl@0
   757
    };
sl@0
   758
sl@0
   759
/**
sl@0
   760
The percentage used to multiply a normal font height when calculating its 
sl@0
   761
superscript or subscript height. 
sl@0
   762
@publishedAll	
sl@0
   763
@released
sl@0
   764
*/
sl@0
   765
const TInt KSuperSubScalingPercentage=67;
sl@0
   766
sl@0
   767
/**
sl@0
   768
The percentage of a font height used to calculate its baseline offset for a 
sl@0
   769
superscript print position. 
sl@0
   770
@publishedAll	
sl@0
   771
@released
sl@0
   772
*/
sl@0
   773
const TInt KSuperscriptOffsetPercentage=-28;
sl@0
   774
sl@0
   775
/**
sl@0
   776
The percentage of a font height used to calculate its baseline offset for a 
sl@0
   777
subscript print position. 
sl@0
   778
@publishedAll	
sl@0
   779
@released
sl@0
   780
*/
sl@0
   781
const TInt KSubscriptOffsetPercentage=14;
sl@0
   782
sl@0
   783
class CFont;
sl@0
   784
sl@0
   785
/** Typeface store abstract base interface.
sl@0
   786
sl@0
   787
This class provides the interface to a store for typefaces.
sl@0
   788
sl@0
   789
See also CFontStore. 
sl@0
   790
@publishedAll
sl@0
   791
@released
sl@0
   792
*/
sl@0
   793
class CTypefaceStore : public CBase
sl@0
   794
	{
sl@0
   795
public:
sl@0
   796
	IMPORT_C ~CTypefaceStore();
sl@0
   797
sl@0
   798
	/**
sl@0
   799
	Gets the font which is the nearest to the given font specification.
sl@0
   800
sl@0
   801
	When the font is no longer needed, call @c ReleaseFont().
sl@0
   802
sl@0
   803
	Note that this deprecated function is replaced by the new @c GetNearestFontToDesignHeightInTwips() 
sl@0
   804
	yielding (virtually) the same result. However clients are strongly encouraged to use the new
sl@0
   805
	@c GetNearestFontToMaxHeightInTwips() function instead. This will guarantee that every 
sl@0
   806
	character within any given text string will fit within the given amount of twips, whereas the design 
sl@0
   807
	height is an aesthetic unit decided by the font designer without strict physical meaning, which 
sl@0
   808
	may result in cropped characters.
sl@0
   809
sl@0
   810
	@param aFont On return, contains a pointer to the nearest font.
sl@0
   811
	@param aFontSpec The specification of the font to be matched.
sl@0
   812
	@return KErrNone if successful; a system-wide error code otherwise.
sl@0
   813
	@publishedAll
sl@0
   814
	@deprecated Use GetNearestFontToDesignHeightInTwips
sl@0
   815
	*/
sl@0
   816
	virtual TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec) = 0;
sl@0
   817
sl@0
   818
	/**
sl@0
   819
	Gets the font which is the nearest to the given font specification.
sl@0
   820
	
sl@0
   821
	When the font is no longer needed, call @c ReleaseFont().
sl@0
   822
sl@0
   823
	This new function replaces the deprecated @c GetNearestFontInTwips() yielding (virtually) the 
sl@0
   824
	same result. However clients are strongly encouraged to use the new
sl@0
   825
	@c GetNearestFontToMaxHeightInTwips() function instead. This will guarantee that every 
sl@0
   826
	character within any given text string will fit within the given amount of twips, whereas the design 
sl@0
   827
	height is an aesthetic unit decided by the font designer without strict physical meaning, which 
sl@0
   828
	may result in cropped characters.
sl@0
   829
sl@0
   830
	@param aFont On return, contains a pointer to the nearest font.
sl@0
   831
	@param aFontSpec The specification of the font to be matched.
sl@0
   832
	@return KErrNone if successful; a system-wide error code otherwise.
sl@0
   833
	@publishedAll
sl@0
   834
	@released
sl@0
   835
	*/
sl@0
   836
	virtual TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec) = 0;
sl@0
   837
	
sl@0
   838
	/**
sl@0
   839
	Gets the font which is the nearest to the given font specification.
sl@0
   840
	
sl@0
   841
	When the font is no longer needed, call @c ReleaseFont().
sl@0
   842
sl@0
   843
	The font and bitmap server returns a pointer to the nearest matching font 
sl@0
   844
	from those available. Matches to max height of font - this does its best 
sl@0
   845
	to return a font that will fit within the maximum height specified (but 
sl@0
   846
	note that variations due to hinting algorithms may rarely result in this 
sl@0
   847
	height being exceeded by up to one pixel). Problems can also be 
sl@0
   848
	encountered with bitmap fonts where the typeface exists but doesn't have 
sl@0
   849
	a font small enough.
sl@0
   850
sl@0
   851
	@param aFont On return, contains a pointer to the nearest font.
sl@0
   852
	@param aFontSpec The specification of the font to be matched.
sl@0
   853
	@param aMaxHeight The maximum height within which the font must fit.
sl@0
   854
	@return KErrNone if successful; a system-wide error code otherwise.
sl@0
   855
	@publishedAll
sl@0
   856
	@released
sl@0
   857
	*/
sl@0
   858
	virtual TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight) = 0;
sl@0
   859
sl@0
   860
	/** Gets the number of typefaces supported by the typeface store.
sl@0
   861
	
sl@0
   862
	@return The number of supported typefaces. */
sl@0
   863
	virtual TInt NumTypefaces() const=0;
sl@0
   864
sl@0
   865
	/** Gets typeface information for a specified typeface index.
sl@0
   866
 
sl@0
   867
 	This information is returned in aTypefaceSupport, and
sl@0
   868
	includes the typeface name and typeface attributes, the number of font
sl@0
   869
 	heights, the maximum and minimum font heights, and whether it is a
sl@0
   870
	scaleable typeface.
sl@0
   871
 
sl@0
   872
 	@param aTypefaceSupport On return, if the function executed successfully, 
sl@0
   873
 	this object contains the typeface information.
sl@0
   874
  	@param aTypefaceIndex A typeface index number, in the range: zero to
sl@0
   875
             (NumTypefaces() - 1). */
sl@0
   876
	virtual void TypefaceSupport(TTypefaceSupport& aTypefaceSupport,TInt aTypefaceIndex) const=0;
sl@0
   877
sl@0
   878
	/** Gets the height of the font with specified height and typeface indices, 
sl@0
   879
	in twips.
sl@0
   880
	
sl@0
   881
	The value returned is rounded up or down to the nearest font height in twips.
sl@0
   882
	
sl@0
   883
	@param aTypefaceIndex A typeface index number, in the range: 0 to 
sl@0
   884
	(NumTypefaces() - 1). 
sl@0
   885
	@param aHeightIndex A font height index number.
sl@0
   886
	@return The height of the font, in twips. */
sl@0
   887
	virtual TInt FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const=0;
sl@0
   888
	IMPORT_C void ReleaseFont(CFont* aFont);
sl@0
   889
	IMPORT_C static TInt BaselineOffset(TInt aHeight,TFontPrintPosition aPos);
sl@0
   890
	IMPORT_C static TInt SuperSubHeight(TInt aHeight,TFontPrintPosition aPos);
sl@0
   891
protected:
sl@0
   892
	IMPORT_C CTypefaceStore();
sl@0
   893
	IMPORT_C void ConstructL();
sl@0
   894
	IMPORT_C void AddFontL(CFont* aFont);
sl@0
   895
	IMPORT_C TBool IncrementFontCount(const CFont* aFont);
sl@0
   896
private:
sl@0
   897
	TBool FindFont(const CFont* aFont, TInt& aIdx) const;
sl@0
   898
	NONSHARABLE_CLASS(TFontAccess)
sl@0
   899
	/**
sl@0
   900
	Pairs a font with a count of how many clients of the typeface store 
sl@0
   901
	are accessing that font. 
sl@0
   902
    */
sl@0
   903
		{
sl@0
   904
	public:
sl@0
   905
		/** A device specific font. */
sl@0
   906
		CFont* iFont;
sl@0
   907
		/** The number of clients accessing the font. */
sl@0
   908
		TInt iAccessCount;
sl@0
   909
		};
sl@0
   910
protected:
sl@0
   911
	/** A list of fonts accessed by clients of the typeface store, which pairs 
sl@0
   912
	a font with a count of the number of clients accessing the font.
sl@0
   913
	
sl@0
   914
	Implemented as an array of TFontAccess objects.
sl@0
   915
	
sl@0
   916
	An object is added to this array for every font accessed. If the font is 
sl@0
   917
	released by all clients, and the access count drops to zero, the font is 
sl@0
   918
	removed from the list. */
sl@0
   919
	CArrayFixFlat<TFontAccess>* iFontAccess;
sl@0
   920
	};
sl@0
   921
sl@0
   922
/** The maximum number of entries in the font cache.
sl@0
   923
sl@0
   924
@see CFontCache */
sl@0
   925
const TInt KMaxFontCacheEntries=32;
sl@0
   926
sl@0
   927
/** Font cache. 
sl@0
   928
sl@0
   929
When a CFont* needs to be found for a particular TFontSpec, the cache can 
sl@0
   930
be searched to see if the TFontSpec is already in the cache. If the TFontSpec 
sl@0
   931
is in the cache, its corresponding CFont* can be returned. Otherwise 
sl@0
   932
GetNearestFontInTwips() must be used to search all of the available fonts for 
sl@0
   933
the nearest CFont- a procedure which takes much longer than a simple cache
sl@0
   934
search.
sl@0
   935
sl@0
   936
The current font cache should be destroyed and a new cache created whenever 
sl@0
   937
the zoom factor or device map changes, as these changes break the relation 
sl@0
   938
between CFont and TFontSpec. 
sl@0
   939
@publishedAll
sl@0
   940
@released
sl@0
   941
*/
sl@0
   942
class CFontCache : public CBase
sl@0
   943
	{
sl@0
   944
public:
sl@0
   945
	IMPORT_C CFontCache();
sl@0
   946
	IMPORT_C CFontCache(TInt aMaxEntries);
sl@0
   947
	IMPORT_C ~CFontCache();
sl@0
   948
	IMPORT_C CFont* Search(const TFontSpec& aFontSpec);
sl@0
   949
	IMPORT_C CFont* AddEntryL(CFont* aFont,const TFontSpec& aFontSpec);
sl@0
   950
	IMPORT_C CFont* RemoveFirstEntry();
sl@0
   951
public:
sl@0
   952
	/** The number of cache hits since the font cache was created i.e. 
sl@0
   953
	successful results from CFontCache::Search(). */
sl@0
   954
	TInt iNumHits;
sl@0
   955
	/** The number of cache misses since the font cache was created i.e. 
sl@0
   956
	unsuccessful results from CFontCache::Search(). */
sl@0
   957
	TInt iNumMisses;
sl@0
   958
private:
sl@0
   959
	class CFontCacheEntry : public CBase
sl@0
   960
		{
sl@0
   961
	public:
sl@0
   962
		CFontCacheEntry(CFont* aFont,const TFontSpec& aFontSpec,CFontCacheEntry* aNext);
sl@0
   963
	public:
sl@0
   964
		CFont* iFont;
sl@0
   965
		TFontSpec iSpec;
sl@0
   966
		CFontCacheEntry* iNext;
sl@0
   967
		};
sl@0
   968
private:
sl@0
   969
	TInt iNumEntries;
sl@0
   970
	TInt iMaxEntries;
sl@0
   971
	CFontCacheEntry* iFirst;
sl@0
   972
	};
sl@0
   973
sl@0
   974
/** Interface class for mapping between twips and device-specific units (pixels).
sl@0
   975
sl@0
   976
TZoomFactor is derived from MGraphicsDeviceMap.
sl@0
   977
sl@0
   978
@see CGraphicsDevice
sl@0
   979
@see TZoomFactor 
sl@0
   980
@publishedAll
sl@0
   981
@released
sl@0
   982
*/
sl@0
   983
class MGraphicsDeviceMap
sl@0
   984
    {
sl@0
   985
public:
sl@0
   986
	IMPORT_C MGraphicsDeviceMap();
sl@0
   987
	IMPORT_C virtual ~MGraphicsDeviceMap();
sl@0
   988
	IMPORT_C TPoint TwipsToPixels(const TPoint& aTwipPoint) const;
sl@0
   989
	IMPORT_C TRect TwipsToPixels(const TRect& aTwipRect) const;
sl@0
   990
	IMPORT_C TPoint PixelsToTwips(const TPoint& aPixelPoint) const;
sl@0
   991
	IMPORT_C TRect PixelsToTwips(const TRect& aPixelRect) const;
sl@0
   992
sl@0
   993
	/** Converts a horizontal dimension from twips to pixels.
sl@0
   994
	
sl@0
   995
	An implementation is supplied by a derived class.
sl@0
   996
	
sl@0
   997
	@param aTwips A horizontal dimension of a device in twips. 
sl@0
   998
	@return A horizontal dimension of a device in pixels. */
sl@0
   999
	virtual TInt HorizontalTwipsToPixels(TInt aTwips) const=0;
sl@0
  1000
sl@0
  1001
	/** Converts a vertical dimension from twips to pixels.
sl@0
  1002
	
sl@0
  1003
	An implementation is supplied by a derived class.
sl@0
  1004
	
sl@0
  1005
	@param aTwips A vertical dimension of a device in twips. 
sl@0
  1006
	@return A vertical dimension of a device in pixels. */
sl@0
  1007
	virtual TInt VerticalTwipsToPixels(TInt aTwips) const=0;
sl@0
  1008
sl@0
  1009
	/** Converts a horizontal dimension from pixels to twips.
sl@0
  1010
	
sl@0
  1011
	An implementation is supplied by a derived class.
sl@0
  1012
	
sl@0
  1013
	@param aPixels A horizontal dimension of a device in pixels. 
sl@0
  1014
	@return A horizontal dimension of a device in twips. */
sl@0
  1015
	virtual TInt HorizontalPixelsToTwips(TInt aPixels) const=0;
sl@0
  1016
sl@0
  1017
	/** Converts a vertical dimension from pixels to twips.
sl@0
  1018
	
sl@0
  1019
	An implementation is supplied by a derived class.
sl@0
  1020
	
sl@0
  1021
	@param aPixels A vertical dimension of a device in pixels. 
sl@0
  1022
	@return A vertical dimension of a device in twips. */
sl@0
  1023
	virtual TInt VerticalPixelsToTwips(TInt aPixels) const=0;
sl@0
  1024
sl@0
  1025
	/**
sl@0
  1026
	Gets the font which is the nearest to the given font specification.
sl@0
  1027
sl@0
  1028
	When the font is no longer needed, call @c ReleaseFont().
sl@0
  1029
sl@0
  1030
	Note that this deprecated function is replaced by the new @c GetNearestFontToDesignHeightInTwips() 
sl@0
  1031
	yielding (virtually) the same result. However clients are strongly encouraged to use the new
sl@0
  1032
	@c GetNearestFontToMaxHeightInTwips() function instead. This will guarantee that every 
sl@0
  1033
	character within any given text string will fit within the given amount of twips, whereas the design 
sl@0
  1034
	height is an aesthetic unit decided by the font designer without strict physical meaning, which 
sl@0
  1035
	may result in cropped characters.
sl@0
  1036
sl@0
  1037
	@param aFont On return, contains a pointer to the nearest font.
sl@0
  1038
	@param aFontSpec The specification of the font to be matched.
sl@0
  1039
	@return KErrNone if successful; a system-wide error code otherwise.
sl@0
  1040
	@publishedAll
sl@0
  1041
	@deprecated Use GetNearestFontToDesignHeightInTwips
sl@0
  1042
	*/
sl@0
  1043
	virtual TInt GetNearestFontInTwips(CFont*& aFont,const TFontSpec& aFontSpec)=0;
sl@0
  1044
sl@0
  1045
	/**
sl@0
  1046
	Gets the font which is the nearest to the given font specification.
sl@0
  1047
	
sl@0
  1048
	When the font is no longer needed, call @c ReleaseFont().
sl@0
  1049
sl@0
  1050
	This new function replaces the deprecated @c GetNearestFontInTwips() yielding (virtually) the 
sl@0
  1051
	same result. However clients are strongly encouraged to use the new
sl@0
  1052
	@c GetNearestFontToMaxHeightInTwips() function instead. This will guarantee that every 
sl@0
  1053
	character within any given text string will fit within the given amount of twips, whereas the design 
sl@0
  1054
	height is an aesthetic unit decided by the font designer without strict physical meaning, which 
sl@0
  1055
	may result in cropped characters.
sl@0
  1056
sl@0
  1057
	@param aFont On return, contains a pointer to the nearest font.
sl@0
  1058
	@param aFontSpec The specification of the font to be matched.
sl@0
  1059
	@return KErrNone if successful; a system-wide error code otherwise.
sl@0
  1060
	@publishedAll
sl@0
  1061
	@released
sl@0
  1062
	*/
sl@0
  1063
	virtual TInt GetNearestFontToDesignHeightInTwips(
sl@0
  1064
		CFont*& /*aFont*/, const TFontSpec& /*aFontSpec*/) { return KErrNotSupported; }
sl@0
  1065
sl@0
  1066
	/**
sl@0
  1067
	Gets the font which is the nearest to the given font specification.
sl@0
  1068
sl@0
  1069
	When the font is no longer needed, call @c ReleaseFont().
sl@0
  1070
sl@0
  1071
	The font and bitmap server returns a pointer to the nearest matching font 
sl@0
  1072
	from those available. Matches to max height of font - this does its best 
sl@0
  1073
	to return a font that will fit within the maximum height specified (but 
sl@0
  1074
	note that variations due to hinting algorithms may rarely result in this 
sl@0
  1075
	height being exceeded by up to one pixel). Problems can also be 
sl@0
  1076
	encountered with bitmap fonts where the typeface exists but doesn't have 
sl@0
  1077
	a font small enough.
sl@0
  1078
sl@0
  1079
	@param aFont On return, contains a pointer to the nearest font.
sl@0
  1080
	@param aFontSpec The specification of the font to be matched.
sl@0
  1081
	@param aMaxHeight The maximum height within which the font must fit.
sl@0
  1082
	This overrides the height specified in aFontSpec.
sl@0
  1083
	@return KErrNone if successful; a system-wide error code otherwise.
sl@0
  1084
	@publishedAll
sl@0
  1085
	@released
sl@0
  1086
	*/
sl@0
  1087
	virtual TInt GetNearestFontToMaxHeightInTwips(
sl@0
  1088
		CFont*& /*aFont*/, const TFontSpec& /*aFontSpec*/, TInt /*aMaxHeight*/) { return KErrNotSupported; }
sl@0
  1089
sl@0
  1090
	/** Releases the specified font.
sl@0
  1091
	
sl@0
  1092
	It is used to indicate that the specified font is no longer needed for use 
sl@0
  1093
	by the device map. As fonts can be shared between applications, this 
sl@0
  1094
	function does not delete the copy of the font from RAM unless the font was 
sl@0
  1095
	only being used by this particular device map.
sl@0
  1096
	
sl@0
  1097
	An implementation is supplied by a derived class.
sl@0
  1098
	
sl@0
  1099
	@param aFont A pointer to the font to be released. */
sl@0
  1100
	virtual void ReleaseFont(CFont* aFont)=0;
sl@0
  1101
    };
sl@0
  1102
sl@0
  1103
class CGraphicsContext;
sl@0
  1104
sl@0
  1105
/** Specifies the interface for concrete device classes.
sl@0
  1106
sl@0
  1107
It holds information on the capabilities and attributes of a graphics device. 
sl@0
  1108
The CBitmapDevice and CPrinterDevice classes are derived from CGraphicsDevice.
sl@0
  1109
sl@0
  1110
@see CGraphicsDevice
sl@0
  1111
@see CPrinterDevice 
sl@0
  1112
@publishedAll
sl@0
  1113
@released
sl@0
  1114
*/
sl@0
  1115
class CGraphicsDevice : public CBase , public MGraphicsDeviceMap
sl@0
  1116
    {
sl@0
  1117
public:
sl@0
  1118
	/** Gets the display mode of the device.
sl@0
  1119
	
sl@0
  1120
	@return The display mode of the device. */
sl@0
  1121
	virtual TDisplayMode DisplayMode() const=0;
sl@0
  1122
sl@0
  1123
	/** Gets the size of the device area in pixels.
sl@0
  1124
	
sl@0
  1125
	@return The width and height of the device area, in pixels */
sl@0
  1126
	virtual TSize SizeInPixels() const=0;
sl@0
  1127
sl@0
  1128
	/** Gets the size of the device area in twips.
sl@0
  1129
	
sl@0
  1130
	@return The width and height of the device area, in twips */
sl@0
  1131
	virtual TSize SizeInTwips() const=0;
sl@0
  1132
sl@0
  1133
 	/** Creates a graphics context for the device.
sl@0
  1134
	
sl@0
  1135
	@param aGC On return, contains a pointer to the created graphics context. 
sl@0
  1136
	@return KErrNone, if successful; otherwise, another of the system-wide error 
sl@0
  1137
	codes. */
sl@0
  1138
    virtual TInt CreateContext(CGraphicsContext*& aGC)=0;
sl@0
  1139
sl@0
  1140
	/** Gets the number of typefaces supported by the graphics device.
sl@0
  1141
	
sl@0
  1142
	@return The number of typefaces supported. */
sl@0
  1143
    virtual TInt NumTypefaces() const=0;
sl@0
  1144
sl@0
  1145
 	/** Gets typeface information for a specified typeface.
sl@0
  1146
	
sl@0
  1147
	This information is returned in aTypefaceSupport, and includes:
sl@0
  1148
	
sl@0
  1149
	the typeface name and typeface attributes
sl@0
  1150
	
sl@0
  1151
	the number of font heights
sl@0
  1152
	
sl@0
  1153
	the maximum and minimum font heights
sl@0
  1154
	
sl@0
  1155
	whether it is a scalable typeface
sl@0
  1156
	
sl@0
  1157
	@param aTypefaceSupport On return, contains the typeface information. 
sl@0
  1158
	@param aTypefaceIndex A typeface index number, in the range: zero to 
sl@0
  1159
	(NumTypefaces() - 1). 
sl@0
  1160
	@see NumTypefaces() */
sl@0
  1161
    virtual void TypefaceSupport(TTypefaceSupport& aTypefaceSupport,TInt aTypefaceIndex) const=0;
sl@0
  1162
sl@0
  1163
	/** Get the height of a font in twips.
sl@0
  1164
	
sl@0
  1165
	The font is identified by typeface and height.
sl@0
  1166
	
sl@0
  1167
	The value returned is rounded up or down to the nearest font height in twips.
sl@0
  1168
	
sl@0
  1169
	@param aTypefaceIndex An index identifying the typeface, in the range: 0 
sl@0
  1170
	to (NumTypefaces() - 1). 
sl@0
  1171
	@param aHeightIndex An index identifying the font height, in the range: 0 
sl@0
  1172
	to (iNumHeights - 1). Note that iNumHeights is in the TTypefaceSupport 
sl@0
  1173
	object returned by TypefaceSupport(). 
sl@0
  1174
	@return The height of the font, in twips. */
sl@0
  1175
	virtual TInt FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const=0;
sl@0
  1176
sl@0
  1177
	/** Gets the palette attributes of the device.
sl@0
  1178
	
sl@0
  1179
	@param aModifiable On return, holds information on whether or not the device's 
sl@0
  1180
	palette is modifiable (ETrue) or fixed (EFalse). 
sl@0
  1181
	@param aNumEntries On return, holds the number of entries in the device's 
sl@0
  1182
	palette. */
sl@0
  1183
	virtual void PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const=0;
sl@0
  1184
sl@0
  1185
	/** Sets the device's palette.
sl@0
  1186
	
sl@0
  1187
	Setting the palette is only possible if the device has a modifiable palette, 
sl@0
  1188
	which can be determined by calling PaletteAttributes().
sl@0
  1189
	
sl@0
  1190
	@param aPalette The new palette for the device. */
sl@0
  1191
	virtual void SetPalette(CPalette* aPalette)=0;
sl@0
  1192
sl@0
  1193
	/** Gets the device's current palette.
sl@0
  1194
	
sl@0
  1195
	This function is only supported if the device has a modifiable palette, 
sl@0
  1196
	which can be determined by calling PaletteAttributes().
sl@0
  1197
	
sl@0
  1198
	@param aPalette On return, holds the device's current palette.
sl@0
  1199
	@return KErrNone, if successful; otherwise, another of the system-wide error 
sl@0
  1200
	codes. */
sl@0
  1201
	virtual TInt GetPalette(CPalette*& aPalette) const=0;
sl@0
  1202
    };
sl@0
  1203
sl@0
  1204
sl@0
  1205
/** 
sl@0
  1206
Code section range information. 
sl@0
  1207
sl@0
  1208
A code section defines the bitmaps for characters in a specified range -
sl@0
  1209
the range is stored in objects of this type. 
sl@0
  1210
@publishedAll
sl@0
  1211
@deprecated 	This is not used anywhere in version 6.0.
sl@0
  1212
*/
sl@0
  1213
class TCodeSection
sl@0
  1214
	{
sl@0
  1215
public:
sl@0
  1216
	/** The beginning of the range. */
sl@0
  1217
	TInt iStart;
sl@0
  1218
	/** The end of the range. */
sl@0
  1219
	TInt iEnd;
sl@0
  1220
	};
sl@0
  1221
sl@0
  1222
/**
sl@0
  1223
WARNING: this Class is for internal use ONLY.  Compatibility is not guaranteed in future releases.
sl@0
  1224
UIDs corresponding to the CFont API extension functions
sl@0
  1225
@internalTechnology
sl@0
  1226
*/
sl@0
  1227
const TUid KFontCapitalAscent	= {0x1020498E};
sl@0
  1228
const TUid KFontMaxAscent		= {0x10204B10};
sl@0
  1229
const TUid KFontStandardDescent	= {0x10204B11};
sl@0
  1230
const TUid KFontMaxDescent		= {0x10205AFC};
sl@0
  1231
const TUid KFontLineGap			= {0x10204B12};
sl@0
  1232
const TUid KFontGetFontTable    = {0x102872C1};
sl@0
  1233
const TUid KFontGetGlyphOutline = {0x102872C2};
sl@0
  1234
const TUid KFontReleaseGlyphOutline = {0x2002A1FD};
sl@0
  1235
const TUid KFontReleaseFontTable = {0x2002AC24};
sl@0
  1236
sl@0
  1237
sl@0
  1238
/** Abstract font interface.
sl@0
  1239
sl@0
  1240
The CFont class provides a device-independent interface to a device-dependent 
sl@0
  1241
font usually obtained from a call to GetNearestFont...() on a graphics device. 
sl@0
  1242
It is used as a handle in CGraphicsContext::UseFont() and to obtain 
sl@0
  1243
device-dependent information about the font - notably the pixel width of a text 
sl@0
  1244
string.
sl@0
  1245
sl@0
  1246
@see CFbsFont
sl@0
  1247
@see CGraphicsContext::UseFont() 
sl@0
  1248
@publishedAll 
sl@0
  1249
@released
sl@0
  1250
*/
sl@0
  1251
class CFont : public CBase
sl@0
  1252
	{
sl@0
  1253
	friend class CTypefaceStore;
sl@0
  1254
public:
sl@0
  1255
sl@0
  1256
	/** Text direction flags.
sl@0
  1257
sl@0
  1258
	This enum is used in TMeasureTextInput and determines whether the text is 
sl@0
  1259
	drawn horizontally or vertically. Note: text is drawn vertically in some 
sl@0
  1260
	styles of Japanese, etc.
sl@0
  1261
sl@0
  1262
	@see TMeasureTextInput */
sl@0
  1263
	enum TTextDirection
sl@0
  1264
		{
sl@0
  1265
	/** Text is drawn horizontally. */
sl@0
  1266
 		/** Text is drawn horizontally. */
sl@0
  1267
   		EHorizontal,
sl@0
  1268
 		/** Text is drawn vertically. */
sl@0
  1269
		EVertical
sl@0
  1270
		};
sl@0
  1271
sl@0
  1272
	/** Complicated parameter block used for contextual glyph selection, 
sl@0
  1273
	ligature creation and diacritic placement when drawing text in complex 
sl@0
  1274
	scripts
sl@0
  1275
sl@0
  1276
	This class declares a constructor, another scoped class, and several other 
sl@0
  1277
	enums. However this class is unlikely to be useful to third party developers.
sl@0
  1278
sl@0
  1279
	@see CFont::GetCharacterPosition()
sl@0
  1280
	@see CFont::GetCharacterPosition2()
sl@0
  1281
	@publishedAll
sl@0
  1282
	@released
sl@0
  1283
	*/
sl@0
  1284
	class TPositionParam
sl@0
  1285
		{
sl@0
  1286
	public:
sl@0
  1287
		/** Standard constructor. */
sl@0
  1288
		TPositionParam():
sl@0
  1289
			iDirection(EHorizontal),
sl@0
  1290
			iFlags(0),
sl@0
  1291
			iPosInText(0),
sl@0
  1292
			iOutputGlyphs(0)
sl@0
  1293
			{
sl@0
  1294
			}
sl@0
  1295
sl@0
  1296
		enum
sl@0
  1297
			{
sl@0
  1298
			EMaxInputChars = 18,	// ligatures cannot be made from more than 18 components
sl@0
  1299
			EMaxOutputGlyphs = 8	// output can consist of up to 8 characters (one base and 7 combining characters)
sl@0
  1300
			};
sl@0
  1301
sl@0
  1302
		/**Flags for TPositionParam::iFlags. */
sl@0
  1303
		enum TFlags
sl@0
  1304
			{
sl@0
  1305
			/** Input text is logically ordered not visually ordered. */
sl@0
  1306
			EFLogicalOrder = 1
sl@0
  1307
			};
sl@0
  1308
sl@0
  1309
		/** Input: Orientation (EHorizontal or EVertical) in which to draw
sl@0
  1310
		the text. */
sl@0
  1311
		TInt16 iDirection;
sl@0
  1312
		/** Input: Flags from TFlags. */
sl@0
  1313
		TUint16 iFlags;
sl@0
  1314
		/** Input: Text containing the characters to be positioned. */
sl@0
  1315
		TPtrC iText;
sl@0
  1316
sl@0
  1317
		/** Input and output: Position within iText to shape. On exit
sl@0
  1318
		it will index the first character not positioned */
sl@0
  1319
		TInt iPosInText;
sl@0
  1320
		/** Input and output: Pen position. */
sl@0
  1321
		TPoint iPen;			
sl@0
  1322
sl@0
  1323
		/** Output of GetCharacterPosition and GetCharacterPosition2.
sl@0
  1324
		@see CFont::GetCharacterPosition
sl@0
  1325
		@see CFont::GetCharacterPosition2
sl@0
  1326
		@publishedAll
sl@0
  1327
		@released */
sl@0
  1328
		class TOutput
sl@0
  1329
			{
sl@0
  1330
		public:
sl@0
  1331
			/** Standard constructor. */
sl@0
  1332
			TOutput() : iBitmapSize(TSize::EUninitialized),
sl@0
  1333
				iBounds(TRect::EUninitialized) {}
sl@0
  1334
			/** Character or glyph code. */
sl@0
  1335
			TUint iCode;			
sl@0
  1336
			/** Bitmap data for the glyph, if available */
sl@0
  1337
			const TUint8* iBitmap;	
sl@0
  1338
			/** Size of the bitmap before algorithmic bolding, size 
sl@0
  1339
			multiplication, etc. */
sl@0
  1340
			TSize iBitmapSize;		
sl@0
  1341
			/** Bitmap bounds relative to the original pen position. */
sl@0
  1342
			TRect iBounds;			
sl@0
  1343
			};
sl@0
  1344
sl@0
  1345
		/** Information about the glyphs that were output. */
sl@0
  1346
		TOutput iOutput[EMaxOutputGlyphs];	
sl@0
  1347
		/** Number of glyphs actually output. */
sl@0
  1348
		TInt iOutputGlyphs;					
sl@0
  1349
		};	
sl@0
  1350
sl@0
  1351
sl@0
  1352
	/** Input parameter block.
sl@0
  1353
sl@0
  1354
	This is optionally used by CFont::MeasureText(), which is the powerful text 
sl@0
  1355
	measurement function underlying all the other text measurement functions.
sl@0
  1356
sl@0
  1357
	@see CFont::MeasureText() 
sl@0
  1358
	@publishedAll
sl@0
  1359
	@released
sl@0
  1360
	*/
sl@0
  1361
	class TMeasureTextInput
sl@0
  1362
		{
sl@0
  1363
	public:
sl@0
  1364
		TMeasureTextInput():
sl@0
  1365
			iStartInputChar(0),
sl@0
  1366
			iEndInputChar(KMaxTInt),
sl@0
  1367
			iDirection(EHorizontal),
sl@0
  1368
			iFlags(0),
sl@0
  1369
			iMaxAdvance(KMaxTInt),
sl@0
  1370
			iMaxBounds(KMaxTInt),
sl@0
  1371
			iCharJustNum(0),
sl@0
  1372
			iCharJustExcess(0),
sl@0
  1373
			iWordJustNum(0),
sl@0
  1374
			iWordJustExcess(0)
sl@0
  1375
			{
sl@0
  1376
			}
sl@0
  1377
sl@0
  1378
		/**Flags for TMeasureTextInput::iFlags. */
sl@0
  1379
		enum TFlags
sl@0
  1380
			{
sl@0
  1381
 			/** Input text is visually ordered left-to-right. */
sl@0
  1382
 			EFVisualOrder = 1,
sl@0
  1383
 			/** Input text is visually ordered right-to-left.
sl@0
  1384
 			Overrides EFVisualOrder. */
sl@0
  1385
 			EFVisualOrderRightToLeft = 2,
sl@0
  1386
 			/** Flag to consider side bearings when checking bounds for line-break */
sl@0
  1387
 			EFIncludePenPositionInBoundsCheck = 4
sl@0
  1388
			};
sl@0
  1389
sl@0
  1390
		/** Starting index specifying first input character in iText.
sl@0
  1391
	
sl@0
  1392
		Together with iEndInputChar, this allows some context before and 
sl@0
  1393
		after the measured text to be supplied so that shaping can work 
sl@0
  1394
		properly. */
sl@0
  1395
		TInt iStartInputChar;	
sl@0
  1396
	
sl@0
  1397
		/** Index specifying the final input character.
sl@0
  1398
	
sl@0
  1399
		Together with iStartInputChar, this allows some context before and 
sl@0
  1400
		after the measured text to be supplied so that shaping can work 
sl@0
  1401
		properly. */
sl@0
  1402
		TInt iEndInputChar;		
sl@0
  1403
	
sl@0
  1404
		/** The direction in which to draw the text. */
sl@0
  1405
		TUint16 iDirection;
sl@0
  1406
	
sl@0
  1407
		/** Flags from TFlags. */
sl@0
  1408
		TUint16 iFlags;
sl@0
  1409
	
sl@0
  1410
		/** The maximum advance. */
sl@0
  1411
		TInt iMaxAdvance;		
sl@0
  1412
		
sl@0
  1413
		/** The maximum width (or height if drawing vertically) of bounds. */
sl@0
  1414
		TInt iMaxBounds;		
sl@0
  1415
	
sl@0
  1416
		/** The number of glyph groups to be letter-spaced. */
sl@0
  1417
		TInt iCharJustNum;		
sl@0
  1418
	
sl@0
  1419
		/** The amount of space to be used for letter spacing. */
sl@0
  1420
		TInt iCharJustExcess;	
sl@0
  1421
		
sl@0
  1422
		/** The number of spaces to be used for word spacing. */
sl@0
  1423
		TInt iWordJustNum;		
sl@0
  1424
	
sl@0
  1425
		/** The amount of space to be used for word spacing. */
sl@0
  1426
		TInt iWordJustExcess;	
sl@0
  1427
		};
sl@0
  1428
sl@0
  1429
	/** Output parameter block.
sl@0
  1430
sl@0
  1431
	This is optionally used by CFont::MeasureText(), which is the powerful text 
sl@0
  1432
	measurement function underlying all the other text measurement functions.
sl@0
  1433
sl@0
  1434
	@see CFont::MeasureText() 
sl@0
  1435
	@publishedAll
sl@0
  1436
	@released
sl@0
  1437
	*/
sl@0
  1438
	class TMeasureTextOutput
sl@0
  1439
		{
sl@0
  1440
		public:
sl@0
  1441
		/** The number of input characters that would be drawn.
sl@0
  1442
	
sl@0
  1443
		This may be less than the length of the text if a maximum advance or bounding 
sl@0
  1444
		box size is specified. */
sl@0
  1445
		TInt iChars;			
sl@0
  1446
		/** The number of glyphs that would be drawn. */
sl@0
  1447
		TInt iGlyphs;			
sl@0
  1448
		/** The number of groups that would be drawn.
sl@0
  1449
	
sl@0
  1450
		A group is a base glyph plus one or more combining characters. */
sl@0
  1451
		TInt iGroups;			
sl@0
  1452
		/** The number of word spaces (U+0020) that would be drawn. */
sl@0
  1453
		TInt iSpaces;			
sl@0
  1454
		/** The bounding box of all the glyphs that would be drawn. */
sl@0
  1455
		TRect iBounds;			
sl@0
  1456
		/** The maximum width and height of any glyph. */
sl@0
  1457
		TSize iMaxGlyphSize;	
sl@0
  1458
		};
sl@0
  1459
sl@0
  1460
	/**
sl@0
  1461
	Data availability flags.
sl@0
  1462
sl@0
  1463
	Some fonts like printer fonts may only have width information and can return 
sl@0
  1464
	ECharacterWidthOnly to show this: the text drawing routines in CFont synthesize 
sl@0
  1465
	the rest of the data if necessary.
sl@0
  1466
sl@0
  1467
	@see GetCharacterData() 
sl@0
  1468
	@publishedAll	
sl@0
  1469
	@released
sl@0
  1470
	*/
sl@0
  1471
	enum TCharacterDataAvailability
sl@0
  1472
		{
sl@0
  1473
		/** No font information available. */
sl@0
  1474
		ENoCharacterData,
sl@0
  1475
		/** Width information only is available. */
sl@0
  1476
		ECharacterWidthOnly,
sl@0
  1477
		/** All character data is available. */
sl@0
  1478
		EAllCharacterData
sl@0
  1479
		};
sl@0
  1480
sl@0
  1481
private:
sl@0
  1482
	// virtual functions have been made protected and public non-virtual ones
sl@0
  1483
	// added to convert CFont to a handle-body pattern. SC is kept throught the
sl@0
  1484
	// new functions and BC is kept by keeping the protected functions in the
sl@0
  1485
	// same place in the class, and therefore in the same place in the vtable
sl@0
  1486
	/**
sl@0
  1487
	@publishedAll
sl@0
  1488
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
  1489
	*/
sl@0
  1490
	virtual TUid DoTypeUid() const=0;
sl@0
  1491
	/**
sl@0
  1492
	@publishedAll
sl@0
  1493
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
  1494
	*/
sl@0
  1495
	virtual TInt DoHeightInPixels() const=0;
sl@0
  1496
	/**
sl@0
  1497
	@publishedAll
sl@0
  1498
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
  1499
	*/
sl@0
  1500
	virtual TInt DoAscentInPixels() const=0;
sl@0
  1501
	IMPORT_C virtual TInt DoDescentInPixels() const;
sl@0
  1502
	/**
sl@0
  1503
	@publishedAll
sl@0
  1504
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
  1505
	*/
sl@0
  1506
	virtual TInt DoCharWidthInPixels(TChar aChar) const=0;
sl@0
  1507
	/**
sl@0
  1508
	@publishedAll
sl@0
  1509
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
  1510
	*/
sl@0
  1511
	virtual TInt DoTextWidthInPixels(const TDesC& aText) const=0;
sl@0
  1512
	/**
sl@0
  1513
	@publishedAll
sl@0
  1514
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
  1515
	*/
sl@0
  1516
	virtual TInt DoBaselineOffsetInPixels() const=0;
sl@0
  1517
	/**
sl@0
  1518
	@publishedAll
sl@0
  1519
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
  1520
	*/
sl@0
  1521
	virtual TInt DoTextCount(const TDesC& aText,TInt aWidthInPixels) const=0;
sl@0
  1522
	/**
sl@0
  1523
	@publishedAll
sl@0
  1524
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
  1525
	*/
sl@0
  1526
	virtual TInt DoTextCount(const TDesC& aText,TInt aWidthInPixels,TInt& aExcessWidthInPixels) const=0;
sl@0
  1527
	/**
sl@0
  1528
	@publishedAll
sl@0
  1529
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
  1530
	*/
sl@0
  1531
	virtual TInt DoMaxCharWidthInPixels() const=0;
sl@0
  1532
	/**
sl@0
  1533
	@publishedAll
sl@0
  1534
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
  1535
	*/
sl@0
  1536
	virtual TInt DoMaxNormalCharWidthInPixels() const=0;
sl@0
  1537
	/**
sl@0
  1538
	@publishedAll
sl@0
  1539
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
  1540
	*/
sl@0
  1541
	virtual TFontSpec DoFontSpecInTwips() const=0;
sl@0
  1542
sl@0
  1543
protected:	
sl@0
  1544
	IMPORT_C virtual TCharacterDataAvailability DoGetCharacterData(TUint aCode, TOpenFontCharMetrics& aMetrics,const TUint8*& aBitmap,TSize& aBitmapSize) const;
sl@0
  1545
	IMPORT_C virtual TBool DoGetCharacterPosition(TPositionParam& aParam) const;
sl@0
  1546
	IMPORT_C virtual TInt DoExtendedFunction(TUid aFunctionId, TAny* aParam = NULL) const;
sl@0
  1547
sl@0
  1548
protected:
sl@0
  1549
	IMPORT_C virtual ~CFont();
sl@0
  1550
sl@0
  1551
public:
sl@0
  1552
	inline TInt FontCapitalAscent() const;
sl@0
  1553
	inline TInt FontMaxAscent() const;
sl@0
  1554
	inline TInt FontStandardDescent() const;
sl@0
  1555
	inline TInt FontMaxDescent() const;
sl@0
  1556
	inline TInt FontLineGap() const;
sl@0
  1557
	inline TInt FontMaxHeight() const;
sl@0
  1558
sl@0
  1559
public:
sl@0
  1560
	/** Gets run-time identity of the actual font type. This enables safe casting to 
sl@0
  1561
	a derived type.
sl@0
  1562
	
sl@0
  1563
	For example, if the derived type is a CFbsFont, the return value is KCFbsFontUid. 
sl@0
  1564
	You would need to cast to a CFbsFont to get a character bounding box. Similarly, 
sl@0
  1565
	a CBitmapFont returns KCBitmapFontUidVal.
sl@0
  1566
	
sl@0
  1567
	@return The font-type identifier. */
sl@0
  1568
	IMPORT_C TUid TypeUid() const;
sl@0
  1569
sl@0
  1570
	/** Gets the font height in pixels.
sl@0
  1571
	Note that this deprecated function is replaced by the new @c FontMaxHeight().
sl@0
  1572
sl@0
  1573
	@return The font height in pixels.
sl@0
  1574
	@see FontMaxHeight()
sl@0
  1575
	@deprecated */
sl@0
  1576
	IMPORT_C TInt HeightInPixels() const;
sl@0
  1577
sl@0
  1578
	/** Gets the font ascent in pixels.
sl@0
  1579
	Note that this deprecated function is replaced by the new @c FontMaxAscent()
sl@0
  1580
	or in some cases @c FontCapitalAscent().	
sl@0
  1581
	
sl@0
  1582
	@return The font ascent in pixels.
sl@0
  1583
	@see FontCapitalAscent()
sl@0
  1584
	@see FontMaxAscent()
sl@0
  1585
	@deprecated */
sl@0
  1586
	IMPORT_C TInt AscentInPixels() const;
sl@0
  1587
	
sl@0
  1588
	/** Gets the font descent in pixels.
sl@0
  1589
	Note that this deprecated function is replaced by the new @c FontMaxDescent()
sl@0
  1590
	or in some cases @c FontStandardDescent().	
sl@0
  1591
	
sl@0
  1592
	@return The font descent in pixels.
sl@0
  1593
	@see FontStandardDescent() 
sl@0
  1594
	@see FontMaxDescent()
sl@0
  1595
	@deprecated */
sl@0
  1596
	IMPORT_C TInt DescentInPixels() const;
sl@0
  1597
sl@0
  1598
	/** Gets the width in pixels in this font of the specified character.
sl@0
  1599
	
sl@0
  1600
	Note: For OpenType fonts this function returns the horizontal advance of
sl@0
  1601
	the character, which may be different from the actual width.
sl@0
  1602
	
sl@0
  1603
	@param aChar The character whose width should be determined. 
sl@0
  1604
	@return The width in pixels of the specified character in this font. */
sl@0
  1605
	IMPORT_C TInt CharWidthInPixels(TChar aChar) const;
sl@0
  1606
sl@0
  1607
	/** Gets the width in pixels of the specified descriptor when displayed in this 
sl@0
  1608
	font.
sl@0
  1609
	
sl@0
  1610
	@param aText The descriptor whose width should be determined. 
sl@0
  1611
	@return The width of the specified descriptor when displayed in this font, 
sl@0
  1612
	in pixels. */
sl@0
  1613
	IMPORT_C TInt TextWidthInPixels(const TDesC& aText) const;
sl@0
  1614
sl@0
  1615
	/** Gets the baseline offset in pixels. 
sl@0
  1616
	
sl@0
  1617
	The baseline offset is how far a font is raised or lowered from its normal 
sl@0
  1618
	baseline.
sl@0
  1619
	
sl@0
  1620
	@return Offset from normal baseline, in pixels. */
sl@0
  1621
	IMPORT_C TInt BaselineOffsetInPixels() const;
sl@0
  1622
sl@0
  1623
	/** Gets how much of the specified descriptor can be displayed in this font without 
sl@0
  1624
	exceeding the specified width.
sl@0
  1625
	
sl@0
  1626
	Note:
sl@0
  1627
	
sl@0
  1628
	This function does not display any of the descriptor itself - it is used 
sl@0
  1629
	before display, to test whether the whole descriptor can be displayed.
sl@0
  1630
	
sl@0
  1631
	@param aText The descriptor. 
sl@0
  1632
	@param aWidthInPixels The available width for character display. 
sl@0
  1633
	@return The number of characters which will be able to be displayed without 
sl@0
  1634
	exceeding the specified width. The count starts from the beginning of the 
sl@0
  1635
	descriptor. */
sl@0
  1636
	IMPORT_C TInt TextCount(const TDesC& aText,TInt aWidthInPixels) const;
sl@0
  1637
sl@0
  1638
	/** Gets how much of the specified descriptor can be displayed in this font without 
sl@0
  1639
	exceeding the specified width. 
sl@0
  1640
	
sl@0
  1641
	It also returns the excess width - defined as the specified available width 
sl@0
  1642
	minus the width of the portion of the descriptor which can be displayed without 
sl@0
  1643
	exceeding the available width.
sl@0
  1644
	
sl@0
  1645
	@param aText The descriptor. 
sl@0
  1646
	@param aWidthInPixels The available width for character display. 
sl@0
  1647
	@param aExcessWidthInPixels The excess width after displaying the portion of 
sl@0
  1648
	the descriptor, in pixels. 
sl@0
  1649
	@return The number of characters which will be able to be displayed without 
sl@0
  1650
	exceeding the specified width. The count starts from the beginning of the 
sl@0
  1651
	descriptor. */
sl@0
  1652
	IMPORT_C TInt TextCount(const TDesC& aText,TInt aWidthInPixels,TInt& aExcessWidthInPixels) const;
sl@0
  1653
sl@0
  1654
	/** Gets the width in pixels of the widest character in this font.
sl@0
  1655
	
sl@0
  1656
	@return The width of the maximum width character, in pixels. */
sl@0
  1657
	IMPORT_C TInt MaxCharWidthInPixels() const;
sl@0
  1658
sl@0
  1659
	/** Gets the width in pixels of the widest normal character in this font.
sl@0
  1660
	
sl@0
  1661
	Normal characters include all character in a character set except non-alphabetic 
sl@0
  1662
	characters (e.g. the copyright symbol, or a block graphics symbol, for example).
sl@0
  1663
	
sl@0
  1664
	@return The width of the maximum width normal character, in pixels. */
sl@0
  1665
	IMPORT_C TInt MaxNormalCharWidthInPixels() const;
sl@0
  1666
sl@0
  1667
	/** Gets the font specification of this font in twips.
sl@0
  1668
	
sl@0
  1669
	@return The font specification of this font (in twips). */
sl@0
  1670
	IMPORT_C TFontSpec FontSpecInTwips() const;
sl@0
  1671
	IMPORT_C TCharacterDataAvailability GetCharacterData(TUint aCode, TOpenFontCharMetrics& aMetrics,const TUint8*& aBitmap,TSize& aBitmapSize) const;
sl@0
  1672
	IMPORT_C TBool GetCharacterPosition(TPositionParam& aParam) const;
sl@0
  1673
	IMPORT_C TInt WidthZeroInPixels() const;
sl@0
  1674
	IMPORT_C TInt MeasureText(const TDesC& aText, const TMeasureTextInput* aInput = NULL, TMeasureTextOutput* aOutput = NULL) const;
sl@0
  1675
	IMPORT_C static TBool CharactersJoin(TInt aLeftCharacter, TInt aRightCharacter);
sl@0
  1676
	IMPORT_C TInt ExtendedFunction(TUid aFunctionId, TAny* aParam = NULL) const;
sl@0
  1677
	IMPORT_C TBool GetCharacterPosition2(TPositionParam& aParam, RShapeInfo& aShapeInfo) const;
sl@0
  1678
sl@0
  1679
	/** Gets the width in pixels of the specified descriptor when displayed in this 
sl@0
  1680
	font.
sl@0
  1681
	
sl@0
  1682
	@param aText The descriptor whose width should be determined.
sl@0
  1683
	@param aParam Parameter block that controls how much of aText is measured
sl@0
  1684
	@return The width of the specified descriptor when displayed in this font, 
sl@0
  1685
	in pixels. */
sl@0
  1686
	IMPORT_C TInt TextWidthInPixels(const TDesC& aText,const TMeasureTextInput* aParam) const;
sl@0
  1687
	};
sl@0
  1688
sl@0
  1689
class CFbsBitmap;
sl@0
  1690
class CWsBitmap;
sl@0
  1691
/** Abstract base class for all graphics contexts.
sl@0
  1692
sl@0
  1693
Created by a CGraphicsDevice.
sl@0
  1694
sl@0
  1695
Provides the 'context' in which you are drawing to an associated device, in 
sl@0
  1696
the sense that it holds the settings for drawing, such as the pen and brush 
sl@0
  1697
settings (e.g. color, line styles) and the font settings (e.g. bold, underline, 
sl@0
  1698
italic). These settings are device-independent.
sl@0
  1699
sl@0
  1700
Also provides the clipping region (the visible drawing area).
sl@0
  1701
sl@0
  1702
The settings and clipping area can be updated while drawing.
sl@0
  1703
sl@0
  1704
This class also contains the main drawing functions, and all drawing is done 
sl@0
  1705
through a CGraphicsContext.
sl@0
  1706
sl@0
  1707
The graphics context deals with pixels of device-dependent size and uses fonts 
sl@0
  1708
with device-dependent size and representation. The sizes and fonts to be passed 
sl@0
  1709
to the class functions therefore need to be converted from size-independent 
sl@0
  1710
units to size-dependent units first. This is done by an MGraphicsDeviceMap 
sl@0
  1711
derived class. This may be a TZoomFactor or the CGraphicsDevice.
sl@0
  1712
sl@0
  1713
See CGraphicsContext::Reset() for the default graphics context settings immediately 
sl@0
  1714
after construction.
sl@0
  1715
sl@0
  1716
@see CBitmapContext 
sl@0
  1717
@publishedAll
sl@0
  1718
@released
sl@0
  1719
*/
sl@0
  1720
class CGraphicsContext : public CBase
sl@0
  1721
	{
sl@0
  1722
public:
sl@0
  1723
sl@0
  1724
sl@0
  1725
	/** Text alignment.
sl@0
  1726
	@publishedAll
sl@0
  1727
	@released
sl@0
  1728
	*/
sl@0
  1729
	enum TTextAlign
sl@0
  1730
		{
sl@0
  1731
		/** Text is left-aligned. */
sl@0
  1732
		ELeft,
sl@0
  1733
		/** Text is centred. */
sl@0
  1734
		ECenter,
sl@0
  1735
		/** Text is right-aligned. */
sl@0
  1736
		ERight
sl@0
  1737
		};
sl@0
  1738
sl@0
  1739
	/** 
sl@0
  1740
	Drawing mode components.
sl@0
  1741
	This enum is not intended to be used directly, but provides components for 
sl@0
  1742
	the easy specification of drawing modes in the TDrawMode enum. 
sl@0
  1743
	@publishedAll
sl@0
  1744
	@released
sl@0
  1745
	*/
sl@0
  1746
	enum TDrawModeComponents
sl@0
  1747
		{
sl@0
  1748
		/** 1 */
sl@0
  1749
		EInvertScreen=1,
sl@0
  1750
		/** 2 */
sl@0
  1751
		EXor=2,
sl@0
  1752
		/** 4 */
sl@0
  1753
		EOr=4,
sl@0
  1754
		/** 8 */
sl@0
  1755
		EAnd=8,
sl@0
  1756
		/** 14 */
sl@0
  1757
		ELogicalOp=14,
sl@0
  1758
		/** 16 */
sl@0
  1759
		EInvertPen=16,
sl@0
  1760
		/** 32 */
sl@0
  1761
		EPenmode=32,
sl@0
  1762
		/** 64 */
sl@0
  1763
		EWriteAlpha=64,
sl@0
  1764
		};
sl@0
  1765
sl@0
  1766
sl@0
  1767
	/** 
sl@0
  1768
	Drawing modes.
sl@0
  1769
sl@0
  1770
	This enum builds on the drawing mode components in the TDrawModeComponents 
sl@0
  1771
	enum.
sl@0
  1772
sl@0
  1773
	If the pen colour is p, brush colour is b and screen colour is s, the effect 
sl@0
  1774
	of TDrawMode::EDrawModeAND is P=p&s and B=b&s. In other words, the effective 
sl@0
  1775
	colour of the pen on the screen, P, is that produced by the bitwise ANDing 
sl@0
  1776
	of the current screen colour and the current pen colour. The effect is similar 
sl@0
  1777
	for the effective brush colour, B.
sl@0
  1778
sl@0
  1779
	The effective pen and brush colour are given in the table using the key
sl@0
  1780
	Inputs: pen colour is p, brush colour is b and screen colour is s
sl@0
  1781
	Outputs: effective brush colour is B, effective pen colour is P. 
sl@0
  1782
sl@0
  1783
	Some notes on using EDrawModeWriteAlpha:-
sl@0
  1784
sl@0
  1785
	- It is rare for client code to need to use this draw mode: see the documentation
sl@0
  1786
	of SetDrawMode() for more information.
sl@0
  1787
	- EDrawModeWriteAlpha should only be used with DrawRect(), Clear(), BitBlt(), and BitBltMasked() 
sl@0
  1788
	with EGray2 mask (and DrawBitmap() and DrawBitmapMasked()). For other draw operations, it is not 
sl@0
  1789
	supported, and may have unintended effects.
sl@0
  1790
	- EDrawModeWriteAlpha has the same effect as EDrawModePEN, unless the brush colour has transparency 
sl@0
  1791
	(DrawRect(), Clear()), or the source bitmap is EColor16MA (and has transparency) (BitBlt(), BitBltMasked())
sl@0
  1792
	- EDrawModeWriteAlpha has the same effect as EDrawModePEN if the draw mode of the destination does not 
sl@0
  1793
	support alpha blending. (Blending is only supported in 24bpp and 32bpp colour i.e. EColor16M, EColor16MU, EColor16MA)
sl@0
  1794
	- In these cases, EDrawModePEN does alpha blending, whereas EDrawModeWriteAlpha means don't do alpha blending.
sl@0
  1795
sl@0
  1796
	@see SetDrawMode()
sl@0
  1797
	@publishedAll
sl@0
  1798
	@released
sl@0
  1799
	*/
sl@0
  1800
	enum TDrawMode
sl@0
  1801
		{
sl@0
  1802
		/** Bitwise ANDs the pen and brush colours with the screen colour. 
sl@0
  1803
		P=p&s, B=b&s */
sl@0
  1804
		EDrawModeAND=EAnd,
sl@0
  1805
		/** Inverts the pen and brush colours before ANDing. P=(~p)&s, 
sl@0
  1806
		B=(~b)&s */
sl@0
  1807
		EDrawModeNOTAND=EInvertScreen|EAnd,
sl@0
  1808
		/** Uses both pen and brush colour as they are. P=p, B=b */
sl@0
  1809
		EDrawModePEN=EPenmode,
sl@0
  1810
		/** Inverts the screen colour before ANDing. P=p&(~s), B=b&(~s) */
sl@0
  1811
		EDrawModeANDNOT=EAnd|EInvertPen,
sl@0
  1812
		/** Bitwise XORs the pen and brush colours with the screen colour. 
sl@0
  1813
		P=p^s, B=b^s */
sl@0
  1814
		EDrawModeXOR=EXor,
sl@0
  1815
		/** Bitwise ORs the pen and brush colours with the screen colour. 
sl@0
  1816
		P=p|s, B=b|s */
sl@0
  1817
		EDrawModeOR=EOr,
sl@0
  1818
		/** Inverts the screen and pen and brush colours before ANDing. 
sl@0
  1819
		P=(~p)&(~s), B=(~b)&(~s) */
sl@0
  1820
		EDrawModeNOTANDNOT=EInvertScreen|EAnd|EInvertPen,
sl@0
  1821
		/** Inverts the pen and brush colours before XORing. P=(~p)^s, 
sl@0
  1822
		B=(~b)^s */
sl@0
  1823
		EDrawModeNOTXOR=EInvertScreen|EXor,
sl@0
  1824
		/** Inverts the colour of each pixel that is drawn over, (pen and 
sl@0
  1825
		brush attributes are ignored). P=~s, B=~s */
sl@0
  1826
		EDrawModeNOTSCREEN=EInvertScreen,
sl@0
  1827
		/** Inverts the screen colour before ORing. P=p|(~s), 
sl@0
  1828
		B=b|(~s) */
sl@0
  1829
		EDrawModeNOTOR=EInvertScreen|EOr,
sl@0
  1830
		/** Inverts the pen and brush colours. P=~p, B=~b */
sl@0
  1831
		EDrawModeNOTPEN=EInvertPen|EPenmode,
sl@0
  1832
		/** Inverts the pen and brush colours before ORing. P=(~p)|s, 
sl@0
  1833
		B=(~b)|s */
sl@0
  1834
		EDrawModeORNOT=EOr|EInvertPen,
sl@0
  1835
		/** Inverts the screen and pen and brush colours before ORing.
sl@0
  1836
		P=(~p)|(~s), B=(~b)|(~s) */
sl@0
  1837
		EDrawModeNOTORNOT=EInvertScreen|EOr|EInvertPen,
sl@0
  1838
		/** Writes alpha information in the source directly into the destination, rather than blending. */
sl@0
  1839
		EDrawModeWriteAlpha=EWriteAlpha,
sl@0
  1840
		};
sl@0
  1841
sl@0
  1842
	/** 
sl@0
  1843
	Pen styles. The screen pattern unit in each definition below describes the 
sl@0
  1844
	pattern drawn by the line 1 represents a pixel drawn, 0 represents a 
sl@0
  1845
	pixel that is not affected. 
sl@0
  1846
	@publishedAll
sl@0
  1847
	@released
sl@0
  1848
	*/
sl@0
  1849
	enum TPenStyle
sl@0
  1850
		{
sl@0
  1851
		/** The pen does not draw. Screen pattern unit = 00... */
sl@0
  1852
		ENullPen,
sl@0
  1853
		/** A solid line (default). Screen pattern unit = 11... */
sl@0
  1854
		ESolidPen,
sl@0
  1855
		/** A dotted line. Screen pattern unit = 1000... */
sl@0
  1856
		EDottedPen,
sl@0
  1857
		/** A dashed line. Screen pattern unit = 111000... */
sl@0
  1858
		EDashedPen,
sl@0
  1859
		/** A line of alternating dashes and dots. Screen pattern unit = 
sl@0
  1860
		1111001100... */
sl@0
  1861
		EDotDashPen,
sl@0
  1862
		/** A line of alternating single dashes and pairs of dots. Screen 
sl@0
  1863
		pattern unit = 11110011001100... */
sl@0
  1864
		EDotDotDashPen
sl@0
  1865
		};
sl@0
  1866
sl@0
  1867
	/** 
sl@0
  1868
	Brush styles. 
sl@0
  1869
	@publishedAll
sl@0
  1870
	@released
sl@0
  1871
	*/
sl@0
  1872
	enum TBrushStyle
sl@0
  1873
		{
sl@0
  1874
		/** The brush fill has no effect (default). */
sl@0
  1875
		ENullBrush,
sl@0
  1876
		/** The brush fills with a solid single colour, determined by 
sl@0
  1877
		SetBrushColor() and the drawing mode. */
sl@0
  1878
		ESolidBrush,
sl@0
  1879
		/** The brush fills with a selected bitmap pattern, set by 
sl@0
  1880
		UseBrushPattern(). */
sl@0
  1881
		EPatternedBrush,
sl@0
  1882
		/** The brush fills with vertical hatching  lines going from top to 
sl@0
  1883
		bottom. */
sl@0
  1884
		EVerticalHatchBrush,
sl@0
  1885
		/** The brush fills with diagonal hatching lines going from bottom 
sl@0
  1886
		left to top right. */
sl@0
  1887
		EForwardDiagonalHatchBrush,
sl@0
  1888
		/** The brush fills with horizontal hatching  lines going from left 
sl@0
  1889
		to right. */
sl@0
  1890
		EHorizontalHatchBrush,
sl@0
  1891
		/** The brush fills with rearward diagonal hatching lines going from top 
sl@0
  1892
		left to bottom right. */
sl@0
  1893
		ERearwardDiagonalHatchBrush,
sl@0
  1894
		/** The brush fills with horizontal and vertical hatching  lines going 
sl@0
  1895
		from left to right plus lines going from top to bottom  giving the 
sl@0
  1896
		effect of a grid of small squares */
sl@0
  1897
		ESquareCrossHatchBrush,
sl@0
  1898
		/** The brush fills with forward diagonal and rearward diagonal hatching 
sl@0
  1899
		lines going from bottom left to top right plus lines going from top left 
sl@0
  1900
		to bottom right giving the effect of a grid of small diamonds. */
sl@0
  1901
		EDiamondCrossHatchBrush
sl@0
  1902
		};
sl@0
  1903
sl@0
  1904
	/** 
sl@0
  1905
	Rules used to fill self crossing polygons. 
sl@0
  1906
sl@0
  1907
	The filling of a polygon proceeds as follows: for a given point in the 
sl@0
  1908
	polygon, then
sl@0
  1909
sl@0
  1910
	if the rule is TFillRule::EAlternate (default) and it has an odd winding 
sl@0
  1911
	number, then fill the surrounding area.
sl@0
  1912
sl@0
  1913
	if the rule is TFillRule::EWinding and it has a winding number greater than 
sl@0
  1914
	zero, then fill the surrounding area. 
sl@0
  1915
	@publishedAll
sl@0
  1916
	@released
sl@0
  1917
	*/
sl@0
  1918
	enum TFillRule
sl@0
  1919
		{
sl@0
  1920
		/** Only fill areas with odd winding numbers. */
sl@0
  1921
		EAlternate,
sl@0
  1922
		/** Fill areas with winding numbers greater than zero. */
sl@0
  1923
		EWinding
sl@0
  1924
		};
sl@0
  1925
sl@0
  1926
	/** Parameters to control the drawing of text. */
sl@0
  1927
	struct TDrawTextParam
sl@0
  1928
		{
sl@0
  1929
	public:
sl@0
  1930
		TDrawTextParam():
sl@0
  1931
			iDirection(CFont::EHorizontal),
sl@0
  1932
			iCharJustNum(0),
sl@0
  1933
			iCharJustExcess(0),
sl@0
  1934
			iWordJustNum(0),
sl@0
  1935
			iWordJustExcess(0)
sl@0
  1936
	/** Reserved for future use. */
sl@0
  1937
			{}
sl@0
  1938
	public:
sl@0
  1939
		/** the direction in which to draw the text. */
sl@0
  1940
		CFont::TTextDirection iDirection;	
sl@0
  1941
		/** number of glyph groups to be letterspaced */
sl@0
  1942
		TInt iCharJustNum;					
sl@0
  1943
		/** amount of space to be used for letterspacing */
sl@0
  1944
		TInt iCharJustExcess;				
sl@0
  1945
		/** number of spaces to be used for wordspacing*/
sl@0
  1946
		TInt iWordJustNum;					
sl@0
  1947
		/**  amount of space to be used for wordspacing*/
sl@0
  1948
		TInt iWordJustExcess;				
sl@0
  1949
		};
sl@0
  1950
sl@0
  1951
sl@0
  1952
	/** Parameters for extended text drawing and measuring. It is used by 
sl@0
  1953
	CGraphicsContext::DrawTextExtended() to indicate whether text should be 
sl@0
  1954
	drawn from right-to-left or left-to-right. */
sl@0
  1955
	struct TDrawTextExtendedParam : public TDrawTextParam
sl@0
  1956
		{
sl@0
  1957
	public:
sl@0
  1958
		/** Constructor. Initialises iParRightToLeft to EFalse. */
sl@0
  1959
		TDrawTextExtendedParam():
sl@0
  1960
			iParRightToLeft(EFalse)
sl@0
  1961
			{}
sl@0
  1962
	public:
sl@0
  1963
		/** ETrue if the text direction is right-to-left (for scripts like 
sl@0
  1964
		Arabic and Hebrew). EFalse if left-to-right. */
sl@0
  1965
		TBool iParRightToLeft;	
sl@0
  1966
		};
sl@0
  1967
	
sl@0
  1968
	/**
sl@0
  1969
	Parameters used in drawing text within supplied context.
sl@0
  1970
	It is used by CGraphicsContext::DrawText() and CGraphicsContext::DrawTextVertical() family of API's
sl@0
  1971
	to draw text from iStart to iEnd withing the supplied text descriptor.
sl@0
  1972
	*/
sl@0
  1973
	class TTextParameters
sl@0
  1974
		{
sl@0
  1975
	public:
sl@0
  1976
		TTextParameters():
sl@0
  1977
			iStart(0),
sl@0
  1978
			iEnd(KMaxTInt),
sl@0
  1979
			iFlags(0)
sl@0
  1980
				{
sl@0
  1981
				}
sl@0
  1982
		TInt iStart;
sl@0
  1983
		TInt iEnd;
sl@0
  1984
		TUint16 iFlags;
sl@0
  1985
		/* Reserved for future use */
sl@0
  1986
		TAny* iReserved1;
sl@0
  1987
		TAny* iReserved2;
sl@0
  1988
		TAny* iReserved3;
sl@0
  1989
		TAny* iReserved4;
sl@0
  1990
		};
sl@0
  1991
public:
sl@0
  1992
	/** Gets a pointer to the graphics context's graphics device.
sl@0
  1993
	
sl@0
  1994
	@return A pointer to the graphics device. */
sl@0
  1995
	virtual CGraphicsDevice* Device() const=0;
sl@0
  1996
sl@0
  1997
	/** Sets the position of the co-ordinate origin.
sl@0
  1998
	
sl@0
  1999
	All subsequent drawing operations are done relative to this origin.
sl@0
  2000
	
sl@0
  2001
	@param aPos The origin. The default origin is TPoint(0,0) the top left 
sl@0
  2002
	corner of the screen. */
sl@0
  2003
	virtual void SetOrigin(const TPoint& aPos=TPoint(0,0))=0;
sl@0
  2004
sl@0
  2005
	/** Sets the drawing mode. 
sl@0
  2006
	
sl@0
  2007
	The way that the pen and brush draw depends on the drawing mode. The drawing 
sl@0
  2008
	mode affects the colour that is actually drawn, because it defines the way 
sl@0
  2009
	that the current screen colour logically combines with the current pen colour 
sl@0
  2010
	and brush colour. There are many drawing modes, each giving different logical 
sl@0
  2011
	combinations of pen, brush and screen colours. Each mode is produced by ORing 
sl@0
  2012
	together different combinations of seven drawing mode components.
sl@0
  2013
	
sl@0
  2014
	The three most important modes are TDrawMode::EDrawModePEN, TDrawMode::EDrawModeNOTSCREEN 
sl@0
  2015
	and TDrawMode::EDrawModeXOR. The default drawing mode is TDrawMode::EDrawModePEN.
sl@0
  2016
	
sl@0
  2017
	The drawing mode is over-ridden for line and shape drawing functions when 
sl@0
  2018
	a wide pen line has been selected. It is forced to TDrawMode::EDrawModePEN. 
sl@0
  2019
	This is to prevent undesired effects at line joins (vertexes).
sl@0
  2020
	
sl@0
  2021
	Notes:
sl@0
  2022
	
sl@0
  2023
	TDrawMode::EDrawModeAND gives a "colour filter" effect. For example:
sl@0
  2024
	
sl@0
  2025
	- ANDing with white gives the original colour
sl@0
  2026
	- ANDing with black gives black
sl@0
  2027
	
sl@0
  2028
	TDrawMode::EDrawModeOR gives a "colour boost" effect. For example:
sl@0
  2029
	
sl@0
  2030
	- ORing with black gives the original colour
sl@0
  2031
	- ORing with white gives white
sl@0
  2032
	
sl@0
  2033
	TDrawMode::EDrawModeXOR gives an "Exclusive OR" effect. For example:
sl@0
  2034
	
sl@0
  2035
	- white XOR black gives white
sl@0
  2036
	- white XOR white gives black
sl@0
  2037
	- black XOR black gives black
sl@0
  2038
	
sl@0
  2039
	TDrawMode::EDrawModeWriteAlpha should not normally need to be used by client code. 
sl@0
  2040
	The following are exceptions:-
sl@0
  2041
sl@0
  2042
	- When a client side EColor16MA bitmap needs to have a transparent background 
sl@0
  2043
	(because you are intending to blend it onto something else), then you need to set 
sl@0
  2044
	EDrawModeWriteAlpha to Clear() it.
sl@0
  2045
	- When you want to BitBlt() with an EColor16MA source bitmap that is opaque everywhere, 
sl@0
  2046
	then using EDrawModeWriteAlpha is more efficient than EDrawModePEN, because the bitmap 
sl@0
  2047
	does not need to be blended. 
sl@0
  2048
sl@0
  2049
	Note that if you have a transparent brush or source bitmap and you are drawing to a window, 
sl@0
  2050
	then it is a defect to use EDrawModeWriteAlpha.
sl@0
  2051
sl@0
  2052
	@param aDrawingMode The drawing mode.
sl@0
  2053
	@see CGraphicsContext::TDrawMode
sl@0
  2054
	@see CGraphicsContext::TDrawModeComponents */
sl@0
  2055
	virtual void SetDrawMode(TDrawMode aDrawingMode)=0;
sl@0
  2056
sl@0
  2057
	/** Sets the clipping rectangle.	 
sl@0
  2058
	
sl@0
  2059
	The area of visible drawing depends on the clipping rectangle, any items 
sl@0
  2060
	that fall outside the extent of the clipping rectangle will not be drawn. 
sl@0
  2061
	The default clipping rectangle is the full device area.
sl@0
  2062
	
sl@0
  2063
	Note that clipping is additive. If a clipping region has been set using SetClippingRegion() 
sl@0
  2064
	then clipping will be to the intersection of that region and this rectangle.
sl@0
  2065
		
sl@0
  2066
	@param aRect The rectangle to be used as the clipping rectangle. Note that 
sl@0
  2067
	this rectangle is tranformed by the current co-ordinate origin before it is used. 
sl@0
  2068
	The co-ordinate origin is set using SetOrigin().
sl@0
  2069
	
sl@0
  2070
	@see CGraphicsContext::SetClippingRegion() 
sl@0
  2071
	@see CGraphicsContext::SetOrigin() */
sl@0
  2072
	virtual void SetClippingRect(const TRect& aRect)=0;
sl@0
  2073
sl@0
  2074
	/** Cancels any clipping rectangle.
sl@0
  2075
	
sl@0
  2076
	Clipping thus reverts to the full device area, the default.
sl@0
  2077
	
sl@0
  2078
	@see SetClippingRect() */
sl@0
  2079
	virtual void CancelClippingRect()=0;
sl@0
  2080
sl@0
  2081
	/** Resets the graphics context to its default settings:
sl@0
  2082
	
sl@0
  2083
	the drawing mode is TDrawMode::EDrawModePen (pen and brush colours used as 
sl@0
  2084
	they are)
sl@0
  2085
	
sl@0
  2086
	there is no clipping rectangle
sl@0
  2087
	
sl@0
  2088
	the pen settings are: black, solid, single pixel size
sl@0
  2089
	
sl@0
  2090
	the brush style is null
sl@0
  2091
	
sl@0
  2092
	no text font is selected */
sl@0
  2093
	virtual void Reset()=0;
sl@0
  2094
sl@0
  2095
   /** Sets the device font to be used for text drawing.
sl@0
  2096
	
sl@0
  2097
	If the font is already in memory, then that copy is shared.
sl@0
  2098
	
sl@0
  2099
	Notes:
sl@0
  2100
	
sl@0
  2101
	The CFont* argument must have been previously initialised by calling 
sl@0
  2102
	MGraphicsDeviceMap::GetNearestFontInTwips() with the required 
sl@0
  2103
	font-specification. If the CFont* has not been initialised 
sl@0
  2104
	correctly, and therefore does not point to an available font-bitmap, 
sl@0
  2105
	then a panic is raised.
sl@0
  2106
	
sl@0
  2107
	When the font is no longer required, use DiscardFont() to free up the 
sl@0
  2108
	memory used. If UseFont() is used again without using DiscardFont() then 
sl@0
  2109
	the previous font is discarded automatically.
sl@0
  2110
	
sl@0
  2111
	If no font has been selected, and an attempt is made to draw text with 
sl@0
  2112
	DrawText(), then a panic is raised.
sl@0
  2113
	
sl@0
  2114
	@param aFont A device font 
sl@0
  2115
	@see MGraphicsDeviceMap::GetNearestFontInTwips() */
sl@0
  2116
	virtual void UseFont(const CFont* aFont)=0;
sl@0
  2117
sl@0
  2118
	/** Discards a font.
sl@0
  2119
	
sl@0
  2120
	This frees up the memory used, if the font is not being shared.
sl@0
  2121
	
sl@0
  2122
	The function can be called when no font is in use. */
sl@0
  2123
	virtual void DiscardFont()=0;
sl@0
  2124
sl@0
  2125
	/** Sets the underline style.
sl@0
  2126
	
sl@0
  2127
	This is applied to all subsequently drawn text.
sl@0
  2128
	
sl@0
  2129
	@param aUnderlineStyle The underline style on or off. */
sl@0
  2130
	virtual void SetUnderlineStyle(TFontUnderline aUnderlineStyle)=0;
sl@0
  2131
sl@0
  2132
	/** Sets the strikethrough style.
sl@0
  2133
	
sl@0
  2134
	This is applied to all subsequently drawn text.
sl@0
  2135
	
sl@0
  2136
	@param aStrikethroughStyle The strikethrough style on or off. */
sl@0
  2137
	virtual void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle)=0;
sl@0
  2138
	IMPORT_C static TInt JustificationInPixels(TInt aExcessPixels,TInt aTotalUnits,TInt aFirstUnit,TInt aNumUnits);
sl@0
  2139
	IMPORT_C static TInt JustificationInPixels(TInt& aExcessPixels,TInt& aTotalUnits);
sl@0
  2140
sl@0
  2141
	/** Adjusts the spaces between words to stretch or squeeze to a certain 
sl@0
  2142
	width.
sl@0
  2143
	
sl@0
  2144
	The function is required by the Text Views API, and is not intended for 
sl@0
  2145
	regular use by developers.
sl@0
  2146
	
sl@0
  2147
	The text line that is to be justified has a certain number of gaps (spaces) 
sl@0
  2148
	between the words. It also has a distance (in pixels) between the end of 
sl@0
  2149
	the last word and the actual end of the line (right hand margin, usually). 
sl@0
  2150
	These excess width pixels are distributed amongst the gaps between the words 
sl@0
  2151
	to achieve full justification of the text line. Spaces become fat spaces to 
sl@0
  2152
	keep underlining/strikethrough consistent. Pixels are distributed to the 
sl@0
  2153
	inter-word gaps starting from the left end of the string. The spacing 
sl@0
  2154
	between characters in each word remains unchanged.
sl@0
  2155
	
sl@0
  2156
	After a call to SetWordJustification(), subsequent calls to either of the 
sl@0
  2157
	two DrawText() functions are affected until the number of spaces specified 
sl@0
  2158
	by aNumSpaces is used up.
sl@0
  2159
	
sl@0
  2160
	The easiest way to find out the excess width and number of spaces is to call 
sl@0
  2161
	CFont::MeasureText(). This function can also perform counting, which is 
sl@0
  2162
	finding how much of some text will fit into a given width.
sl@0
  2163
	
sl@0
  2164
	Use CFont::TextCount() to return the excess width.
sl@0
  2165
	
sl@0
  2166
	For example, in the string "To be, or not to be", there are five inter-word 
sl@0
  2167
	gaps. If there are six excess pixels they will be distributed in the 
sl@0
  2168
	proportion 	2, 1, 1, 1, 1 between the words. If there are nine excess pixels 
sl@0
  2169
	they will be distributed in the proportion 2, 2, 2, 2, 1 between the words.
sl@0
  2170
	
sl@0
  2171
	Notes:
sl@0
  2172
	
sl@0
  2173
	If the excess width is zero, then calling SetWordJustification() has no 
sl@0
  2174
	effect.
sl@0
  2175
	
sl@0
  2176
	At first sight it may appear that SetWordJustification() is not required 
sl@0
  2177
	because you can simply call DrawText() for each word. However, underlined 
sl@0
  2178
	justified text does not work using this strategy  you get a non-underlined 
sl@0
  2179
	gap between the space and the beginning of the next word.
sl@0
  2180
	
sl@0
  2181
	@param aExcessWidth The width (in pixels) to be distributed between the 
sl@0
  2182
	specified number of spaces. 
sl@0
  2183
	@param aNumGaps The number of word spaces (characters with the code U+0020) 
sl@0
  2184
	over which the change in width is distributed. */
sl@0
  2185
	virtual void SetWordJustification(TInt aExcessWidth,TInt aNumGaps)=0;
sl@0
  2186
sl@0
  2187
	/** Sets character justification.
sl@0
  2188
	
sl@0
  2189
	This function is required by the Text Views API, and is not intended for 
sl@0
  2190
	regular use by developers.
sl@0
  2191
	
sl@0
  2192
	It affects the strings of text used in the calls to DrawText() that follow, 
sl@0
  2193
	until the number of characters drawn equals aNumChars.
sl@0
  2194
	
sl@0
  2195
	The text line that is to be justified has a certain number of characters
sl@0
  2196
	this includes the spaces between the words. It also has a distance (in 
sl@0
  2197
	pixels) between the end of the last word and the actual end of the line 
sl@0
  2198
	(right hand margin, usually). These excess width pixels are distributed 
sl@0
  2199
	amongst all the characters, increasing the gaps between them, to achieve 
sl@0
  2200
	full justification of the text line.
sl@0
  2201
	
sl@0
  2202
	Use CFont::TextCount() to return the excess width.
sl@0
  2203
	
sl@0
  2204
	Notes:
sl@0
  2205
	
sl@0
  2206
	This function is provided to allow simulation of printer fonts on screen. 
sl@0
  2207
	Due to the fact that fully-scalable fonts are not used before v5, large 
sl@0
  2208
	printer fonts can be simulated by using the nearest smaller font and 
sl@0
  2209
	widening it slightly.
sl@0
  2210
	
sl@0
  2211
	If the excess width is zero, then calling SetCharJustification() has no 
sl@0
  2212
	effect.
sl@0
  2213
	
sl@0
  2214
	SetCharJustification() is required for WYSIWYG where the layout uses 
sl@0
  2215
	printer font metrics but screen fonts have to be drawn on the screen. 
sl@0
  2216
	Because continuously scalable typefaces (c.f. TrueType) are not used 
sl@0
  2217
	before v5 and because screen fonts are coarser and less numerous in 
sl@0
  2218
	their variety than the printer fonts, the best matching smaller screen 
sl@0
  2219
	font must be used with character justification to simulate the printer 
sl@0
  2220
	font on the screen.
sl@0
  2221
	
sl@0
  2222
	There is also a situation where the gaps between characters on screen have 
sl@0
  2223
	to be reduced with character clipping. The screen font that best matches 
sl@0
  2224
	the printer font may have the required height, but has characters that are 
sl@0
  2225
	too wide. A line of text that works on the printer will then be too long 
sl@0
  2226
	on the screen, unless it is squashed horizontally. The number of pixels 
sl@0
  2227
	that overlap the end of the screen line must now be removed from the gaps 
sl@0
  2228
	between the characters, i.e. there is a negative excess width. This 
sl@0
  2229
	situation is especially important where adding a TAB on screen gives 
sl@0
  2230
	perfectly acceptable printout, but would push the last character of the 
sl@0
  2231
	line off the right hand side of the screen.
sl@0
  2232
	
sl@0
  2233
	In practice what you do in printer layout mode is:
sl@0
  2234
	
sl@0
  2235
	Calculate where the line breaks will come on the printer. To do this you 
sl@0
  2236
	use a printer font (which in practice means a table of character widths 
sl@0
  2237
	of the font that the printer will use).
sl@0
  2238
	
sl@0
  2239
	Now change to use a screen font that is the closest font which is no taller 
sl@0
  2240
	that the printer font. In practice it will often be fatter maybe only for 
sl@0
  2241
	certain characters such as 'i'.
sl@0
  2242
	
sl@0
  2243
	You have to recalculate the width of the characters using the screen fonts. 
sl@0
  2244
	You can do this using CFont::TextWidth() as you have already determined how 
sl@0
  2245
	many characters will fit on the line.
sl@0
  2246
	
sl@0
  2247
	If, in the screen font, the characters are not as wide as the line then you 
sl@0
  2248
	can just use word justification to expand the line. You would only do this 
sl@0
  2249
	if the text is to be justified.
sl@0
  2250
	
sl@0
  2251
	If, however, the characters are wider than the line then you would use 
sl@0
  2252
	character justification to clip each character. You would need to do this 
sl@0
  2253
	even if the line is not justified.
sl@0
  2254
	
sl@0
  2255
	Thus, in practice, character justification will only very rarely be used to 
sl@0
  2256
	expand a line of characters.
sl@0
  2257
	
sl@0
  2258
	@param aExcessWidth The excess width (in pixels) to be distributed between 
sl@0
  2259
	the specified number of characters. It may be positive, in which case the text is 
sl@0
  2260
	stretched, or negative, in which case it is shrunk.
sl@0
  2261
	@param aNumChars The number of characters involved. */
sl@0
  2262
	virtual void SetCharJustification(TInt aExcessWidth,TInt aNumChars)=0;
sl@0
  2263
sl@0
  2264
	/** Sets the pen colour.
sl@0
  2265
	
sl@0
  2266
	The effective pen colour depends on the drawing mode. The default pen colour 
sl@0
  2267
	is black.
sl@0
  2268
	
sl@0
  2269
	Note:
sl@0
  2270
	
sl@0
  2271
	The pen is used to draw lines, the outlines of filled shapes, and text. In case
sl@0
  2272
	of outlined text, the pen is used to draw the outline of the font.
sl@0
  2273
	
sl@0
  2274
	The	class provides member functions to set the colour of the pen, the style of 
sl@0
  2275
	line and the line size drawn.
sl@0
  2276
	
sl@0
  2277
	@param aColor An RGB colour for the pen. 
sl@0
  2278
	@see CGraphicsContext::SetDrawMode() */
sl@0
  2279
	virtual void SetPenColor(const TRgb& aColor)=0;
sl@0
  2280
 
sl@0
  2281
	/** Sets the line drawing style for the pen. 
sl@0
  2282
	
sl@0
  2283
	There are 6 pen styles. If no pen style is set, then the default is 
sl@0
  2284
	TPenStyle::ESolidPen. To use a pen style, its full context must be given, 
sl@0
  2285
	e.g. for a null pen:
sl@0
  2286
	
sl@0
  2287
	CGraphicsContext::TPenStyle::ENullPen
sl@0
  2288
	Notes:
sl@0
  2289
	
sl@0
  2290
	The pen is used to draw lines, the outlines of filled shapes, and text. 
sl@0
  2291
	CGraphicsContext member functions are provided to set the colour of the 
sl@0
  2292
	pen, the style of line and the line size drawn.
sl@0
  2293
	
sl@0
  2294
	The TPenStyle::ENullPen style should be used if a border is not required 
sl@0
  2295
	around a filled shape.
sl@0
  2296
	
sl@0
  2297
	Dotted and dashed pen styles have a device dependant implementation, always 
sl@0
  2298
	give single-pixel size lines on the screen whatever the pen size set 
sl@0
  2299
	by SetPenSize() and can only be used for straight lines, polylines, 
sl@0
  2300
	non-rounded rectangles and polygons.
sl@0
  2301
	
sl@0
  2302
	The dotted/dashed pattern is continued, without re-starting, for all 
sl@0
  2303
	consecutively drawn straight lines, i.e.
sl@0
  2304
	
sl@0
  2305
	the outlines of rectangles the pattern starts in the top left corner. 
sl@0
  2306
	It is reset at the end of the function call.
sl@0
  2307
	
sl@0
  2308
	the outlines of polygons the pattern starts at the first point. It is 
sl@0
  2309
	reset at the end of the function call.
sl@0
  2310
	
sl@0
  2311
	polylines and straight lines the pattern starts at the first point 
sl@0
  2312
	initially. Consecutive calls to DrawLine() and/or DrawPolyLine(), whether 
sl@0
  2313
	the lines are concatenated or not, continue the pattern. It can be reset 
sl@0
  2314
	by a further call to SetPenStyle() using the same dotted/dashed style 
sl@0
  2315
	parameter.
sl@0
  2316
	
sl@0
  2317
	@param aPenStyle A pen style. 
sl@0
  2318
	@see CGraphicsContext::TPenStyle */
sl@0
  2319
	virtual void SetPenStyle(TPenStyle aPenStyle)=0;
sl@0
  2320
sl@0
  2321
	/** Sets the line drawing size for the pen.
sl@0
  2322
	
sl@0
  2323
	Lines of size greater than one pixel:
sl@0
  2324
	
sl@0
  2325
	are drawn with rounded ends that extend beyond the end points, (as if the 
sl@0
  2326
	line is drawn using a circular pen tip of the specified size).
sl@0
  2327
	
sl@0
  2328
	are always drawn in TDrawMode::EDrawModePEN mode, overriding whatever mode 
sl@0
  2329
	has been set using SetDrawMode().
sl@0
  2330
	
sl@0
  2331
	Notes:
sl@0
  2332
	
sl@0
  2333
	The pen is used to draw lines, the outlines of filled shapes, and text. The 
sl@0
  2334
	class provides member functions to set the colour of the pen, the style of 
sl@0
  2335
	line and the line size drawn.
sl@0
  2336
	
sl@0
  2337
	Wide straight lines and arcs have rounded ends so that concatenated wide 
sl@0
  2338
	lines have smoothly rounded corners at the vertexes.
sl@0
  2339
	
sl@0
  2340
	When lines are made wide, the extra strips of pixels are added equally to 
sl@0
  2341
	both sides of the line. This works precisely for lines of odd pixel size 
sl@0
  2342
	(3, 5, 7, etc.). Wide lines of even pixel size, (2, 4, 6, etc.), 
sl@0
  2343
	have the extra strip of pixels added to the right and/or below the line.
sl@0
  2344
	
sl@0
  2345
	Wide outlines of ellipses and wide line arcs are drawn with the pixels 
sl@0
  2346
	distributed either side of a thin (single pixel wide) true ellipse 
sl@0
  2347
	constructed in the normal manner. Wide ellipses and arcs of even pixel 
sl@0
  2348
	size have the extra strip of pixels added to the right and/or below the 
sl@0
  2349
	curved line. This gives a slight asymmetry to ellipses.
sl@0
  2350
	
sl@0
  2351
	If the pen style is dotted or dashed, the size specification is ignored: a 
sl@0
  2352
	single-pixel wide primitive is drawn, (this is device dependant).
sl@0
  2353
	
sl@0
  2354
	A line size of zero is handled as if the pen style had been set to 
sl@0
  2355
	TPenStyle::ENullPen.
sl@0
  2356
	
sl@0
  2357
	@param aSize A line size. The default is 1 pixel. */
sl@0
  2358
	virtual void SetPenSize(const TSize& aSize)=0;
sl@0
  2359
sl@0
  2360
	/** Sets the brush colour.
sl@0
  2361
	
sl@0
  2362
	The effective brush colour depends on the drawing mode.
sl@0
  2363
	
sl@0
  2364
	Notes:
sl@0
  2365
	
sl@0
  2366
	The brush is used for filling shapes and the background of text boxes. In 
sl@0
  2367
	case of outlined text, the brush is used for filling the font. The brush 
sl@0
  2368
	has colour, style, pattern and pattern origin parameters.
sl@0
  2369
	
sl@0
  2370
	If no brush colour has been set, it defaults to white. However the default 
sl@0
  2371
	brush style is null, so when drawing to a window the default appears to be 
sl@0
  2372
	the window's background colour.
sl@0
  2373
	
sl@0
  2374
	@param aColor An RGB colour for the brush. 
sl@0
  2375
	@see SetDrawMode() */
sl@0
  2376
	virtual void SetBrushColor(const TRgb& aColor)=0;
sl@0
  2377
sl@0
  2378
	/**	Sets the brush style.
sl@0
  2379
sl@0
  2380
	Ten brush styles are provided, including six built-in hatching patterns.
sl@0
  2381
	Note: The brush is used for filling shapes and the background of text boxes.
sl@0
  2382
	The brush has colour, style, pattern and pattern origin parameters.
sl@0
  2383
	Note: Use TBrushStyle::ENullBrush to draw the outline of a fillable
sl@0
  2384
	shape on its own, without filling.
sl@0
  2385
	Note: If the TBrushStyle::EPatternedBrush style is set, but no bitmap 
sl@0
  2386
	pattern has been selected using UseBrushPattern(), then the function panics.
sl@0
  2387
	Note: Hatching lines are done in the current pen colour, set using SetPenColor(). 
sl@0
  2388
	The hatching pattern starts at the brush origin, set using SetBrushOrigin().
sl@0
  2389
	@see TBrushStyle::ENullBrush
sl@0
  2390
	@see TBrushStyle::EPatternedBrush
sl@0
  2391
	@see UseBrushPattern()
sl@0
  2392
	@see SetPenColor()
sl@0
  2393
	@see SetBrushOrigin()
sl@0
  2394
	@publishedAll
sl@0
  2395
	@released
sl@0
  2396
	@param aBrushStyle A brush style. */
sl@0
  2397
	virtual void SetBrushStyle(TBrushStyle aBrushStyle)=0;
sl@0
  2398
sl@0
  2399
	/** Sets the brush pattern origin.
sl@0
  2400
	
sl@0
  2401
	This specifies the top left-hand corner position for the pattern tile around 
sl@0
  2402
	which copies of the pattern are tiled.
sl@0
  2403
	
sl@0
  2404
	The brush pattern may be a built-in style, or a bitmap. To use a bitmap, the 
sl@0
  2405
	brush must have a pattern set and the brush style must be set to 
sl@0
  2406
	TBrushStyle::EPatternedBrush.
sl@0
  2407
	
sl@0
  2408
	Notes
sl@0
  2409
	
sl@0
  2410
	The brush is used for filling shapes and the background of text boxes. The 
sl@0
  2411
	brush has colour, style, pattern and pattern origin parameters.
sl@0
  2412
	
sl@0
  2413
	If SetBrushOrigin() is not used, then the origin defaults to (0,0).
sl@0
  2414
	
sl@0
  2415
	This brush origin remains in effect for all fillable shapes drawn 
sl@0
  2416
	subsequently, until a new brush origin is set. Shapes can thus be 
sl@0
  2417
	considered as windows onto a continuous pattern field (covering the whole 
sl@0
  2418
	clipping region of a screen device, or the whole device area of a printer).
sl@0
  2419
	
sl@0
  2420
	@param aOrigin An origin point for the brush. The coordinates are relative 
sl@0
  2421
	to the rectangle to fill, i.e. specify 0,0 to align the pattern flush with 
sl@0
  2422
	the top and left hand sides of the rectangle.
sl@0
  2423
	@see SetBrushStyle()
sl@0
  2424
	@see UseBrushPattern() */
sl@0
  2425
	virtual void SetBrushOrigin(const TPoint& aOrigin)=0;
sl@0
  2426
sl@0
  2427
	/** Sets the brush pattern to the specified bitmap.
sl@0
  2428
	
sl@0
  2429
	For the brush to actually use the bitmap, TBrushStyle::EPatternedBrush must 
sl@0
  2430
	be used to set the brush style.
sl@0
  2431
	
sl@0
  2432
	When the brush pattern is no longer required, use DiscardBrushPattern() to 
sl@0
  2433
	free up the memory used, if the bitmap is not being shared. 
sl@0
  2434
	If UseBrushPattern() is used again without using DiscardBrushPattern() 
sl@0
  2435
	then the previous pattern is discarded automatically.
sl@0
  2436
	
sl@0
  2437
	Notes:
sl@0
  2438
	
sl@0
  2439
	The brush is used for filling shapes and the background of text boxes. The 
sl@0
  2440
	brush has colour, style, pattern and pattern origin parameters.
sl@0
  2441
	
sl@0
  2442
	When loading a bitmap, the bitmap is checked to see if it is already in 
sl@0
  2443
	memory. If the bitmap is already there, then that copy is shared.
sl@0
  2444
	
sl@0
  2445
	The brush does not need to have a pattern set at all. There are several 
sl@0
  2446
	built-in hatching patterns which can be selected using SetBrushStyle().
sl@0
  2447
	
sl@0
  2448
	@param aBitmap A bitmap pattern for the brush. 
sl@0
  2449
	@see SetBrushStyle() */
sl@0
  2450
	virtual void UseBrushPattern(const CFbsBitmap* aBitmap)=0;
sl@0
  2451
sl@0
  2452
	/** Discards a non-built-in brush pattern.
sl@0
  2453
	
sl@0
  2454
	This frees up the memory used by the bitmap, if it is not being shared by 
sl@0
  2455
	another process.
sl@0
  2456
	
sl@0
  2457
	Notes:
sl@0
  2458
	
sl@0
  2459
	The brush is used for filling shapes and the background of text boxes. The 
sl@0
  2460
	brush has colour, style, pattern and pattern origin parameters.
sl@0
  2461
	
sl@0
  2462
	If DiscardBrushPattern() is used, with no brush pattern set, then there is 
sl@0
  2463
	no effect. */
sl@0
  2464
	virtual void DiscardBrushPattern()=0;
sl@0
  2465
sl@0
  2466
sl@0
  2467
	/** Sets the drawing point relative to the co-ordinate origin. 
sl@0
  2468
	
sl@0
  2469
	A subsequent call to DrawLineTo() or DrawLineBy() uses the new drawing 
sl@0
  2470
	point as the start point for the line drawn.
sl@0
  2471
	
sl@0
  2472
	Notes
sl@0
  2473
	
sl@0
  2474
	The operations DrawLine(), DrawLineTo(), DrawLineBy() and DrawPolyline() 
sl@0
  2475
	also change the internal drawing position to the last point of the drawn 
sl@0
  2476
	line(s). 
sl@0
  2477
	
sl@0
  2478
	The internal drawing position is set to the co-ordinate origin if no drawing 
sl@0
  2479
	or moving operations have yet taken place.
sl@0
  2480
	
sl@0
  2481
	@param aPoint The new internal drawing position. */
sl@0
  2482
	virtual void MoveTo(const TPoint& aPoint)=0;
sl@0
  2483
sl@0
  2484
	/** Sets the drawing point relative to the current co-ordinates.
sl@0
  2485
	
sl@0
  2486
	A subsequent call to DrawLineTo() or DrawLineBy() uses the new drawing point 
sl@0
  2487
	as the start point for the line drawn.
sl@0
  2488
	
sl@0
  2489
	Notes
sl@0
  2490
	
sl@0
  2491
	The operations DrawLine(), DrawLineTo(), DrawLineBy() and DrawPolyline() 
sl@0
  2492
	also change the internal drawing position to the last point of the drawn 
sl@0
  2493
	line(s). 
sl@0
  2494
	
sl@0
  2495
	The internal drawing position is set to the co-ordinate origin if no drawing 
sl@0
  2496
	or moving operations have yet taken place.
sl@0
  2497
	
sl@0
  2498
	@param aVector The amount by which the internal drawing position is to move. */
sl@0
  2499
	virtual void MoveBy(const TPoint& aVector)=0;
sl@0
  2500
sl@0
  2501
	/** Draws a single point. The point is drawn with the current pen settings 
sl@0
  2502
	using the current drawing mode.
sl@0
  2503
	
sl@0
  2504
	Note:
sl@0
  2505
	
sl@0
  2506
	If the pen size is greater than one pixel, a filled circle of the current 
sl@0
  2507
	pen colour is drawn, with the pen size as the diameter and the plotted point 
sl@0
  2508
	as the centre. If the pen size is an even number of pixels, the extra pixels 
sl@0
  2509
	are drawn below and to the right of the centre.
sl@0
  2510
	
sl@0
  2511
	@param aPoint The point to be drawn.
sl@0
  2512
	@see SetPenSize() */
sl@0
  2513
	virtual void Plot(const TPoint& aPoint)=0;
sl@0
  2514
sl@0
  2515
	/** Draws an arc.
sl@0
  2516
	
sl@0
  2517
	The arc is considered a portion of an ellipse. The ellipse is defined by the 
sl@0
  2518
	TRect argument.
sl@0
  2519
	
sl@0
  2520
	The pixels at both the start point and the end point are drawn.
sl@0
  2521
	
sl@0
  2522
	The arc itself is the segment of the ellipse drawn in an anti-clockwise 
sl@0
  2523
	direction from the start point to the end point.
sl@0
  2524
	
sl@0
  2525
	Notes:
sl@0
  2526
	
sl@0
  2527
	A rectangle is used in the construction of the ellipse of which the arc is 
sl@0
  2528
	a segment. This rectangle is passed as an argument of type TRect.
sl@0
  2529
	
sl@0
  2530
	A wide line arc is drawn with the pixels distributed either side of a true 
sl@0
  2531
	ellipse, in such a way that the outer edge of the line would touch the edge 
sl@0
  2532
	of the construction rectangle. In other words, the ellipse used to 
sl@0
  2533
	construct it is slightly smaller than that for a single pixel line size.
sl@0
  2534
	
sl@0
  2535
	If the specified start or end point is at the centre of the ellipse, then 
sl@0
  2536
	the line that defines the start or end of the arc defaults to one extending 
sl@0
  2537
	vertically above the centre point.
sl@0
  2538
	
sl@0
  2539
	If the start and end point are the same point or are points on the same line 
sl@0
  2540
	through the ellipse centre then a complete unfilled ellipse is drawn.
sl@0
  2541
	
sl@0
  2542
	@param aRect A rectangle in which to draw the ellipse, of which the arc is 
sl@0
  2543
	a segment. 
sl@0
  2544
	@param aStart The point defining the start of the arc. It defines one end of 
sl@0
  2545
	a line from the geometric centre of the ellipse. The point of intersection 
sl@0
  2546
	between this line and the ellipse defines the start point of the arc.
sl@0
  2547
	@param aEnd The point defining the end of the arc. It defines one end of a 
sl@0
  2548
	second line from the geometric centre of the ellipse. The point of 
sl@0
  2549
	intersection between this line and the ellipse defines the end point of the 
sl@0
  2550
	arc.
sl@0
  2551
	@see DrawEllipse() */
sl@0
  2552
	virtual void DrawArc(const TRect& aRect,const TPoint& aStart,const TPoint& aEnd)=0;
sl@0
  2553
sl@0
  2554
	/** Draws a straight line between two points.
sl@0
  2555
	
sl@0
  2556
	@param aPoint1 The point at the start of the line. 
sl@0
  2557
	@param aPoint2 The point at the end of the line. */
sl@0
  2558
	virtual void DrawLine(const TPoint& aPoint1,const TPoint& aPoint2)=0;
sl@0
  2559
sl@0
  2560
	/** Draws a straight line from the current drawing point to a specified 
sl@0
  2561
	point.
sl@0
  2562
	
sl@0
  2563
	@param aPoint The point at the end of the line. 
sl@0
  2564
	@see MoveTo()
sl@0
  2565
	@see MoveBy() */
sl@0
  2566
	virtual void DrawLineTo(const TPoint& aPoint)=0;
sl@0
  2567
sl@0
  2568
	/** Draws a straight line relative to the current drawing point, using a 
sl@0
  2569
	vector.
sl@0
  2570
	
sl@0
  2571
	The start point of the line is the current drawing point. The specified 
sl@0
  2572
	vector 
sl@0
  2573
	is added to the drawing point to give the end point of the line
sl@0
  2574
	
sl@0
  2575
	@param aVector The vector to add to the current internal drawing position, 
sl@0
  2576
	giving the end point of the line. 
sl@0
  2577
	@see MoveTo()
sl@0
  2578
	@see MoveBy() */
sl@0
  2579
	virtual void DrawLineBy(const TPoint& aVector)=0;
sl@0
  2580
sl@0
  2581
	/** Draws a polyline from a set of points in an array.
sl@0
  2582
	
sl@0
  2583
	A polyline is a series of concatenated straight lines joining a set of 
sl@0
  2584
	points.
sl@0
  2585
	
sl@0
  2586
	@param aPointList An array containing the points on the polyline. */
sl@0
  2587
	virtual void DrawPolyLine(const CArrayFix<TPoint>* aPointList)=0;
sl@0
  2588
sl@0
  2589
	/** Draws a polyline from a set of points in a list.
sl@0
  2590
	
sl@0
  2591
	A polyline is a series of concatenated straight lines joining a set of 
sl@0
  2592
	points.
sl@0
  2593
	
sl@0
  2594
	@param aPointList Pointer to a set of points on the polyline.
sl@0
  2595
	@param aNumPoints Number of points in the list. */
sl@0
  2596
	virtual void DrawPolyLine(const TPoint* aPointList,TInt aNumPoints)=0;
sl@0
  2597
sl@0
  2598
	/** Draws and fills a pie slice.
sl@0
  2599
	
sl@0
  2600
	The pie slice is an area bounded by:
sl@0
  2601
	
sl@0
  2602
	the arc of an ellipse drawn in an anticlockwise direction from the start 
sl@0
  2603
	point to the end point
sl@0
  2604
	
sl@0
  2605
	the straight line drawn to the start point from the geometric centre of the 
sl@0
  2606
	ellipse.
sl@0
  2607
	
sl@0
  2608
	the straight line to the end point from the geometric centre of the ellipse.
sl@0
  2609
	
sl@0
  2610
	Notes:
sl@0
  2611
	
sl@0
  2612
	A rectangle is used in the construction of the pie slice. This rectangle is 
sl@0
  2613
	passed as an argument of type TRect. The curved edge of the pie slice is an 
sl@0
  2614
	arc of an ellipse constructed within the rectangle.
sl@0
  2615
	
sl@0
  2616
	The line drawn by the pen goes inside the specified rectangle.
sl@0
  2617
	
sl@0
  2618
	The pixels at the end point of the arc are not drawn.
sl@0
  2619
	
sl@0
  2620
	A wide line edged pie slice has the arc drawn with the pixels distributed 
sl@0
  2621
	either side of a true ellipse. This is done in such a way that the outer 
sl@0
  2622
	edge of the line touches the edge of the construction rectangle. In other 
sl@0
  2623
	words, the ellipse used to construct it is slightly smaller than that for 
sl@0
  2624
	a single pixel line size.
sl@0
  2625
	
sl@0
  2626
	If the specified start or end point is at the centre of the ellipse, then 
sl@0
  2627
	the line that defines the start or end of the arc defaults to one extending 
sl@0
  2628
	vertically above the centre point.
sl@0
  2629
	
sl@0
  2630
	If the start and end point are the same point or are points on the same line 
sl@0
  2631
	through the ellipse centre then a complete filled ellipse is drawn. A line 
sl@0
  2632
	is also drawn from the edge to the ellipse centre.
sl@0
  2633
	
sl@0
  2634
	@param aRect A rectangle in which to draw the ellipse bounding the pie slice. 
sl@0
  2635
	@param aStart A point defining the start of the arc bounding the pie slice. 
sl@0
  2636
	It defines one end of a line from the geometrical centre of the ellipse. The 
sl@0
  2637
	point of intersection between this line and the ellipse defines the start 
sl@0
  2638
	point of the arc.
sl@0
  2639
	@param aEnd A point to define the end of the arc bounding the pie slice. It 
sl@0
  2640
	defines one end of a second line from the geometrical centre of the ellipse. 
sl@0
  2641
	The point of intersection between this line and the ellipse defines the end 
sl@0
  2642
	point of the arc. */
sl@0
  2643
	virtual void DrawPie(const TRect& aRect,const TPoint& aStart,const TPoint& aEnd)=0;
sl@0
  2644
sl@0
  2645
	/** Draws and fills an ellipse.
sl@0
  2646
	
sl@0
  2647
	The ellipse is drawn inside the rectangle defined by the TRect argument. Any 
sl@0
  2648
	rectangle that has odd pixel dimensions, has the bottom right corner trimmed 
sl@0
  2649
	to give even pixel dimensions before the ellipse is constructed.
sl@0
  2650
	
sl@0
  2651
	Note:
sl@0
  2652
	
sl@0
  2653
	A wide outline ellipse is drawn with the pixels distributed either side of 
sl@0
  2654
	a true ellipse, in such a way that the outer edge of the line touches the 
sl@0
  2655
	edge of the construction rectangle. In other words, the ellipse used to 
sl@0
  2656
	construct it is smaller than that for a single pixel line size.
sl@0
  2657
	
sl@0
  2658
	@param aRect The rectangle in which the ellipse is drawn. */
sl@0
  2659
	virtual void DrawEllipse(const TRect& aRect)=0;
sl@0
  2660
sl@0
  2661
	/** Draws and fills a rectangle.
sl@0
  2662
	
sl@0
  2663
	@param aRect The rectangle to be drawn. */
sl@0
  2664
	virtual void DrawRect(const TRect& aRect)=0;
sl@0
  2665
sl@0
  2666
	/** Draws and fills a rectangle with rounded corners.
sl@0
  2667
	
sl@0
  2668
	The rounded corners are each constructed as an arc of an ellipse.
sl@0
  2669
	
sl@0
  2670
	The line drawn by the pen, if any, goes inside the specified rectangle.
sl@0
  2671
	
sl@0
  2672
	Notes:
sl@0
  2673
	
sl@0
  2674
	Dotted and dashed pen styles cannot be used for the outline of a rounded 
sl@0
  2675
	rectangle.
sl@0
  2676
	
sl@0
  2677
	If either corner size dimension is greater than half the corresponding 
sl@0
  2678
	rectangle length, the corner size dimension is reduced to half the 
sl@0
  2679
	rectangle size.
sl@0
  2680
	
sl@0
  2681
	@param aRect The rectangle to be drawn. 
sl@0
  2682
	@param aCornerSize The dimensions of each corner. 
sl@0
  2683
	@see DrawArc() */
sl@0
  2684
	virtual void DrawRoundRect(const TRect& aRect,const TSize& aCornerSize)=0;
sl@0
  2685
sl@0
  2686
	/** Draws and fills a polygon defined using an array of points.
sl@0
  2687
	
sl@0
  2688
	The first point in the array defines the start of the first side of the 
sl@0
  2689
	polygon. The second point defines the second vertex (the end point of the 
sl@0
  2690
	first side and the start point of the second side).
sl@0
  2691
	
sl@0
  2692
	The final side of the polygon is drawn using the last point from the array, 
sl@0
  2693
	and the line is drawn to the start point of the first side.
sl@0
  2694
	
sl@0
  2695
	Self-crossing polygons are filled according to the specified fill rule.
sl@0
  2696
	
sl@0
  2697
	@param aPointList An array of points, specifying the vertices of the polygon.
sl@0
  2698
	@param aFillRule The fill rule. By default, this is TFillRule::EAlternate. 
sl@0
  2699
	@return KErrNone, if successful; otherwise, another of the system-wide error 
sl@0
  2700
	codes. */
sl@0
  2701
	virtual TInt DrawPolygon(const CArrayFix<TPoint>* aPointList,TFillRule aFillRule=EAlternate)=0;
sl@0
  2702
sl@0
  2703
	/** Draws and fills a polygon defined using a list of points.
sl@0
  2704
	
sl@0
  2705
	The first point in the list defines the start of the first side of the 
sl@0
  2706
	polygon. The second point defines the second vertex (the end point of the 
sl@0
  2707
	first side and the start point of the second side).
sl@0
  2708
	
sl@0
  2709
	The final side of the polygon is drawn using the last point from the list, 
sl@0
  2710
	and the line is drawn to the start point of the first side.
sl@0
  2711
	
sl@0
  2712
	Self-crossing polygons are filled according to the specified fill rule.
sl@0
  2713
	
sl@0
  2714
	@param aPointList Pointer to list of points, specifying the vertices of the 
sl@0
  2715
	polygon.
sl@0
  2716
	@param aNumPoints The number of points in the list.
sl@0
  2717
	@param aFillRule The fill rule. By default this is TFillRule::EAlternate. 
sl@0
  2718
	@return KErrNone, if successful; otherwise, another of the system-wide error 
sl@0
  2719
	codes. */
sl@0
  2720
	virtual TInt DrawPolygon(const TPoint* aPointList,TInt aNumPoints,TFillRule aFillRule=EAlternate)=0;
sl@0
  2721
sl@0
  2722
	/** Draws a bitmap at the specified point.
sl@0
  2723
	
sl@0
  2724
	The point specifies the top left hand corner of the bitmap. The bitmap is 
sl@0
  2725
	compressed or stretched based on its internally stored size in twips.
sl@0
  2726
	
sl@0
  2727
	Notes:
sl@0
  2728
	
sl@0
  2729
	This member function uses the bitmap's size in twips and does a 
sl@0
  2730
	stretch/compress blit using a linear DDA.
sl@0
  2731
	
sl@0
  2732
	As this function scales the bitmap, it is unavoidably slow. Therefore, where 
sl@0
  2733
	possible, use CBitmapContext::BitBlt() instead. If the bitmap has to be 
sl@0
  2734
	scaled, consider creating another bitmap along with an CFbsBitmapDevice etc, 
sl@0
  2735
	doing DrawBitmap() once and using BitBlt() subsequently.
sl@0
  2736
	
sl@0
  2737
	Note that all bitmaps are clipped to the device boundaries.
sl@0
  2738
	
sl@0
  2739
	@param aTopLeft The point where the top left pixel of the bitmap is to be 
sl@0
  2740
	drawn 
sl@0
  2741
	@param aSource A source bitmap 
sl@0
  2742
	@see TLinearDDA */
sl@0
  2743
	virtual void DrawBitmap(const TPoint& aTopLeft,const CFbsBitmap* aSource)=0;
sl@0
  2744
sl@0
  2745
	/** Draws a bitmap to fit a given rectangle. 
sl@0
  2746
	
sl@0
  2747
	The bitmap is compressed or stretched based on its internally stored size 
sl@0
  2748
	in pixels.
sl@0
  2749
	
sl@0
  2750
	Notes:
sl@0
  2751
	
sl@0
  2752
	This member function uses the bitmap's size in pixels and does a 
sl@0
  2753
	stretch/compress blit using a linear DDA.
sl@0
  2754
	
sl@0
  2755
	As this function scales the bitmap, it is unavoidably slow. Therefore, 
sl@0
  2756
	where possible, use CBitmapContext::BitBlt() instead. If the bitmap has 
sl@0
  2757
	to be scaled, consider creating another bitmap along with an 
sl@0
  2758
	CFbsBitmapDevice etc., doing DrawBitmap() once and using BitBlt() 
sl@0
  2759
	subsequently.
sl@0
  2760
	
sl@0
  2761
	Note that all bitmaps are clipped to the device boundaries.
sl@0
  2762
	
sl@0
  2763
	@param aDestRect The rectangle within which the bitmap is to be drawn. 
sl@0
  2764
	@param aSource A source bitmap. 
sl@0
  2765
	@see TLinearDDA */
sl@0
  2766
	virtual void DrawBitmap(const TRect& aDestRect,const CFbsBitmap* aSource)=0;
sl@0
  2767
sl@0
  2768
	/** Draws a specified rectangle of a source bitmap to fit into a given 
sl@0
  2769
	destination rectangle.
sl@0
  2770
	
sl@0
  2771
	Notes:
sl@0
  2772
	
sl@0
  2773
	This member function uses rectangle sizes in pixels and does a 
sl@0
  2774
	stretch/compress blit using a linear DDA.
sl@0
  2775
	
sl@0
  2776
	As this function scales the bitmap, it is unavoidably slow. Therefore, 
sl@0
  2777
	where possible, use CBitmapContext::BitBlt() instead. If the bitmap has 
sl@0
  2778
	to be scaled, consider creating another bitmap along with an 
sl@0
  2779
	CFbsBitmapDevice etc., doing DrawBitmap() once and using BitBlt() 
sl@0
  2780
	subsequently.
sl@0
  2781
	
sl@0
  2782
	Note that all bitmaps are clipped to the device boundaries.
sl@0
  2783
	
sl@0
  2784
	@param aDestRect The rectangle within which the bitmap is to be drawn. 
sl@0
  2785
	@param aSource A source bitmap. 
sl@0
  2786
	@param aSourceRect The rectangle in the source bitmap that is copied to the 
sl@0
  2787
	destination rectangle. 
sl@0
  2788
	@see TLinearDDA */
sl@0
  2789
	virtual void DrawBitmap(const TRect& aDestRect,const CFbsBitmap* aSource,const TRect& aSourceRect)=0;
sl@0
  2790
sl@0
  2791
	/** Draws a specified rectangle of a source bitmap to fit into a given rectangle using a given mask.
sl@0
  2792
sl@0
  2793
	Notes:
sl@0
  2794
	
sl@0
  2795
	  This member function uses rectangle sizes in pixels and does a 
sl@0
  2796
	stretch/compress blit using a linear DDA.
sl@0
  2797
	
sl@0
  2798
	
sl@0
  2799
	@param aDestRect The rectangle within which the bitmap is to be drawn. 
sl@0
  2800
	@param aBitmap The source bitmap
sl@0
  2801
	@param aSourceRect The rectangle in the source bitmap that is to be drawn
sl@0
  2802
	@param aMaskBitmap The mask to be applied to the source bitmap while drawing
sl@0
  2803
	@param aInvertMask Flag to indicate if the mask should be inverted.
sl@0
  2804
	*/
sl@0
  2805
	virtual void DrawBitmapMasked(const TRect& aDestRect,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask)=0;
sl@0
  2806
sl@0
  2807
	/** Draws a specified rectangle from a wserv bitmap and its mask into 
sl@0
  2808
	another rectangle.
sl@0
  2809
sl@0
  2810
	The function compresses/stretches the specified rectangle from the bitmap 
sl@0
  2811
	to fit the destination rectangle. 
sl@0
  2812
	The mask bitmap can be used as either a positive or negative mask. Masked 
sl@0
  2813
	pixels are not mapped to the destination rectangle.
sl@0
  2814
sl@0
  2815
	A black and white (binary) mask bitmap is used. With aInvertMask=EFalse, black 
sl@0
  2816
	pixels in the mask bitmap stop corresponding pixels in the source bitmap from 
sl@0
  2817
	being transferred to the destination rectangle. With aInvertMask=ETrue, white 
sl@0
  2818
	pixels in the mask bitmap stop corresponding pixels in the source bitmap from 
sl@0
  2819
	being transferred to the destination rectangle.
sl@0
  2820
sl@0
  2821
	Note: this member function uses rectangle sizes in pixels and does a stretch/compress 
sl@0
  2822
	blit using a linear DDA.
sl@0
  2823
sl@0
  2824
	@param aDestRect The rectangle within which the masked bitmap is to be drawn. 
sl@0
  2825
	@param aBitmap A source wserv bitmap. 
sl@0
  2826
	@param aSourceRect The rectangle in the source bitmap that is copied to the 
sl@0
  2827
	destination rectangle.
sl@0
  2828
	@param aMaskBitmap A mask wserv bitmap. 
sl@0
  2829
	@param aInvertMask If false, a source pixel that is masked by a black pixel 
sl@0
  2830
	is not transferred to the destination rectangle. If true, then a source pixel 
sl@0
  2831
	that is masked by a white pixel is not transferred to the destination rectangle. */
sl@0
  2832
	virtual void DrawBitmapMasked(const TRect& aDestRect,const CWsBitmap* aBitmap,const TRect& aSourceRect,const CWsBitmap* aMaskBitmap,TBool aInvertMask)=0;
sl@0
  2833
sl@0
  2834
	/** Draws text without a surrounding box. 
sl@0
  2835
	
sl@0
  2836
	The text baseline is aligned with the y co-ordinate of the specified point, 
sl@0
  2837
	and the left end of the text is aligned with the x co-ordinate of the 
sl@0
  2838
	specified point.
sl@0
  2839
	
sl@0
  2840
	Note:
sl@0
  2841
	
sl@0
  2842
	Text drawing is done with the pen, and is subject to the pen colour. The 
sl@0
  2843
	effective text colour also depends on the drawing mode. The size and style 
sl@0
  2844
	of the text depends on the font used. The layout of the text depends on the 
sl@0
  2845
	justification mode set.
sl@0
  2846
	
sl@0
  2847
	@param aText The text string to be drawn. 
sl@0
  2848
	@param aPosition A point specifying the position of the left end of the text. */
sl@0
  2849
	virtual void DrawText(const TDesC& aText,const TPoint& aPosition) = 0;
sl@0
  2850
sl@0
  2851
	/** Draws text inside a box.
sl@0
  2852
	
sl@0
  2853
	The surrounding box is filled with the current brush colour (not a pattern) 
sl@0
  2854
	and is drawn without any outline. The effective box colour depends on the 
sl@0
  2855
	drawing mode - if a brush colour has not been set then the brush defaults 
sl@0
  2856
	to white. The brush may be set to TBrushStyle::ENullBrush if text 
sl@0
  2857
	positioning relative to a box is required, but the box should not be filled.
sl@0
  2858
	
sl@0
  2859
	The font used is that set by UseFont(). If no font is in use then a panic 
sl@0
  2860
	occurs.
sl@0
  2861
	
sl@0
  2862
	The alignment of the text within the box can be specified.
sl@0
  2863
	
sl@0
  2864
	Text drawn within a box is also clipped to that box. Unless you intend to 
sl@0
  2865
	clip the top off the text, aBaselineOffset should be greater than or equal 
sl@0
  2866
	to the ascent of the current font.
sl@0
  2867
	
sl@0
  2868
	Offsets:
sl@0
  2869
	
sl@0
  2870
	If the offset is negative, zero, or less than font height this is handled 
sl@0
  2871
	as would be expected, i.e. no text will be seen in the box in the first two 
sl@0
  2872
	instances, and the top of the text will be clipped in the latter case.
sl@0
  2873
	
sl@0
  2874
	Margins:
sl@0
  2875
	
sl@0
  2876
	For the drawing of right-aligned text, aLeftMargin indicates the margin from 
sl@0
  2877
	the right of aBox - where a positive value results in a leftwards offset. 
sl@0
  2878
	
sl@0
  2879
	Negative margins can be used to display portions of the text string clipped 
sl@0
  2880
	by the box. A negative margin for left aligned text would clip the start of 
sl@0
  2881
	the text string. Similarly, a negative margin for right aligned text would 
sl@0
  2882
	clip the end of the text string.
sl@0
  2883
	
sl@0
  2884
	If the margin is greater than the width of the box then no text will be 
sl@0
  2885
	visible.
sl@0
  2886
	
sl@0
  2887
	The margin is still honoured for centred text - centred text will not be 
sl@0
  2888
	centred in the box, unless the margin is zero.
sl@0
  2889
	
sl@0
  2890
	Note:
sl@0
  2891
	
sl@0
  2892
	Text drawing is done with the pen, and is thus subject to the pen colour. 
sl@0
  2893
	The effective text colour also depends on the drawing mode. The size and 
sl@0
  2894
	style of the text depends on the used font. The layout of the text depends 
sl@0
  2895
	on the justification mode set.
sl@0
  2896
	
sl@0
  2897
	@param aText The text string to be drawn. 
sl@0
  2898
	@param aBox The box to draw the text in. 
sl@0
  2899
	@param aBaselineOffset An offset from the top of the box to the text 
sl@0
  2900
	baseline. 
sl@0
  2901
	@param aAlignment The text alignment mode default is left aligned. 
sl@0
  2902
	@param aLeftMargin The left margin for left-aligned text, or the right 
sl@0
  2903
	margin 
sl@0
  2904
	for right-aligned text default is zero. */
sl@0
  2905
	virtual void DrawText(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TTextAlign aAlignment = ELeft,
sl@0
  2906
		TInt aLeftMargin = 0) = 0;
sl@0
  2907
	IMPORT_C virtual void DrawText(const TDesC& aText,const TPoint& aPosition,const TDrawTextParam& aParam);
sl@0
  2908
	IMPORT_C virtual void Reserved();
sl@0
  2909
	IMPORT_C TInt DrawTextExtended(const TDesC& aText,const TPoint& aPosition,const TDrawTextExtendedParam& aParam);
sl@0
  2910
							
sl@0
  2911
	/** Maps pixels in the specified rectangle.
sl@0
  2912
	The function tries to match the colour of a pixel with one of the RGB values 
sl@0
  2913
	in an array of RGB pairs. If there is a match, the colour is changed to the 
sl@0
  2914
	value specified in the other RGB in the RGB pair.
sl@0
  2915
	@param aRect The rectangle in which pixels are to be mapped.
sl@0
  2916
	@param aColors A pointer to a set of RGB pairs. 
sl@0
  2917
	@param aNumPairs The number of pairs 
sl@0
  2918
	@param aMapForwards ETrue, mapping is done from the first RGB to the second 
sl@0
  2919
	RGB in the pair; EFalse, mapping is done from the second RGB to the first 
sl@0
  2920
	RGB in the pair. */	
sl@0
  2921
	virtual void MapColors(const TRect &aRect,const TRgb *aColors,TInt aNumPairs,TBool aMapForwards) = 0;
sl@0
  2922
	
sl@0
  2923
	/** Sets the clipping region, any items that fall outside the extent of the clipping 
sl@0
  2924
	region will not be drawn.
sl@0
  2925
	
sl@0
  2926
	Note that clipping is additive. If a clipping rectangle has been set using SetClippingRect() 
sl@0
  2927
	then clipping will be to the intersection of that rectangle and this region.
sl@0
  2928
	
sl@0
  2929
	@param aRegion The new clipping region. Note that clipping region co-ordinates are
sl@0
  2930
	used as absolute co-ordinates, they are not transformed by the current co-ordinate 
sl@0
  2931
	origin before use (as occurs in SetClippingRect()).
sl@0
  2932
	 
sl@0
  2933
	@return KErrNone if successful; KErrArgument if the TRegion is not valid; KErrNoMemory if there is insufficient memory.
sl@0
  2934
	
sl@0
  2935
	@see CGraphicsContext::CancelClippingRegion() 
sl@0
  2936
	@see CGraphicsContext::SetClippingRect() */		
sl@0
  2937
	virtual TInt SetClippingRegion(const TRegion &aRegion) = 0;
sl@0
  2938
	
sl@0
  2939
	/** Cancels the current clipping region. 
sl@0
  2940
	@see CGraphicsContext::SetClippingRegion()*/
sl@0
  2941
	virtual void CancelClippingRegion() = 0;
sl@0
  2942
	
sl@0
  2943
	/** Draws vertical text in the specified direction.
sl@0
  2944
	@param aText The text to be drawn. 
sl@0
  2945
	@param aPos Point of origin of the text baseline. 
sl@0
  2946
	@param aUp Direction. ETrue for up, EFalse for down. */
sl@0
  2947
	virtual void DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp) = 0;
sl@0
  2948
	
sl@0
  2949
	/** Draws text vertically in the specified direction, within a box of the specified size.
sl@0
  2950
	@param aText The text to be drawn. 
sl@0
  2951
	@param aBox The bounding box within which the text should be drawn, and which it is clipped to.
sl@0
  2952
	@param aBaselineOffset The height of the top of the characters from their text baseline. 
sl@0
  2953
	@param aUp The direction. ETrue for up, EFalse for down.
sl@0
  2954
	@param aVert The text alignment. 
sl@0
  2955
	@param aMargin The margin. */	
sl@0
  2956
	virtual void DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0) = 0;
sl@0
  2957
	
sl@0
  2958
	IMPORT_C TInt GetUnderlineMetrics(TInt& aTop,TInt& aBottom);
sl@0
  2959
sl@0
  2960
	/** Set the font's shadow colour
sl@0
  2961
	@param aShadowColor Shadow colour to be set.
sl@0
  2962
	@return KErrNone, if successful; otherwise, another of the system-wide errors. */
sl@0
  2963
	IMPORT_C TInt SetShadowColor(const TRgb& aShadowColor);
sl@0
  2964
sl@0
  2965
	/** Get the font's shadow colour
sl@0
  2966
	@param aShadowColor Shadow colour of the font returned by the funtion.
sl@0
  2967
	@return KErrNone, if successful; otherwise, another of the system-wide errors. */
sl@0
  2968
	IMPORT_C TInt GetShadowColor(TRgb& aShadowColor);
sl@0
  2969
sl@0
  2970
	/** Determine if the Gc is a CFbsBitGc
sl@0
  2971
	@return ETrue, if the Gc is a CFbsBitGc, EFalse otherwise 
sl@0
  2972
	@publishedAll
sl@0
  2973
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases.
sl@0
  2974
	*/
sl@0
  2975
	IMPORT_C TBool IsFbsBitGc() const;
sl@0
  2976
sl@0
  2977
	IMPORT_C void DrawText(const TDesC& aText,const TTextParameters* iParam,const TPoint& aPosition);
sl@0
  2978
	IMPORT_C void DrawText(const TDesC& aText,const TTextParameters* iParam,const TRect& aBox,TInt aBaselineOffset,TTextAlign aHrz=ELeft,TInt aMargin=0);
sl@0
  2979
	IMPORT_C void DrawText(const TDesC& aText,const TTextParameters* iParam,const TPoint& aPosition,const TDrawTextParam& aParam);
sl@0
  2980
sl@0
  2981
	IMPORT_C void DrawTextVertical(const TDesC& aText,const TTextParameters* iParam,const TPoint& aPos,TBool aUp);
sl@0
  2982
	IMPORT_C void DrawTextVertical(const TDesC& aText,const TTextParameters* iParam,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
sl@0
  2983
	
sl@0
  2984
	IMPORT_C TInt DrawTextExtended(const TDesC& aText,const TTextParameters* iParam,const TPoint& aPosition,const TDrawTextExtendedParam& aParam);
sl@0
  2985
	
sl@0
  2986
protected:
sl@0
  2987
sl@0
  2988
	/**
sl@0
  2989
	An APIExtension method to allow the addition of new APIs to retain compatibility 
sl@0
  2990
	with previous versions of gdi.dll
sl@0
  2991
	@param aOutput is for output
sl@0
  2992
	@param aInput is for input
sl@0
  2993
	@see CGraphicsContext
sl@0
  2994
	@publishedAll
sl@0
  2995
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases.
sl@0
  2996
	*/
sl@0
  2997
	IMPORT_C virtual TInt APIExtension(TUid aUid, TAny*& aOutput, TAny* aInput);	
sl@0
  2998
	
sl@0
  2999
	/**
sl@0
  3000
	A reserved virtual function for future use.
sl@0
  3001
	*/
sl@0
  3002
	IMPORT_C virtual void Reserved_CGraphicsContext_2();		
sl@0
  3003
	};
sl@0
  3004
sl@0
  3005
sl@0
  3006
/** An abstract, device-independent, interface to bitmapped graphics contexts.
sl@0
  3007
sl@0
  3008
This holds the setting used to draw to a CBitmapDevice.
sl@0
  3009
sl@0
  3010
The default settings of a CBitmapContext object immediately after construction 
sl@0
  3011
are:
sl@0
  3012
sl@0
  3013
drawing mode is EDrawModePen (pen and brush colours used as they are)
sl@0
  3014
sl@0
  3015
no clipping rectangle
sl@0
  3016
sl@0
  3017
pen settings are: black, solid, single pixel width
sl@0
  3018
sl@0
  3019
brush style is null
sl@0
  3020
sl@0
  3021
no text font selected
sl@0
  3022
sl@0
  3023
The classes CFbsBitGc and CWindowGc are derived from this class.
sl@0
  3024
sl@0
  3025
@see CFbsBitGc 
sl@0
  3026
@publishedAll
sl@0
  3027
@released
sl@0
  3028
*/
sl@0
  3029
class CBitmapContext : public CGraphicsContext
sl@0
  3030
	{
sl@0
  3031
public:
sl@0
  3032
	/** Clears the whole bitmap.
sl@0
  3033
	
sl@0
  3034
	The cleared area is filled with the current brush colour.
sl@0
  3035
	
sl@0
  3036
	This pure virtual function is implemented in derived classes. */
sl@0
  3037
	virtual void Clear()=0;
sl@0
  3038
sl@0
  3039
	/** Clears a rectangular area of a bitmap.
sl@0
  3040
	
sl@0
  3041
	The cleared area is filled with the current brush colour.
sl@0
  3042
	
sl@0
  3043
	This pure virtual function is implemented in derived classes.
sl@0
  3044
	
sl@0
  3045
	@param aRect The rectangle to clear. */
sl@0
  3046
	virtual void Clear(const TRect& aRect)=0;
sl@0
  3047
sl@0
  3048
	/** Copies a rectangle.
sl@0
  3049
	
sl@0
  3050
	This pure virtual function is implemented in derived classes.
sl@0
  3051
	
sl@0
  3052
	@param aOffset The offset from the top left corner of the rectangle to be 
sl@0
  3053
	copied to the top left corner of the copy.
sl@0
  3054
	@param aRect The rectangular area to be copied. */
sl@0
  3055
	virtual void CopyRect(const TPoint& aOffset,const TRect& aRect)=0;
sl@0
  3056
sl@0
  3057
	/** Performs a bitmap block transfer.
sl@0
  3058
	
sl@0
  3059
	This pure virtual function is implemented in derived classes.
sl@0
  3060
	
sl@0
  3061
	@param aPoint The destination for the top left corner of the transferred bitmap. 
sl@0
  3062
	It is relative to the top left corner of the destination bitmap, which may be the screen.
sl@0
  3063
	@param aBitmap A memory-resident bitmap. */
sl@0
  3064
	virtual void BitBlt(const TPoint& aPoint,const CFbsBitmap* aBitmap)=0;
sl@0
  3065
sl@0
  3066
	/** Performs a bitmap block transfer of a rectangular piece of a bitmap.
sl@0
  3067
	
sl@0
  3068
	If the specified rectangle is larger than the bitmap then the bitmap is 
sl@0
  3069
	padded with white.
sl@0
  3070
	
sl@0
  3071
	This pure virtual function is implemented in derived classes.
sl@0
  3072
	
sl@0
  3073
	@param aPoint The destination for the top left corner of the transferred bitmap.
sl@0
  3074
	It is relative to the top left corner of the destination bitmap, which may be the screen.
sl@0
  3075
	
sl@0
  3076
	@param aBitmap A memory-resident bitmap 
sl@0
  3077
	@param aRect A rectangle defining the portion of the bitmap to transfer. 
sl@0
  3078
	Its coordinates are relative to the top left corner of the source bitmap.   */
sl@0
  3079
	virtual void BitBlt(const TPoint& aPoint,const CFbsBitmap* aBitmap,const TRect& aRect)=0;
sl@0
  3080
sl@0
  3081
	/** Performs a masked bitmap block transfer.
sl@0
  3082
	
sl@0
  3083
	The mask bitmap can be used as either a positive or negative mask. Masked 
sl@0
  3084
	pixels are not mapped to the destination rectangle.
sl@0
  3085
	
sl@0
  3086
	This function uses either a black and white (binary) mask bitmap, or if 
sl@0
  3087
	aMaskBitmap's display mode is EGray256, alpha blending is used. Use of 
sl@0
  3088
	any other mode may result in unpredictable results
sl@0
  3089
	
sl@0
  3090
	With aInvertMask=EFalse, black pixels in the mask bitmap stop corresponding 
sl@0
  3091
	pixels in the source bitmap from being transferred to the destination rectangle. 
sl@0
  3092
	With aInvertMask=ETrue, white pixels in the mask bitmap stop corresponding 
sl@0
  3093
	pixels in the source bitmap from being transferred to the destination 
sl@0
  3094
	rectangle.
sl@0
  3095
	
sl@0
  3096
	Note that if the mask bitmap is smaller than the source bitmap, then it is 
sl@0
  3097
	tiled across the bitmap. Note that the mask is applied before the piece of 
sl@0
  3098
	the bitmap is defined - the mask is tiled relative to the top left of the 
sl@0
  3099
	original source bitmap rather than the top left of the bitmap piece.
sl@0
  3100
	
sl@0
  3101
	This pure virtual function is implemented in derived classes.
sl@0
  3102
	
sl@0
  3103
	@param aPoint The destination for the top left corner of the transferred bitmap. 
sl@0
  3104
	It is relative to the top left corner of the destination bitmap, which may be the screen. 
sl@0
  3105
	@param aBitmap A memory-resident source bitmap. 
sl@0
  3106
	@param aSourceRect A rectangle defining the piece of the bitmap to be drawn, 
sl@0
  3107
	with co-ordinates relative to the top left corner of the bitmap. 
sl@0
  3108
	@param aMaskBitmap A mask bitmap 
sl@0
  3109
	@param aInvertMask If  EFalse, a source pixel that is masked by a black pixel 
sl@0
  3110
	is not transferred to the destination rectangle. If ETrue, then a source 
sl@0
  3111
	pixel that is masked by a white pixel is not transferred to the destination 
sl@0
  3112
	rectangle. */
sl@0
  3113
	virtual void BitBltMasked(const TPoint& aPoint,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask)=0;
sl@0
  3114
sl@0
  3115
	/** Sets whether the graphics context is faded.
sl@0
  3116
	
sl@0
  3117
	@param aFaded ETrue to fade the GC; EFalse to unfade it. */
sl@0
  3118
	virtual void SetFaded(TBool aFaded)=0;
sl@0
  3119
sl@0
  3120
	/** Sets the fading parameters.
sl@0
  3121
	
sl@0
  3122
	This function allows you to override the map used when drawing with a faded 
sl@0
  3123
	graphics context (GC). However if you draw to a faded window with a faded 
sl@0
  3124
	GC, then fading on the GC is ignored and the fading of the window is used.
sl@0
  3125
	
sl@0
  3126
	Fading is used to change the colour of a window to make other windows stand 
sl@0
  3127
	out. Fading can either make a faded window closer to white or closer to 
sl@0
  3128
	black.
sl@0
  3129
	
sl@0
  3130
	Fading re-maps colours in the faded GC to fall between the specified black 
sl@0
  3131
	and white map values. If aBlackMap=0 and aWhiteMap=255 then the colours are 
sl@0
  3132
	mapped unchanged. As the values converge the colours are mapped to a smaller 
sl@0
  3133
	range - so the differences between colours in the faded GC decrease. If 
sl@0
  3134
	the values are reversed then the colours are inverted (i.e. where the GC 
sl@0
  3135
	would be black, it is now white). 
sl@0
  3136
	
sl@0
  3137
	@param aBlackMap Black map fading parameter. Unfaded this is 0. 
sl@0
  3138
	@param aWhiteMap White map fading parameter. Unfaded this is 255. */
sl@0
  3139
	virtual void SetFadingParameters(TUint8 aBlackMap,TUint8 aWhiteMap)=0;
sl@0
  3140
sl@0
  3141
	/**
sl@0
  3142
	Performs an alpha blending of the source data, aSrcBmp, with the CBitmapContext, using
sl@0
  3143
	the data from aAlphaBmp as an alpha blending factor.
sl@0
  3144
	The formula used is:
sl@0
  3145
	(S * A + W * (255 - A)) / 255, where:
sl@0
  3146
	- S - a pixel from aSrcBmp;
sl@0
  3147
	- W - a pixel from the window;
sl@0
  3148
	- A - a pixel from aAlphaBmp;
sl@0
  3149
	The contents of source and alpha bitmap are preserved.
sl@0
  3150
	The calculated alpha blended pixels are written to the destination CBitmapContext.
sl@0
  3151
	@param aDestPt Position in the target the result should be drawn to.
sl@0
  3152
	@param aSrcBmp A pointer to the source bitmap.
sl@0
  3153
	@param aSrcRect The part of the source bitmap that should be used.
sl@0
  3154
	@param aAlphaBmp A pointer to the bitmap used as an alpha blending factor.
sl@0
  3155
	@param aAlphaPt Position of the first pixel in the alpha bitmap that should be used as a source 
sl@0
  3156
	                for the alpha blending. The size of the area is the same as the 
sl@0
  3157
	                source bitmap area - aSrcRect parameter.*/	
sl@0
  3158
	
sl@0
  3159
	virtual TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt) = 0;	
sl@0
  3160
	
sl@0
  3161
	/**
sl@0
  3162
	The method performs an alpha blending of the source data, aSrcBmp, with the CBitmapContext, using
sl@0
  3163
	the data from aAlphaBmp as an alpha blending factor.
sl@0
  3164
	For information on how this function works, see the other overload.
sl@0
  3165
	@param aDestPt Position in the target the result should be drawn to.
sl@0
  3166
	@param aSrcBmp A pointer to the source bitmap.
sl@0
  3167
	@param aSrcRect The part of the source bitmap that should be used.
sl@0
  3168
	@param aAlphaBmp A pointer to the bitmap used as an alpha blending factor.
sl@0
  3169
	@param aAlphaPt Position of the first pixel in the alpha bitmap that should be used as a source 
sl@0
  3170
	                for the alpha blending. The size of the area is the same as the 
sl@0
  3171
	                source bitmap area - aSrcRect parameter.*/
sl@0
  3172
	virtual	TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp,	const TRect& aSrcRect, const CWsBitmap* aAlphaBmp, const TPoint& aAlphaPt) = 0;
sl@0
  3173
	
sl@0
  3174
protected:
sl@0
  3175
sl@0
  3176
	/*
sl@0
  3177
	Implementations from CGraphicsContext
sl@0
  3178
	@see CGraphicsContext::APIExtension(TUid, TAny*&, TAny*)
sl@0
  3179
	*/
sl@0
  3180
	IMPORT_C TInt APIExtension(TUid aUid, TAny*& aOutput, TAny* aInput);	
sl@0
  3181
	/*
sl@0
  3182
	Implementations from CGraphicsContext
sl@0
  3183
	@see CGraphicsContext::Reserved_CGraphicsContext_2()
sl@0
  3184
	*/
sl@0
  3185
	IMPORT_C void Reserved_CGraphicsContext_2();
sl@0
  3186
sl@0
  3187
	IMPORT_C virtual void Reserved_CBitmapContext_1();
sl@0
  3188
	IMPORT_C virtual void Reserved_CBitmapContext_2();
sl@0
  3189
	IMPORT_C virtual void Reserved_CBitmapContext_3();
sl@0
  3190
	};
sl@0
  3191
sl@0
  3192
/** Defines an abstract interface for the capabilities and attributes of a 
sl@0
  3193
bitmapped graphics device.
sl@0
  3194
sl@0
  3195
The class specialises the graphics device interface CGraphicsDevice for bitmaps 
sl@0
  3196
graphics. The Window Server Client-Side API provides one implementation of 
sl@0
  3197
the interface, CWsScreenDevice, for screen drawing. Another implementation, 
sl@0
  3198
CFbsBitmapDevice, is used for drawing to in-memory bitmaps. A third, 
sl@0
  3199
CFbsScreenDevice, is used (rarely) to access the screen directly, without the 
sl@0
  3200
mediation of the window server. 
sl@0
  3201
@publishedAll
sl@0
  3202
@released
sl@0
  3203
*/
sl@0
  3204
class CBitmapDevice : public CGraphicsDevice
sl@0
  3205
	{
sl@0
  3206
public:
sl@0
  3207
	/** Gets the RGB colour of an individual pixel on a bitmapped graphics 
sl@0
  3208
	device. 
sl@0
  3209
	
sl@0
  3210
	This pure virtual function is implemented in derived classes.
sl@0
  3211
	
sl@0
  3212
	@param aColor On return, should contain the RGB colour of the pixel. 
sl@0
  3213
	@param aPixel The (x,y) co-ordinates of the pixel. The top left pixel is 
sl@0
  3214
	(0,0). */
sl@0
  3215
	virtual void GetPixel(TRgb& aColor,const TPoint& aPixel) const=0;
sl@0
  3216
sl@0
  3217
	/** Copies a scanline into a buffer.
sl@0
  3218
	
sl@0
  3219
	The pixels are converted from the display mode format on the bitmapped 
sl@0
  3220
	graphics device to the format of the specified device display mode.
sl@0
  3221
	
sl@0
  3222
	By specifying the start pixel and the number of pixels, either the whole or 
sl@0
  3223
	a portion of a bitmapped graphics device pixel row may be copied.
sl@0
  3224
	
sl@0
  3225
	This pure virtual function is implemented in derived classes.
sl@0
  3226
	
sl@0
  3227
	@param aBuf An 8 bit modifiable descriptor buffer into which pixels are 
sl@0
  3228
	copied; it must be sufficiently large to store all the scanline pixels. 
sl@0
  3229
	@param aStartPixel The (x,y) co-ordinates of the first pixel of the bitmap 
sl@0
  3230
	scanline to be put into the buffer. 
sl@0
  3231
	@param aLength The number of pixels to put into the buffer. 
sl@0
  3232
	@param aDispMode The display mode into which to convert the pixels. */
sl@0
  3233
	virtual void GetScanLine(TDes8& aBuf,const TPoint& aStartPixel,TInt aLength,TDisplayMode aDispMode) const=0;
sl@0
  3234
sl@0
  3235
	/** Adds a font file to the device's typeface store. The specified font
sl@0
  3236
	file must be accessible to any process, i.e. not located inside an
sl@0
  3237
	application's private directory.
sl@0
  3238
	
sl@0
  3239
	This pure virtual function is implemented in derived classes.
sl@0
  3240
	
sl@0
  3241
	@param aName The name of the font file. 
sl@0
  3242
	@param aId On return, contains an ID for the font file. 
sl@0
  3243
	@return KErrNone, if successful; otherwise, another of the system-wide error 
sl@0
  3244
	codes. */
sl@0
  3245
	virtual TInt AddFile(const TDesC& aName,TInt& aId)=0;
sl@0
  3246
sl@0
  3247
	/** Removes a font file from the font store.
sl@0
  3248
	
sl@0
  3249
	This pure virtual function is implemented in derived classes.
sl@0
  3250
	
sl@0
  3251
	@param aId The ID of the font file to be removed. The default is 0. */
sl@0
  3252
	virtual void RemoveFile(TInt aId=0)=0;
sl@0
  3253
sl@0
  3254
	/**
sl@0
  3255
	Gets the font which is the nearest to the given font specification.
sl@0
  3256
	
sl@0
  3257
	When the font is no longer needed, call @c ReleaseFont().
sl@0
  3258
	
sl@0
  3259
	Note that this deprecated function is replaced by the new @c GetNearestFontToDesignHeightInPixels() 
sl@0
  3260
	yielding (virtually) the same result. However clients are strongly encouraged to use the new
sl@0
  3261
	@c GetNearestFontToMaxHeightInPixels() function instead. This will guarantee that every 
sl@0
  3262
	character within any given text string will fit within the given amount of pixels, whereas the design 
sl@0
  3263
	height is an aesthetic unit decided by the font designer without strict physical meaning, which 
sl@0
  3264
	may result in cropped characters.
sl@0
  3265
	
sl@0
  3266
	@param aFont On return, contains a pointer to the nearest font.
sl@0
  3267
	@param aFontSpec The specification of the font to be matched.
sl@0
  3268
	@return KErrNone if successful; a system-wide error code otherwise.
sl@0
  3269
	@publishedAll
sl@0
  3270
	@deprecated Use GetNearestFontToDesignHeightInPixels
sl@0
  3271
	*/
sl@0
  3272
	virtual TInt GetNearestFontInPixels(CFont*& aFont, const TFontSpec& aFontSpec) = 0;
sl@0
  3273
sl@0
  3274
	/**
sl@0
  3275
	Gets the font which is the nearest to the given font specification.
sl@0
  3276
	
sl@0
  3277
	When the font is no longer needed, call @c ReleaseFont().
sl@0
  3278
	
sl@0
  3279
	This new function replaces the deprecated @c GetNearestFontInPixels() yielding (virtually) the 
sl@0
  3280
	same result. However clients are strongly encouraged to use the new
sl@0
  3281
	@c GetNearestFontToMaxHeightInPixels() function instead. This will guarantee that every 
sl@0
  3282
	character within any given text string will fit within the given amount of pixels, whereas the design 
sl@0
  3283
	height is an aesthetic unit decided by the font designer without strict physical meaning, which 
sl@0
  3284
	may result in cropped characters.
sl@0
  3285
sl@0
  3286
	@param aFont On return, contains a pointer to the nearest font.
sl@0
  3287
	@param aFontSpec The specification of the font to be matched.
sl@0
  3288
	@return KErrNone if successful; a system-wide error code otherwise.
sl@0
  3289
	@publishedAll
sl@0
  3290
	@released
sl@0
  3291
	*/
sl@0
  3292
	virtual TInt GetNearestFontToDesignHeightInPixels(
sl@0
  3293
		CFont*& /*aFont*/, const TFontSpec& /*aFontSpec*/) { return KErrNotSupported; }
sl@0
  3294
sl@0
  3295
	/**
sl@0
  3296
	Gets the font which is the nearest to the given font specification.
sl@0
  3297
	
sl@0
  3298
	When the font is no longer needed, call @c ReleaseFont().
sl@0
  3299
	
sl@0
  3300
	The font and bitmap server returns a pointer to the nearest matching font 
sl@0
  3301
	from those available. Matches to max height of font - this does its best 
sl@0
  3302
	to return a font that will fit within the maximum height specified (but 
sl@0
  3303
	note that variations due to hinting algorithms may rarely result in this 
sl@0
  3304
	height being exceeded by up to one pixel). Problems can also be 
sl@0
  3305
	encountered with bitmap fonts where the typeface exists but doesn't have 
sl@0
  3306
	a font small enough.
sl@0
  3307
sl@0
  3308
	@param aFont On return, contains a pointer to the nearest font.
sl@0
  3309
	@param aFontSpec The specification of the font to be matched.
sl@0
  3310
	@param aMaxHeight The maximum height within which the font must fit.
sl@0
  3311
	This overrides the height specified in aFontSpec.
sl@0
  3312
	@return KErrNone if successful; a system-wide error code otherwise.
sl@0
  3313
	@publishedAll
sl@0
  3314
	@released
sl@0
  3315
	*/
sl@0
  3316
	virtual TInt GetNearestFontToMaxHeightInPixels(
sl@0
  3317
		CFont*& /*aFont*/, const TFontSpec& /*aFontSpec*/, TInt /*aMaxHeight*/) { return KErrNotSupported; }
sl@0
  3318
sl@0
  3319
	/** Gets the height, in pixels, of the specified typeface at one of its 
sl@0
  3320
	defined heights.
sl@0
  3321
	
sl@0
  3322
	The typeface is identified by by an index. For a given typeface, there are 
sl@0
  3323
	a discrete number of heights; the specific height is also identified by an 
sl@0
  3324
	index.
sl@0
  3325
	
sl@0
  3326
	The value returned is rounded up or down to the nearest font height in 
sl@0
  3327
	pixels.
sl@0
  3328
	
sl@0
  3329
	This pure virtual function is implemented in derived classes.
sl@0
  3330
	
sl@0
  3331
	@param aTypefaceIndex A typeface index number, in the range: 0 to 
sl@0
  3332
	(NumTypefaces() - 1). 
sl@0
  3333
	@param aHeightIndex A font height index number, in the range: 0 to 
sl@0
  3334
	(iNumHeights - 1) where iNumHeights is a public data member of the 
sl@0
  3335
	TTypefaceSupport object returned by TypefaceSupport(). 
sl@0
  3336
	@return The height of the font, in pixels.
sl@0
  3337
	@see TTypefaceSupport
sl@0
  3338
	@see CGraphicsDevice::NumTypefaces()
sl@0
  3339
	@see CGraphicsDevice::TypefaceSupport() */
sl@0
  3340
	virtual TInt FontHeightInPixels(TInt aTypefaceIndex,TInt aHeightIndex) const=0;
sl@0
  3341
    inline TInt CreateBitmapContext(CBitmapContext*& aGC);
sl@0
  3342
	};
sl@0
  3343
sl@0
  3344
/** A set of margins used for cropping a picture. 
sl@0
  3345
sl@0
  3346
Margins are specified in twips or pixels. 
sl@0
  3347
@publishedAll
sl@0
  3348
@released
sl@0
  3349
*/
sl@0
  3350
class TMargins
sl@0
  3351
    {
sl@0
  3352
public:
sl@0
  3353
	IMPORT_C void InternalizeL(RReadStream& aStream);
sl@0
  3354
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
sl@0
  3355
	IMPORT_C TBool operator==(const TMargins& aMargins) const;
sl@0
  3356
	IMPORT_C TBool operator!=(const TMargins& aMargins) const;
sl@0
  3357
public:
sl@0
  3358
	/** Left margin, (in twips or pixels). */
sl@0
  3359
	TInt iLeft;
sl@0
  3360
	/** Right margin, (in twips or pixels). */
sl@0
  3361
	TInt iRight;
sl@0
  3362
	/** Top margin, (in twips or pixels). */
sl@0
  3363
    TInt iTop;
sl@0
  3364
	/** Bottom margin, (in twips or pixels). */
sl@0
  3365
	TInt iBottom;
sl@0
  3366
	};
sl@0
  3367
sl@0
  3368
/** Picture capabilities.
sl@0
  3369
sl@0
  3370
These include the types of scaling that can be applied to a picture, and whether 
sl@0
  3371
or not it is croppable. 
sl@0
  3372
@publishedAll
sl@0
  3373
@released
sl@0
  3374
*/
sl@0
  3375
class TPictureCapability
sl@0
  3376
	{
sl@0
  3377
public:
sl@0
  3378
	/** Scaling types. */
sl@0
  3379
	enum TScalingType
sl@0
  3380
		{
sl@0
  3381
		/** The picture is not scalable. */
sl@0
  3382
		ENotScaleable,
sl@0
  3383
		/** The picture is fully scalable. */
sl@0
  3384
		EFullyScaleable,
sl@0
  3385
		/** The picture is scalable to any size, as long as its aspect ratio 
sl@0
  3386
		(the ratio of its height to its width) remains constant. */
sl@0
  3387
		EScaleableMaintainingAspectRatio
sl@0
  3388
		};
sl@0
  3389
public:
sl@0
  3390
	inline TPictureCapability(TScalingType aScalingType,TBool aCroppable);
sl@0
  3391
public:
sl@0
  3392
	/** Whether or not the picture is croppable. */
sl@0
  3393
	TScalingType iScalingType;
sl@0
  3394
	/** Scaling type. */
sl@0
  3395
	TBool iIsCroppable;
sl@0
  3396
	};
sl@0
  3397
sl@0
  3398
/** Abstract base class for: drawing a picture to a graphics context, storing 
sl@0
  3399
and restoring the picture. 
sl@0
  3400
sl@0
  3401
The class defines the protocol for a number of concrete picture classes. Its 
sl@0
  3402
main role is to support glass doors used in object embedding.
sl@0
  3403
sl@0
  3404
The class provides a protocol for the provision of scaling and cropping 
sl@0
  3405
functions by derived classes, together with default implementations.
sl@0
  3406
sl@0
  3407
Its main function is Draw(), which draws the picture onto the graphics context 
sl@0
  3408
at a particular point. It also has two important pure virtual functions: 
sl@0
  3409
ExternalizeL() and GetOriginalSizeInTwips().
sl@0
  3410
sl@0
  3411
A picture has both an original representation and an on-screen representation. 
sl@0
  3412
The original representation has a size in twips, and can somehow be drawn. 
sl@0
  3413
The on-screen representation is assumed to be drawn under the control of an 
sl@0
  3414
application which may wish to re-size or scale the original in some way, to 
sl@0
  3415
crop it at the edges, and/or to ensure it fits within a particular defined 
sl@0
  3416
area on the screen.
sl@0
  3417
sl@0
  3418
The class provides several functions that allow an application to set scaling 
sl@0
  3419
and cropping before invoking the Draw() function to draw the picture on-screen. 
sl@0
  3420
It is up to the internal workings of the function to determine the order of 
sl@0
  3421
application cropping and scaling. 
sl@0
  3422
@publishedAll
sl@0
  3423
@released
sl@0
  3424
*/
sl@0
  3425
class CPicture : public CBase
sl@0
  3426
    {
sl@0
  3427
public:
sl@0
  3428
	/** Options for detaching pictures from stores. Used by DetachFromStoreL(). */
sl@0
  3429
	enum TDetach
sl@0
  3430
		{
sl@0
  3431
		/** Internalise all data that is required to fully store the picture 
sl@0
  3432
		later; null any references to containing stores. */
sl@0
  3433
		EDetachFull,
sl@0
  3434
		/** Internalise enough information to draw the picture (and no more); 
sl@0
  3435
		null any references to containing stores. */
sl@0
  3436
		EDetachDraw
sl@0
  3437
		};
sl@0
  3438
public:
sl@0
  3439
	IMPORT_C virtual ~CPicture();
sl@0
  3440
	/** Draws a picture.
sl@0
  3441
	
sl@0
  3442
	@param aGc The graphics context. 
sl@0
  3443
	@param aTopLeft The co-ordinates where the top left corner pixel of the 
sl@0
  3444
	picture should be placed. Note that whether this is actually drawn depends 
sl@0
  3445
	on the clipping area defined.
sl@0
  3446
	@param aClipRect A clipping rectangle that defines the area to which the 
sl@0
  3447
	function should draw. An implementation should never draw outside this 
sl@0
  3448
	rectangle. Note that the graphics context may also have a clipping rectangle 
sl@0
  3449
	set on it. 
sl@0
  3450
	@param aMap The device map for the graphics device. The implementation 
sl@0
  3451
	should use this to find the scaling to apply to the picture. */
sl@0
  3452
	virtual void Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,MGraphicsDeviceMap* aMap) const=0;
sl@0
  3453
	IMPORT_C virtual TStreamId StoreL(CStreamStore& aStore) const; // assumes no sub streams
sl@0
  3454
	virtual void DetachFromStoreL(TDetach /*aDegree*/=EDetachFull) {}
sl@0
  3455
sl@0
  3456
	/** Externalises the picture to a stream.
sl@0
  3457
	
sl@0
  3458
	The presence of this function means that the standard templated stream 
sl@0
  3459
	operator<<() is available to externalise objects of this class.
sl@0
  3460
	
sl@0
  3461
	A derived class must supply an implementation of this function.
sl@0
  3462
	
sl@0
  3463
	@param aStream The write stream. */
sl@0
  3464
	virtual void ExternalizeL(RWriteStream& aStream) const =0;
sl@0
  3465
sl@0
  3466
	/** Gets the pictur's original size, in twips.
sl@0
  3467
	
sl@0
  3468
	@param aSize The size of the picture, in twips */
sl@0
  3469
	virtual void GetOriginalSizeInTwips(TSize& aSize) const =0;
sl@0
  3470
	IMPORT_C virtual void SetScaleFactor(TInt aScaleFactorWidth,TInt aScaleFactorHeight); // does nothing
sl@0
  3471
	IMPORT_C virtual void SetCropInTwips(const TMargins& aMargins); // does nothing
sl@0
  3472
	IMPORT_C virtual TPictureCapability Capability() const; // no scale, no crop
sl@0
  3473
	IMPORT_C virtual void GetCropInTwips(TMargins& aMargins) const; // returns no crop
sl@0
  3474
	IMPORT_C virtual TInt ScaleFactorWidth() const; // returns no scaling
sl@0
  3475
	IMPORT_C virtual TInt ScaleFactorHeight() const; // returns no scaling
sl@0
  3476
	IMPORT_C virtual TBool LineBreakPossible(TUint aClass,TBool aBeforePicture,TBool aHaveSpaces) const;
sl@0
  3477
	IMPORT_C virtual TBool NativePixelSize(TSize& aPixelSize);
sl@0
  3478
sl@0
  3479
	IMPORT_C void GetSizeInPixels(MGraphicsDeviceMap* aMap, TSize& aSize) const;
sl@0
  3480
	IMPORT_C void SetSizeInPixels(MGraphicsDeviceMap* aMap, const TSize& aSize);
sl@0
  3481
	IMPORT_C void AddCropInPixels(MGraphicsDeviceMap* aMap, const TMargins& aMargins);
sl@0
  3482
	IMPORT_C void GetSizeInTwips(TSize& aSize) const;
sl@0
  3483
	IMPORT_C void SetSizeInTwips(const TSize& aSize);
sl@0
  3484
	IMPORT_C void ResetToOriginal();
sl@0
  3485
protected:
sl@0
  3486
	IMPORT_C CPicture();
sl@0
  3487
	};
sl@0
  3488
sl@0
  3489
sl@0
  3490
/** Picture header providing an interface to a stored picture. The header holds:
sl@0
  3491
sl@0
  3492
the picture's type, encoded as a UID, which ensures that it will be restored 
sl@0
  3493
to the correct picture type
sl@0
  3494
sl@0
  3495
the picture's size, which facilitates deferred loading
sl@0
  3496
sl@0
  3497
the stream ID of the picture body, which is replaced by a pointer to the picture 
sl@0
  3498
object when it has been restored. 
sl@0
  3499
@publishedAll
sl@0
  3500
@released
sl@0
  3501
*/
sl@0
  3502
class TPictureHeader
sl@0
  3503
	{
sl@0
  3504
public:
sl@0
  3505
	IMPORT_C TPictureHeader();
sl@0
  3506
	IMPORT_C void InternalizeL(RReadStream& aStream);
sl@0
  3507
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
sl@0
  3508
	IMPORT_C void DeletePicture();
sl@0
  3509
public:
sl@0
  3510
	/** A swizzle storing either the ID of the stream in which the picture is 
sl@0
  3511
	stored, or a pointer to the internalised picture. */
sl@0
  3512
	TSwizzle<CPicture> iPicture;
sl@0
  3513
	/** A UID specifying the type of the picture. */
sl@0
  3514
	TUid iPictureType;
sl@0
  3515
	/** The original size of the picture. */
sl@0
  3516
	TSize iSize;
sl@0
  3517
	};
sl@0
  3518
sl@0
  3519
sl@0
  3520
/** Abstract interface for instantiating and restoring new CPicture derived 
sl@0
  3521
objects.
sl@0
  3522
sl@0
  3523
A concrete derived class creates pictures of one or more specific types. The 
sl@0
  3524
class has no member data and just one function, NewPictureL, that needs to 
sl@0
  3525
be provided by derived classes. 
sl@0
  3526
@publishedAll
sl@0
  3527
@released
sl@0
  3528
*/
sl@0
  3529
class MPictureFactory
sl@0
  3530
	{
sl@0
  3531
public:
sl@0
  3532
	/** Interface to the picture restoration process that ensures that a 
sl@0
  3533
	picture of the correct type is restored.
sl@0
  3534
	
sl@0
  3535
	The class of the object to be restored is determined by the UID of the 
sl@0
  3536
	stored picture, contained in the specified picture header.
sl@0
  3537
	
sl@0
  3538
	The function can allow the restoration of:
sl@0
  3539
	
sl@0
  3540
	just one CPicture-derived class, returning an error if the UID indicates 
sl@0
  3541
	that the stored picture is not of the required type
sl@0
  3542
	
sl@0
  3543
	many different CPicture-derived classes, using the UID to choose which of 
sl@0
  3544
	the possible CPicture-derived classes should be instantiated
sl@0
  3545
	
sl@0
  3546
	@param aHeader The picture header that should be restored. 
sl@0
  3547
	@param aDeferredPictureStore The store in which both the header and picture 
sl@0
  3548
	reside. */
sl@0
  3549
	virtual void NewPictureL(TPictureHeader& aHeader,const CStreamStore& aDeferredPictureStore)const=0;
sl@0
  3550
	};
sl@0
  3551
sl@0
  3552
// printing classes
sl@0
  3553
sl@0
  3554
/**
sl@0
  3555
The maximum length of a printer model name.
sl@0
  3556
@see TPrinterModelName 
sl@0
  3557
@publishedAll
sl@0
  3558
@released
sl@0
  3559
*/
sl@0
  3560
const TInt KMaxPrinterModelNameLength=0x20;
sl@0
  3561
sl@0
  3562
/**
sl@0
  3563
Defines a modifiable buffer descriptor that can contain the name of a
sl@0
  3564
printer model. The maximum length of the buffer is 32.
sl@0
  3565
@since 5.0 
sl@0
  3566
@publishedAll
sl@0
  3567
@released
sl@0
  3568
*/
sl@0
  3569
typedef TBuf<KMaxPrinterModelNameLength> TPrinterModelName;
sl@0
  3570
sl@0
  3571
/** Page specification for a print operation.
sl@0
  3572
sl@0
  3573
  The page specification consists of the page orientation and the page
sl@0
  3574
size in twips or pixels. By default, the page orientation is portrait.
sl@0
  3575
When using landscape orientation, the left hand side of the page
sl@0
  3576
becomes the top. 
sl@0
  3577
"gdi.lib"
sl@0
  3578
@since 5.0
sl@0
  3579
@publishedAll
sl@0
  3580
@released
sl@0
  3581
*/	
sl@0
  3582
class TPageSpec
sl@0
  3583
	{
sl@0
  3584
public:
sl@0
  3585
	/**The available page orientations. */
sl@0
  3586
	enum TPageOrientation
sl@0
  3587
		{
sl@0
  3588
		/** Portrait page orientation */
sl@0
  3589
		EPortrait,
sl@0
  3590
		/** Landscape page orientation */
sl@0
  3591
		ELandscape
sl@0
  3592
		};
sl@0
  3593
public:
sl@0
  3594
	IMPORT_C TPageSpec();
sl@0
  3595
	IMPORT_C TPageSpec(TPageOrientation aOrientation,const TSize& aSize);
sl@0
  3596
	IMPORT_C void InternalizeL(RReadStream& aStream);
sl@0
  3597
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
sl@0
  3598
	IMPORT_C TSize OrientedPageSize() const;
sl@0
  3599
	IMPORT_C TBool operator==(const TPageSpec& aPageSpec) const;
sl@0
  3600
	IMPORT_C TBool operator!=(const TPageSpec& aPageSpec) const;
sl@0
  3601
public:
sl@0
  3602
	/** The width and height of the page in portrait orientation in twips or 
sl@0
  3603
	pixels.
sl@0
  3604
	
sl@0
  3605
	Note that OrientedPageSize() returns the width and height in reverse order 
sl@0
  3606
	for a landscape portrait. */
sl@0
  3607
	TSize iPortraitPageSize;
sl@0
  3608
	/** The page orientation. */
sl@0
  3609
	TPageOrientation iOrientation;
sl@0
  3610
	};
sl@0
  3611
sl@0
  3612
sl@0
  3613
/**  Controls the attributes of the band to be printed.
sl@0
  3614
sl@0
  3615
An object of this type is passed as a parameter to functions.
sl@0
  3616
MPageRegionPrinter::PrintBandL() and CPrinterControl::QueueGetBand().
sl@0
  3617
@see MPageRegionPrinter::PrintBandL()
sl@0
  3618
@see CPrinterControl::QueueGetBand() 
sl@0
  3619
@since 5.0
sl@0
  3620
@publishedAll
sl@0
  3621
@released
sl@0
  3622
*/	
sl@0
  3623
class TBandAttributes
sl@0
  3624
    {
sl@0
  3625
public:
sl@0
  3626
	/** The width and height of the band in twips or pixels. */
sl@0
  3627
	TRect iRect;
sl@0
  3628
	/** ETrue to draw no text to the band; EFalse to draw text. */
sl@0
  3629
	TBool iTextIsIgnored; // any text drawing to this band is ignored
sl@0
  3630
	/** ETrue to draw no graphics to the band; EFalse to draw graphics. */
sl@0
  3631
	TBool iGraphicsIsIgnored; // any graphics drawing to this band is ignored
sl@0
  3632
	/** ETrue if band is the first band on the page; EFalse if not. */
sl@0
  3633
	TBool iFirstBandOnPage;
sl@0
  3634
	};
sl@0
  3635
sl@0
  3636
/**  Printer port interface.
sl@0
  3637
sl@0
  3638
This interface is used as the base class for the various types of
sl@0
  3639
printer port. New printer port classes should be derived from this
sl@0
  3640
class.After allocation and construction, a pointer to a concrete
sl@0
  3641
printer port should be passed to
sl@0
  3642
CPrintSetup::StartPrintL().
sl@0
  3643
@see CPrintSetup::StartPrintL() 
sl@0
  3644
@since 5.0
sl@0
  3645
@publishedAll
sl@0
  3646
@released
sl@0
  3647
*/
sl@0
  3648
class CPrinterPort : public CBase
sl@0
  3649
	{
sl@0
  3650
public:
sl@0
  3651
	/** Writes data asynchronously to the printer port.
sl@0
  3652
	
sl@0
  3653
	@param aBuf Data to be written to the port 
sl@0
  3654
	@param aRequestStatus A reference to the request status object. If the 
sl@0
  3655
	request is cancelled, this should be set to KErrCancel; if the request 
sl@0
  3656
	completes normally, this should be set to KErrNone. */
sl@0
  3657
	virtual void WriteRequest(const TDesC8& aBuf,TRequestStatus& aRequestStatus)=0;
sl@0
  3658
 
sl@0
  3659
	/** Cancels an outstanding WriteRequest() operation. */
sl@0
  3660
	virtual void Cancel()=0;
sl@0
  3661
	};
sl@0
  3662
sl@0
  3663
sl@0
  3664
/** Detailed information about a printer model. 
sl@0
  3665
"gdi.lib" 
sl@0
  3666
@since 5.0
sl@0
  3667
@publishedAll
sl@0
  3668
@released
sl@0
  3669
*/
sl@0
  3670
class TPrinterModelEntry
sl@0
  3671
  	{
sl@0
  3672
public:
sl@0
  3673
	/** The name of the printer model. */
sl@0
  3674
	TPrinterModelName iModelName;
sl@0
  3675
	/** If ETrue, then a printer port is required. */
sl@0
  3676
	TBool iRequiresPrinterPort;
sl@0
  3677
	/** The UID associated with this printer model. */
sl@0
  3678
	TUid iUid;
sl@0
  3679
public:
sl@0
  3680
	IMPORT_C void InternalizeL(RReadStream& aStream);
sl@0
  3681
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
sl@0
  3682
	};
sl@0
  3683
sl@0
  3684
sl@0
  3685
/** Information about a printer model.
sl@0
  3686
sl@0
  3687
An instance of this class consists of a TPrinterModelEntry and a stream ID, 
sl@0
  3688
and is passed to CPrinterDevice::SetModel().
sl@0
  3689
sl@0
  3690
@see CPrinterDevice 
sl@0
  3691
@publishedAll
sl@0
  3692
@released
sl@0
  3693
*/
sl@0
  3694
class TPrinterModelHeader
sl@0
  3695
    {
sl@0
  3696
public:
sl@0
  3697
	/** The printer model. */
sl@0
  3698
	TPrinterModelEntry iEntry;
sl@0
  3699
	/** The stream ID for model data. */
sl@0
  3700
	TStreamId iModelDataStreamId;
sl@0
  3701
public:
sl@0
  3702
	IMPORT_C void InternalizeL(RReadStream& aStream);
sl@0
  3703
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
sl@0
  3704
	};
sl@0
  3705
sl@0
  3706
sl@0
  3707
/** Printer control interface.
sl@0
  3708
sl@0
  3709
This abstract base class acts as the interface between a CPrinterDevice object 
sl@0
  3710
and the printer. It creates the context for, and controls the progress and 
sl@0
  3711
termination of the print job.
sl@0
  3712
sl@0
  3713
Only those who need to add new printer drivers should write derived classes. 
sl@0
  3714
After instantiation of such a class, using CPrinterDevice::CreateControlL(), 
sl@0
  3715
the object can be accessed via the iControl member of CPrinterDevice.
sl@0
  3716
sl@0
  3717
@see CPrinterDevice 
sl@0
  3718
@publishedAll
sl@0
  3719
@released
sl@0
  3720
*/
sl@0
  3721
class CPrinterControl : public CBase
sl@0
  3722
    {
sl@0
  3723
public:
sl@0
  3724
	/** Flags indicating whether there is more on the page to print. */
sl@0
  3725
	enum TMoreOnPage
sl@0
  3726
		{
sl@0
  3727
		/** Indicates there is more to print on the current page. */
sl@0
  3728
		EMoreOnPage,
sl@0
  3729
		/** Indicates there is no more to print on the current page. */
sl@0
  3730
		ENoMoreOnPage
sl@0
  3731
		};
sl@0
  3732
public:
sl@0
  3733
	IMPORT_C ~CPrinterControl();
sl@0
  3734
sl@0
  3735
	/** Gets the number of bands per page.
sl@0
  3736
 
sl@0
  3737
 	@return The number of bands on each page. */
sl@0
  3738
	virtual TInt BandsPerPage()=0;
sl@0
  3739
sl@0
  3740
	/**  Prints the next band on the page.
sl@0
  3741
 
sl@0
  3742
 	This is an asynchronous function.
sl@0
  3743
 	@param  aStatus Request status object. On successful completion
sl@0
  3744
    contains KErrNone, otherwise another of the system-wide 
sl@0
  3745
    error codes.
sl@0
  3746
 	@param aBand  On return, indicates the attributes of the band, including 
sl@0
  3747
 	its height and width and whether or not the device will ignore one or 
sl@0
  3748
 	other of graphics or text output. This information may be used by 
sl@0
  3749
 	applications to draw more efficiently, or may be ignored
sl@0
  3750
 	@return EMoreOnPage, if any unprinted bands remain on the 
sl@0
  3751
 	current page. ENoMoreOnPage, if the current band is last on 
sl@0
  3752
 	page. */
sl@0
  3753
	virtual TMoreOnPage QueueGetBand(TRequestStatus& aStatus, TBandAttributes& aBand)=0; // returns affirmative if more to print on current page
sl@0
  3754
sl@0
  3755
	/** Terminates the print process.
sl@0
  3756
sl@0
  3757
	This is an asynchronous function and is called when no more bands in
sl@0
  3758
	the document remain to be printed.Note that all bands have been
sl@0
  3759
	printed when no more pages or copies remain to be printed, and
sl@0
  3760
	QueueGetBand() returns ENoMoreToPrint.
sl@0
  3761
sl@0
  3762
	@param aStatus Request status object. On successful completion contains 
sl@0
  3763
	KErrNone, otherwise another of the system-wide error codes. */
sl@0
  3764
	virtual void QueueEndPrint(TRequestStatus& aStatus)=0; 
sl@0
  3765
sl@0
  3766
	/** Aborts the print process before it has completed.
sl@0
  3767
	
sl@0
  3768
	This function should be called if QueueGetBand() reports an error. */
sl@0
  3769
	virtual void AbortPrint()=0; // tidy up synchronously in a short time, return success code
sl@0
  3770
protected:
sl@0
  3771
	IMPORT_C CPrinterControl(CPrinterPort* aPrinterPort);
sl@0
  3772
protected:
sl@0
  3773
	/** State flags. */
sl@0
  3774
	enum TState 
sl@0
  3775
		{
sl@0
  3776
		/** Not printing. */
sl@0
  3777
		ENotPrinting, 
sl@0
  3778
		/** Printing. */
sl@0
  3779
		EPrinting
sl@0
  3780
		};
sl@0
  3781
	/** Printing state. */
sl@0
  3782
	TState iState;
sl@0
  3783
	/** Printer port. */
sl@0
  3784
	CPrinterPort* iPrinterPort;
sl@0
  3785
	};
sl@0
  3786
sl@0
  3787
class CDictionaryStore;
sl@0
  3788
class RFs;
sl@0
  3789
sl@0
  3790
/** Printer graphics device interface.
sl@0
  3791
sl@0
  3792
This abstract class represents a physical graphics device that is used for 
sl@0
  3793
printing.
sl@0
  3794
sl@0
  3795
This class is used to:
sl@0
  3796
sl@0
  3797
set and get the page specification
sl@0
  3798
sl@0
  3799
map between the co-ordinates of the printed page (in twips) and the co-ordinates 
sl@0
  3800
of the image device (in pixels)
sl@0
  3801
sl@0
  3802
get and set the printer model entry
sl@0
  3803
sl@0
  3804
create and delete a printer control.
sl@0
  3805
sl@0
  3806
A printer driver is defined in terms of a printer device and a printer control. 
sl@0
  3807
A printer device can own either a single or no printer control. The control 
sl@0
  3808
determines the progress and termination of the print job and is responsible 
sl@0
  3809
for producing output.
sl@0
  3810
sl@0
  3811
@see CPrinterControl 
sl@0
  3812
@publishedAll
sl@0
  3813
@released
sl@0
  3814
*/
sl@0
  3815
class CPrinterDevice : public CGraphicsDevice
sl@0
  3816
	{
sl@0
  3817
public:
sl@0
  3818
	IMPORT_C ~CPrinterDevice();
sl@0
  3819
sl@0
  3820
	/** Gets the current page specification in twips.
sl@0
  3821
	
sl@0
  3822
	@return The current page specification, in twips. */
sl@0
  3823
	inline TPageSpec CurrentPageSpecInTwips() const {return(iCurrentPageSpecInTwips);}
sl@0
  3824
sl@0
  3825
	/** Sets the page specification in twips.
sl@0
  3826
	
sl@0
  3827
	@param aPageSpec The page specification in twips. */
sl@0
  3828
	IMPORT_C virtual void SelectPageSpecInTwips(const TPageSpec& aPageSpec);
sl@0
  3829
	IMPORT_C virtual TRect PrintablePageInPixels() const;
sl@0
  3830
sl@0
  3831
	/** Gets the printer model entry.
sl@0
  3832
	
sl@0
  3833
	@return The printer model entry. */
sl@0
  3834
	virtual TPrinterModelEntry Model()const =0;
sl@0
  3835
sl@0
  3836
	/** Sets the printer model header and the store.
sl@0
  3837
	
sl@0
  3838
	@param aModel The printer model header.
sl@0
  3839
	@param aStore  The store.
sl@0
  3840
	@return KErrNone if successful; otherwise, another of the system-wide 
sl@0
  3841
	error codes.*/
sl@0
  3842
	virtual TInt SetModel(const TPrinterModelHeader& aModel,CStreamStore& aStore)=0;
sl@0
  3843
sl@0
  3844
	/** Creates a printer control.
sl@0
  3845
	
sl@0
  3846
	The printer control is an instance of a CPrinterControl derived class; it 
sl@0
  3847
	is assigned to this printer device's iControl member.
sl@0
  3848
	
sl@0
  3849
	Note that this function is called by CPrintSetup::StartPrintL().
sl@0
  3850
	
sl@0
  3851
	@param aPrinterPort Pointer to an instance of a printer port. */
sl@0
  3852
	virtual void CreateControlL(CPrinterPort* aPrinterPort)=0;
sl@0
  3853
	IMPORT_C virtual void DeleteControl();
sl@0
  3854
sl@0
  3855
	/**  Externalizes printer properties to the store.
sl@0
  3856
sl@0
  3857
	The default implementation is empty.
sl@0
  3858
sl@0
  3859
	@param  aStream  The read stream. */
sl@0
  3860
	virtual void InternalizePropertiesL(RReadStream& /*aStream*/) {}
sl@0
  3861
sl@0
  3862
	/**  Externalizes printer properties to the store.
sl@0
  3863
	
sl@0
  3864
	The default implementation is empty.
sl@0
  3865
	
sl@0
  3866
	@param  aStream  The write stream. */
sl@0
  3867
	virtual void ExternalizePropertiesL(RWriteStream& /*aStream*/) const {}
sl@0
  3868
	IMPORT_C void RestorePropertiesL();
sl@0
  3869
	IMPORT_C void StorePropertiesL() const;
sl@0
  3870
protected:
sl@0
  3871
	IMPORT_C CPrinterDevice();
sl@0
  3872
public:
sl@0
  3873
	/** The printer control.
sl@0
  3874
	
sl@0
  3875
	This may be NULL. If implemented, it provides control over the print 
sl@0
  3876
	operation. */
sl@0
  3877
	CPrinterControl* iControl;
sl@0
  3878
protected:
sl@0
  3879
	/** Current page specification in twips. */
sl@0
  3880
	TPageSpec iCurrentPageSpecInTwips;
sl@0
  3881
	};
sl@0
  3882
sl@0
  3883
sl@0
  3884
/** Printer model list interface.
sl@0
  3885
sl@0
  3886
Functions provided by this abstract base class can be used to extract printer 
sl@0
  3887
model information from the list of printer models. This class would typically 
sl@0
  3888
be used to implement printer selection in a dialog box.
sl@0
  3889
sl@0
  3890
@see CPdrModelList 
sl@0
  3891
@publishedAll
sl@0
  3892
@released
sl@0
  3893
*/
sl@0
  3894
class CPrinterModelList : public CBase
sl@0
  3895
     {
sl@0
  3896
public:
sl@0
  3897
	/** Gets the number of printer models in the printer model list.
sl@0
  3898
 
sl@0
  3899
 	@return The number of printer models. */
sl@0
  3900
    virtual TInt ModelCount() const=0;
sl@0
  3901
sl@0
  3902
	/**Gets printer model name.
sl@0
  3903
 
sl@0
  3904
	This is the name of the printer model at the specified index within
sl@0
  3905
	the list of printer models.
sl@0
  3906
 
sl@0
  3907
	@param  anIndex The index of the printer model within the array of
sl@0
  3908
    printer models. Note that this number must be between zero and 
sl@0
  3909
    ModelCount().
sl@0
  3910
    @return Name of printer model, up to 32 characters long */
sl@0
  3911
    virtual const TPrinterModelEntry operator[](TInt anIndex)=0;
sl@0
  3912
sl@0
  3913
	/** Gets a printer models index within the model list from its UID.
sl@0
  3914
sl@0
  3915
	@param aModelUid The UID of the printer model.
sl@0
  3916
	@return  The index of the printer model within the array of printer models.*/
sl@0
  3917
	virtual TInt UidToNum(TUid aModelUid) const=0;
sl@0
  3918
    };
sl@0
  3919
sl@0
  3920
sl@0
  3921
/** Interface for printing in bands.
sl@0
  3922
sl@0
  3923
This class provides a single PrintBandL() function that prints 
sl@0
  3924
the body of each page band by band. Classes derived from this interface must 
sl@0
  3925
provide an implementation of the PrintBandL() function. 
sl@0
  3926
@since 5.0 
sl@0
  3927
@publishedAll
sl@0
  3928
@released
sl@0
  3929
*/
sl@0
  3930
class MPageRegionPrinter
sl@0
  3931
	{
sl@0
  3932
public:
sl@0
  3933
	/** Prints a band.
sl@0
  3934
	
sl@0
  3935
	Implementations should set up a graphics context to which all drawing should 
sl@0
  3936
	take place using CGraphicsDevice::CreateContext(). All co-ordinate 
sl@0
  3937
	calculations should be done in twips, and converted into pixels before 
sl@0
  3938
	starting the print job.
sl@0
  3939
	
sl@0
  3940
	@param aDevice Pointer to the graphics device representing the printer.
sl@0
  3941
	@param aPageNo The number of the page containing the band to be printed.
sl@0
  3942
	@param aBandInPixels Attributes of the band to be printed. */
sl@0
  3943
	virtual void PrintBandL(CGraphicsDevice* aDevice,TInt aPageNo,const TBandAttributes& aBandInPixels)=0;
sl@0
  3944
	};
sl@0
  3945
sl@0
  3946
/**
sl@0
  3947
The UID value of a printer specification data store. 
sl@0
  3948
@publishedAll
sl@0
  3949
@released
sl@0
  3950
*/
sl@0
  3951
const TInt KPdrStoreFileUidVal=268435514;
sl@0
  3952
sl@0
  3953
const TInt KPdlUidVal=268450588;
sl@0
  3954
const TInt KUdlUidVal=268450589;
sl@0
  3955
sl@0
  3956
sl@0
  3957
/** Printer specific user interface.
sl@0
  3958
sl@0
  3959
The class is used to implement a printer specific setup dialog. A concrete 
sl@0
  3960
implementation of the class is supplied in a UDL (i.e. a UI DLL).
sl@0
  3961
sl@0
  3962
CPrinterDriver::CreatePrinterDriverUIL() is used to construct a CPrinterDriverUI 
sl@0
  3963
object for a specific printer. (This function calls the ordinal 1 exported 
sl@0
  3964
function of the UDL that performs the construction of the CPrinterDriverUI 
sl@0
  3965
object).
sl@0
  3966
sl@0
  3967
@see CPrinterDriver::CreatePrinterDriverUIL() 
sl@0
  3968
@publishedAll
sl@0
  3969
@released
sl@0
  3970
*/
sl@0
  3971
class CPrinterDriverUI : public CBase
sl@0
  3972
    {
sl@0
  3973
protected:
sl@0
  3974
	IMPORT_C CPrinterDriverUI();
sl@0
  3975
public:
sl@0
  3976
	IMPORT_C virtual TBool BeforePrintL();
sl@0
  3977
	IMPORT_C virtual void AfterPrintL();
sl@0
  3978
	IMPORT_C virtual void SetPropertiesL();
sl@0
  3979
	IMPORT_C virtual TBool CanSetProperties();
sl@0
  3980
sl@0
  3981
	/** Sets the printer device.
sl@0
  3982
	
sl@0
  3983
	@param aPrinterDevice The printer device. */
sl@0
  3984
	virtual TInt SetPrinterDevice(CPrinterDevice* aPrinterDevice)=0;
sl@0
  3985
	};
sl@0
  3986
								   
sl@0
  3987
class CFileStore;
sl@0
  3988
sl@0
  3989
sl@0
  3990
/** Provides access to a store containing printer specification data.
sl@0
  3991
sl@0
  3992
Printer specification data is held as a direct file store, and usually has 
sl@0
  3993
a .pdr file type.
sl@0
  3994
sl@0
  3995
A printer driver is implemented as two files: a PDR file containing the printer 
sl@0
  3996
specification data and a PDL file containing the code to link the printer 
sl@0
  3997
with the graphics printing system.
sl@0
  3998
sl@0
  3999
The printer specification data is generated by compiling a text file (a .pd 
sl@0
  4000
file type) using the pdrtran tool. Printer specification data defines:
sl@0
  4001
sl@0
  4002
the name of the associated PDL
sl@0
  4003
sl@0
  4004
a list of one or more models supported by this driver, identified by name 
sl@0
  4005
and UID
sl@0
  4006
sl@0
  4007
device information such as the size of the device, typeface information for 
sl@0
  4008
each model, including which typefaces are supported, the heights available 
sl@0
  4009
in each typeface and the width of each character in a font.
sl@0
  4010
sl@0
  4011
@see CPrinterDriverUI 
sl@0
  4012
@publishedAll
sl@0
  4013
@released
sl@0
  4014
*/
sl@0
  4015
class CPrinterDriver : public CBase
sl@0
  4016
     {
sl@0
  4017
public:
sl@0
  4018
	IMPORT_C static CPrinterDriver* NewL();
sl@0
  4019
	IMPORT_C ~CPrinterDriver();
sl@0
  4020
	IMPORT_C void OpenPdrL(const TDesC &aName);
sl@0
  4021
	IMPORT_C void Close();
sl@0
  4022
	IMPORT_C TInt NumModels() const;
sl@0
  4023
	IMPORT_C TPrinterModelEntry Model(TInt aNum) const;
sl@0
  4024
sl@0
  4025
	/** Gets the associated graphics printer device.
sl@0
  4026
	
sl@0
  4027
	@return The physical graphics device used for printing. */
sl@0
  4028
	inline CPrinterDevice* PrinterDevice() {return iPrinterDevice;}
sl@0
  4029
	IMPORT_C CPrinterDevice* CreatePrinterDeviceL(TUid aModelUid);
sl@0
  4030
	IMPORT_C CPrinterDriverUI* CreatePrinterDriverUIL();
sl@0
  4031
private:
sl@0
  4032
	CPrinterDriver();
sl@0
  4033
	void DeletePrinterDevice();
sl@0
  4034
	void DoOpenPdrL(const TDesC &aName);
sl@0
  4035
	void DoCreatePrinterDeviceL(TUid aModelUid);
sl@0
  4036
	void LoadLibraryL(RLibrary& aLibrary,const TDesC& aExt,TUid aUid2);
sl@0
  4037
private:
sl@0
  4038
	RFs iFs;
sl@0
  4039
	CFileStore *iPdrStore;
sl@0
  4040
	TInt iNumModels;
sl@0
  4041
	TPrinterModelHeader* iModelList;
sl@0
  4042
	TFileName iPdlName;
sl@0
  4043
	TUid iPdlUid;
sl@0
  4044
	RLibrary iPdlLibrary;
sl@0
  4045
	CPrinterDevice* iPrinterDevice;
sl@0
  4046
	RLibrary iUdlLibrary;
sl@0
  4047
	};
sl@0
  4048
sl@0
  4049
class RResourceFile;
sl@0
  4050
sl@0
  4051
sl@0
  4052
/** Implements a printer model list interface for a collection of PDR files. 
sl@0
  4053
@publishedAll
sl@0
  4054
@released
sl@0
  4055
*/
sl@0
  4056
class CPdrModelList : public CPrinterModelList
sl@0
  4057
    {
sl@0
  4058
public:
sl@0
  4059
	IMPORT_C static CPdrModelList* NewL();
sl@0
  4060
	IMPORT_C virtual ~CPdrModelList();
sl@0
  4061
    IMPORT_C TInt ModelCount() const;
sl@0
  4062
    IMPORT_C const TPrinterModelEntry operator [] (TInt anIndex);
sl@0
  4063
	IMPORT_C TInt UidToNum(TUid aModelUid) const;  // returns KErrNotFound the model uid is not matched
sl@0
  4064
	IMPORT_C void AddDirectoryL(const TDesC& aDir);
sl@0
  4065
	IMPORT_C CPrinterModelList* ScanForModelsL();
sl@0
  4066
	IMPORT_C CPrinterDriver* CreatePrinterDriverL(TInt anIndex);
sl@0
  4067
private:
sl@0
  4068
	CPdrModelList();
sl@0
  4069
	void ConstructL();
sl@0
  4070
private:
sl@0
  4071
	class TFileEntry
sl@0
  4072
		{
sl@0
  4073
	public:
sl@0
  4074
		TFileName iFileName;
sl@0
  4075
		TDesC* iDirectory;
sl@0
  4076
		};
sl@0
  4077
	class TModelEntry
sl@0
  4078
		{
sl@0
  4079
	public:
sl@0
  4080
		TPrinterModelEntry iEntry;
sl@0
  4081
		TFileEntry* iFile; 
sl@0
  4082
		};
sl@0
  4083
private:
sl@0
  4084
	void ScanDirectoryL(TInt aDirIndex);
sl@0
  4085
	void ListModelsL(TInt aFileIndex, TParse& aParser, TFileName& aNameOfLoadedResourceFile, TFileName& aTempFileName, RResourceFile& aResourceFile, HBufC8*& aResource);
sl@0
  4086
	HBufC* NewPathBufL(const TFileEntry& aFileEntry);
sl@0
  4087
private:
sl@0
  4088
	CArrayFixSeg<TModelEntry>* iModelArray;
sl@0
  4089
	CArrayFixFlat<TFileEntry>* iFileArray;
sl@0
  4090
	CArrayFixFlat<HBufC*>* iDirectoryArray;
sl@0
  4091
	RFs iFileServer;
sl@0
  4092
	};
sl@0
  4093
sl@0
  4094
 
sl@0
  4095
/** The interface for mapping between twips and device-specific units enriched 
sl@0
  4096
with facilities to allow zooming. 
sl@0
  4097
sl@0
  4098
The class is recursive, because a TZoomFactor object can have a 
sl@0
  4099
MGraphicsDeviceMap (which could itself be a TZoomFactor) in its member data. 
sl@0
  4100
This allows a zoom factor object to contain another zoom factor object, and 
sl@0
  4101
is used to allow objects with different zoom factors to be embedded in each 
sl@0
  4102
other to an arbitrary depth by the application architecture. 
sl@0
  4103
@publishedAll
sl@0
  4104
@released
sl@0
  4105
*/
sl@0
  4106
class TZoomFactor : public MGraphicsDeviceMap
sl@0
  4107
	{
sl@0
  4108
public:
sl@0
  4109
	IMPORT_C TZoomFactor();
sl@0
  4110
	IMPORT_C ~TZoomFactor();
sl@0
  4111
	inline TZoomFactor(const MGraphicsDeviceMap* aDevice);
sl@0
  4112
	inline TZoomFactor(const TZoomFactor* aDevice);
sl@0
  4113
	IMPORT_C TInt ZoomFactor() const;
sl@0
  4114
	IMPORT_C void SetZoomFactor(TInt aZoomFactor);
sl@0
  4115
	inline void SetGraphicsDeviceMap(const MGraphicsDeviceMap* aDevice);
sl@0
  4116
	inline const MGraphicsDeviceMap* GraphicsDeviceMap() const;
sl@0
  4117
	IMPORT_C void SetTwipToPixelMapping(const TSize& aSizeInPixels,const TSize& aSizeInTwips);
sl@0
  4118
	IMPORT_C TInt HorizontalTwipsToPixels(TInt aTwipWidth) const;
sl@0
  4119
	IMPORT_C TInt VerticalTwipsToPixels(TInt aTwipHeight) const;
sl@0
  4120
	IMPORT_C TInt HorizontalPixelsToTwips(TInt aPixelWidth) const;
sl@0
  4121
	IMPORT_C TInt VerticalPixelsToTwips(TInt aPixelHeight) const;
sl@0
  4122
	IMPORT_C TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
sl@0
  4123
	IMPORT_C TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
sl@0
  4124
	IMPORT_C TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight);
sl@0
  4125
	IMPORT_C void ReleaseFont(CFont* aFont);
sl@0
  4126
public:
sl@0
  4127
sl@0
  4128
	/**  One to one zoom factor.  */
sl@0
  4129
	enum {EZoomOneToOne=1000};
sl@0
  4130
private:
sl@0
  4131
	TInt iZoomFactor;
sl@0
  4132
	const MGraphicsDeviceMap* iDevice;
sl@0
  4133
	};
sl@0
  4134
sl@0
  4135
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS	
sl@0
  4136
#include <graphics/gdi/gdistructs.h>
sl@0
  4137
#include <graphics/gdi/gdiinline.inl>
sl@0
  4138
#endif //SYMBIAN_ENABLE_SPLIT_HEADERS	
sl@0
  4139
sl@0
  4140
#include <gdi.inl>
sl@0
  4141
sl@0
  4142
#endif // __GDI_H__