epoc32/include/mw/eikconso.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#if !defined(__EIKCONSO_H__)
williamr@2
    20
#define __EIKCONSO_H__
williamr@2
    21
													   
williamr@2
    22
#if !defined(__E32CONS_H__)
williamr@2
    23
#include <e32cons.h>
williamr@2
    24
#endif
williamr@2
    25
williamr@2
    26
#if !defined(__EIKSBOBS_H__)
williamr@2
    27
#include <eiksbobs.h>
williamr@2
    28
#endif
williamr@2
    29
williamr@2
    30
#if !defined(__EIKSBFRM_H__)
williamr@2
    31
#include <eiksbfrm.h>
williamr@2
    32
#endif
williamr@2
    33
williamr@4
    34
#include <AknControl.h>
williamr@2
    35
williamr@2
    36
#define ATT_DOUBLEWIDTH					0x60
williamr@2
    37
#define ATT_DOUBLETOP	   			0x20	
williamr@2
    38
#define ATT_DOUBLEBOTTOM				0x40	
williamr@2
    39
////////////////////////////////////////////
williamr@2
    40
#define ATT_ITALIC						0x08	
williamr@2
    41
#define ATT_INVERSE 					0x04
williamr@2
    42
#define ATT_UNDERLINE					0x02
williamr@2
    43
#define ATT_BOLD						0x01
williamr@2
    44
////////////////////////////////////////////
williamr@2
    45
#define ATT_COLORMASK					0x80	// &x!=0 : color
williamr@2
    46
#define ATT_DOUBLEMASK					0x60 	// &x : only the bits relevant for doublewidth/doubleheight
williamr@2
    47
#define ATT_RIGHTMASK					0x10	// |x to set RIGHT indicator
williamr@2
    48
#define ATT_IGNORE_RIGHTLEFT			0xEF	// &x to clear the RIGHT/LEFT flag
williamr@2
    49
#define ATT_IGNORE_INVERSE				0xFB	// &x to clear the INVERSE flag
williamr@2
    50
////////////////////////////////////////////
williamr@2
    51
#define ATT_MAXVALUE					0xFF	// all flags set (maximum value of attribute byte)
williamr@2
    52
#define ATT_NORMAL						0		// the default character attribute
williamr@2
    53
williamr@2
    54
enum TEikConsWinUnits
williamr@2
    55
	{
williamr@2
    56
	EEikConsWinInPixels,
williamr@2
    57
	EEikConsWinInChars
williamr@2
    58
	};
williamr@2
    59
williamr@2
    60
williamr@2
    61
	/** CEikConsoleScreen()
williamr@2
    62
	
williamr@2
    63
	@param aBuffer         String that needs to be clipped. will be modified by this call
williamr@2
    64
	@param aFont           Font used in the code
williamr@2
    65
	@param aMaxWidthInPixels Maximum length of text that will not be clipped.
williamr@2
    66
	@param aDir            Where is the text clipped from. EDoNotClip, EClipFromEnd, EClipFromBeginning.
williamr@2
    67
	@param aClipWidth      The length of the text after clipping. KDefaultClipWidth will make it use aMaxWidthInPixels.
williamr@2
    68
	@param aClipString     The representation of three dots. (not really used anywhere - use the default value always or "")
williamr@2
    69
       
williamr@2
    70
	returns true if the text was clipped and 3 dots were added. 
williamr@2
    71
    */
williamr@2
    72
class CEikConsoleControl;
williamr@2
    73
class CEikConsoleScreen : public CConsoleBase
williamr@2
    74
	{
williamr@2
    75
public:
williamr@2
    76
	enum TEikConsoleFlags
williamr@2
    77
		{
williamr@2
    78
		EUseBackedUpWindow	=0x1,
williamr@2
    79
		ENoInitialCursor	=0x2
williamr@2
    80
		};
williamr@2
    81
public:
williamr@2
    82
	/** 
williamr@2
    83
     * CEikConsoleScreen() constructor 
williamr@2
    84
     */
williamr@2
    85
	IMPORT_C CEikConsoleScreen();
williamr@2
    86
	/** 
williamr@2
    87
     * CEikConsoleScreen() destructor
williamr@2
    88
     */
williamr@2
    89
	IMPORT_C ~CEikConsoleScreen();
williamr@2
    90
williamr@2
    91
	/** Create() Creates a console and sets title and size
williamr@2
    92
	 *
williamr@2
    93
	 * @param aTitle          Title of the console
williamr@2
    94
	 * @param aSize           Size of the console in pixels
williamr@2
    95
     *  
williamr@2
    96
	 * returns error code
williamr@2
    97
     */
williamr@2
    98
	IMPORT_C TInt Create(const TDesC& aTitle,TSize aSize);
williamr@2
    99
    /** Read()
williamr@2
   100
     * Not implemented
williamr@2
   101
     */
williamr@2
   102
	IMPORT_C void Read(TRequestStatus& aStatus);
williamr@2
   103
    /** ReadCancel()
williamr@2
   104
     * Not implemented
williamr@2
   105
     */
williamr@2
   106
	IMPORT_C void ReadCancel();
williamr@2
   107
    /** KeyCode()
williamr@2
   108
     * Not implemented
williamr@2
   109
     */
williamr@2
   110
	IMPORT_C TKeyCode KeyCode() const;
williamr@2
   111
    /** KeyModifiers()
williamr@2
   112
     * Not implemented
williamr@2
   113
     */
williamr@2
   114
	IMPORT_C TUint KeyModifiers() const;
williamr@2
   115
	/** ConstructL() Constructs a console and sets title
williamr@2
   116
	 *
williamr@2
   117
	 * @param aTitle          Title of the console
williamr@2
   118
	 * @param aFlags          Flags, for example EUseBackedUpWindow or ENoInitialCursor
williamr@2
   119
     */
williamr@2
   120
	IMPORT_C void ConstructL(const TDesC &aTitle,TInt aFlags);// use full screen 
williamr@2
   121
	/** ConstructL() Constructs a console and sets title and size
williamr@2
   122
	 *
williamr@2
   123
	 * @param aTitle          Title of the console
williamr@2
   124
     * @param aSize           Size of the console in pixels
williamr@2
   125
	 * @param aFlags          Flags, for example EUseBackedUpWindow or ENoInitialCursor
williamr@2
   126
	 * @param aUnit           Unit of the console
williamr@2
   127
     */
williamr@2
   128
	IMPORT_C void ConstructL(const TDesC &aTitle,const TSize &aSize,TInt aFlags,TEikConsWinUnits aUnit=EEikConsWinInChars); // place the screen at TPoint(0,0)
williamr@2
   129
	/** ConstructL() Constructs a console and sets title and position and size
williamr@2
   130
	 *
williamr@2
   131
	 * @param aTitle          Title of the console
williamr@2
   132
     * @param aTopLeft        TopLeft corner of the console window
williamr@2
   133
     * @param aSize           Size of the console in pixels
williamr@2
   134
	 * @param aFlags          Flags, for example EUseBackedUpWindow or ENoInitialCursor
williamr@2
   135
	 * @param aUnit           Unit of the console
williamr@2
   136
     */
williamr@2
   137
	IMPORT_C void ConstructL(const TDesC &aTitle,TPoint aTopLeft,const TSize &aSize,TInt aFlags,TEikConsWinUnits aUnit=EEikConsWinInChars); 
williamr@2
   138
	/** SetConsWin() Sets console window
williamr@2
   139
	 *
williamr@2
   140
	 * @param aConsWin          Console control
williamr@2
   141
     */
williamr@2
   142
	IMPORT_C void SetConsWin(CEikConsoleControl *aConsWin); // use if you don't want WHOLE screen
williamr@2
   143
	/** ConsoleControl() fetching console control
williamr@2
   144
	 *
williamr@2
   145
	 * Returns console control
williamr@2
   146
     */
williamr@2
   147
	inline CEikConsoleControl* ConsoleControl() const {return iConsoleControl;};
williamr@2
   148
williamr@2
   149
	/** SetTitle() Set title of the console
williamr@2
   150
	 *
williamr@2
   151
	 * @param aTitle          Title of the console
williamr@2
   152
     */
williamr@2
   153
	IMPORT_C void SetTitle(const TDesC &aTitle);
williamr@2
   154
	/** SetTitle() Set title of the console
williamr@2
   155
	 *
williamr@2
   156
	 * @param aTitle          Title of the console
williamr@2
   157
     */
williamr@2
   158
	IMPORT_C void SetTitleL(const TDesC &aTitle);
williamr@2
   159
	/** Title() Gets title of the console
williamr@2
   160
	 *
williamr@2
   161
	 * returns Title of the console
williamr@2
   162
     */
williamr@2
   163
	inline HBufC *Title() const {return iConsoleTitle;};
williamr@2
   164
	
williamr@2
   165
	/** ScreenSize() Gets size of the screen
williamr@2
   166
	 *
williamr@2
   167
	 * returns Size of the screen in pixels
williamr@2
   168
     */
williamr@2
   169
	IMPORT_C TSize ScreenSize() const;
williamr@2
   170
	/** FlushChars() Updates the character buffers
williamr@2
   171
	 */
williamr@2
   172
	IMPORT_C void FlushChars(); //new
williamr@2
   173
	/** CursorPos() Cursor position getter
williamr@2
   174
     *  returns cursor position
williamr@2
   175
	 */
williamr@2
   176
	IMPORT_C TPoint CursorPos() const;
williamr@2
   177
	/** SetCursorPosAbs Moving cursor to absolute position
williamr@2
   178
     *
williamr@2
   179
     * @param aPoint Position in absolute coordinates
williamr@2
   180
	 */
williamr@2
   181
	IMPORT_C void SetCursorPosAbs(const TPoint &aPoint);		
williamr@2
   182
	/** SetCursorPosRel Moving cursor to relative position
williamr@2
   183
     *
williamr@2
   184
     * @param aPoint Position in relative coordinates
williamr@2
   185
	 */
williamr@2
   186
	IMPORT_C void SetCursorPosRel(const TPoint &aPoint);		
williamr@2
   187
	/** SetCursorHeight changes cursor height
williamr@2
   188
     *
williamr@2
   189
     * @param aPercentage Cursor height relative to character height
williamr@2
   190
	 */
williamr@2
   191
	IMPORT_C void SetCursorHeight(TInt aPercentage);		
williamr@2
   192
	/** Write() Writes text to the console
williamr@2
   193
     *
williamr@2
   194
     * @param aDes Text to be written to the console
williamr@2
   195
	 */
williamr@2
   196
	IMPORT_C void Write(const TDesC &aDes);				   		
williamr@2
   197
	/** ClearScreen() Clears the console screen
williamr@2
   198
	 * 
williamr@2
   199
	 */
williamr@2
   200
	IMPORT_C void ClearScreen();				
williamr@2
   201
	/** ClearToEndOfLine() Clears from cursor position to end of the line
williamr@2
   202
	 * 
williamr@2
   203
	 */
williamr@2
   204
	IMPORT_C void ClearToEndOfLine();		
williamr@2
   205
	/** ClearChars() Clears characters within rectangle matching attributes
williamr@2
   206
     *
williamr@2
   207
     * @param aRect Rectangle in pixels
williamr@2
   208
     * @param aCharacterAttributes Matching character attributes
williamr@2
   209
	 */
williamr@2
   210
	IMPORT_C void ClearChars(const TRect &aRect,TUint aCharacterAttributes);	
williamr@2
   211
	/** HideCursor() Hides cursor
williamr@2
   212
	 *
williamr@2
   213
	 * @return nonzero if cursor was not visible
williamr@2
   214
	 */
williamr@2
   215
	IMPORT_C TInt HideCursor(); // returns nonzero if cursor wasn't visible
williamr@2
   216
	/** DrawCursor() Draws cursor
williamr@2
   217
	 */
williamr@2
   218
	IMPORT_C void DrawCursor(); 
williamr@2
   219
	/** DrawInSight Moves topleft corner
williamr@2
   220
	 *
williamr@2
   221
	 * @param aPosition New position for insight
williamr@2
   222
	 */
williamr@2
   223
	IMPORT_C void DrawInSight(TPoint aPosition);
williamr@2
   224
	/** DrawCursorInSight() Draws cursor and insight
williamr@2
   225
	 */
williamr@2
   226
	IMPORT_C void DrawCursorInSight();
williamr@2
   227
williamr@2
   228
	/** Move cursor up
williamr@2
   229
	 * @param aCount Number of steps to move
williamr@2
   230
	 */	
williamr@2
   231
	IMPORT_C void Up(TUint aCount=1);		
williamr@2
   232
	/** Move cursor down
williamr@2
   233
	 * @param aCount Number of steps to move
williamr@2
   234
	 */	
williamr@2
   235
	IMPORT_C void Down(TUint aCount=1);	
williamr@2
   236
	/** Move cursor right
williamr@2
   237
	 * @param aCount Number of steps to move
williamr@2
   238
	 */	
williamr@2
   239
	IMPORT_C void Right(TUint aCount=1);	
williamr@2
   240
	/** Move cursor left
williamr@2
   241
	 * @param aCount Number of steps to move
williamr@2
   242
	 */	
williamr@2
   243
	IMPORT_C void Left(TUint aCount=1);	
williamr@2
   244
	/** Insert a CR
williamr@2
   245
	 */
williamr@2
   246
	IMPORT_C void Cr();							
williamr@2
   247
	/** Insert a linefeed
williamr@2
   248
	 */
williamr@2
   249
	IMPORT_C void Lf();							
williamr@2
   250
	/** Scroll characters
williamr@2
   251
	 * @param anArea Area to scroll
williamr@2
   252
	 * @param aVector How much to scroll
williamr@2
   253
	 */
williamr@2
   254
	IMPORT_C void ScrollChars(const TRect &anArea,const TPoint &aVector);
williamr@2
   255
williamr@2
   256
    /** Redraw a rectangle
williamr@2
   257
	 * @param aRect Rectangle to redraw
williamr@2
   258
     */
williamr@2
   259
	IMPORT_C void Redraw(const TRect &aRect);	// called by CEikConsoleControl
williamr@2
   260
    /** Moves topleft
williamr@2
   261
     * @param aVector new position of topleft
williamr@2
   262
     */
williamr@2
   263
	IMPORT_C void MoveTopLeft(TPoint aVector);	// called by CEikConsoleControl
williamr@2
   264
williamr@2
   265
    /** Size of the history
williamr@2
   266
     * @return lines stored for history buffer
williamr@2
   267
     */
williamr@2
   268
	inline TUint HistorySize() const {return iNoChrExtra;}; // lines ACTUALLY stored				
williamr@2
   269
    /** Set history buffer size
williamr@2
   270
     * @param aMaxChrExtra lines allocated for history
williamr@2
   271
     * @param aMaxAttExtra attributed lines allocated for history
williamr@2
   272
     */
williamr@2
   273
	IMPORT_C void SetHistorySizeL(TUint aMaxChrExtra,TUint aMaxAttExtra);  // lines of back-scroll history resp. lines of ATTRIBUTED backscroll history (aMaxAttExtra<=aMaxChrExtra)
williamr@2
   274
		
williamr@2
   275
    /** Att() Attributes
williamr@2
   276
     * @returns attributes
williamr@2
   277
     */
williamr@2
   278
	inline TUint Att() const {return iAtt;};
williamr@2
   279
	
williamr@2
   280
	/** Set attributes
williamr@2
   281
     * @param aCharacterAttributes Attributes for characters
williamr@2
   282
	 */
williamr@2
   283
	IMPORT_C void SetAtt(TUint aCharacterAttributes);		
williamr@2
   284
	/** Set attributes
williamr@2
   285
     * @param aForegroundGray16 Grey16 attributes for foreground
williamr@2
   286
     * @param aBackgroundGray16 Grey16 attribuets for background
williamr@2
   287
	 */
williamr@2
   288
	IMPORT_C void SetAtt(TUint aForegroundGray16,TUint aBackgroundGray16); 
williamr@2
   289
williamr@2
   290
    /** SetFontL() Sets the font for console
williamr@2
   291
     * @param aFontDesc font specification
williamr@2
   292
     */
williamr@2
   293
	IMPORT_C void SetFontL(const TFontSpec &aFontDesc);	
williamr@2
   294
	/** Font() Gets the used font
williamr@2
   295
	 * @returns font specification
williamr@2
   296
	 */
williamr@2
   297
	IMPORT_C const TFontSpec& Font() const;
williamr@2
   298
williamr@2
   299
	/** SetSelection() Sets the selection position
williamr@2
   300
     * @param aRange range of the selection
williamr@2
   301
	 */
williamr@2
   302
	IMPORT_C void SetSelection(const TRect &aRange); 
williamr@2
   303
    /** SelectCursor() Sets empty selection starting and ending at cursor position
williamr@2
   304
     */
williamr@2
   305
	IMPORT_C void SelectCursor(); // empty selection starting and ending at cursor position
williamr@2
   306
    /** Selection() Get selection position
williamr@2
   307
     * @return selection position
williamr@2
   308
     */
williamr@2
   309
	IMPORT_C TRect Selection();
williamr@2
   310
    /** RetrieveL() returns selected text
williamr@2
   311
     * @param aRange selection
williamr@2
   312
     * @return text in descriptor
williamr@2
   313
     */
williamr@2
   314
	IMPORT_C HBufC *RetrieveL(const TRect &aRange);	// returns selection in newly allocated buffer
williamr@2
   315
	
williamr@2
   316
	/** SetPureCRLF() sets pure flag
williamr@2
   317
     * @param aFlag flags
williamr@2
   318
	 */
williamr@2
   319
	IMPORT_C void SetPureCRLF(TUint aFlag);
williamr@2
   320
	/** SetAllPrintable() sets all printable flag
williamr@2
   321
     * @param aFlag flags
williamr@2
   322
	 */
williamr@2
   323
	IMPORT_C void SetAllPrintable(TUint aFlag);
williamr@2
   324
	/** SetScrollLock() sets scroll lock flag
williamr@2
   325
     * @param aFlag flags
williamr@2
   326
	 */
williamr@2
   327
	IMPORT_C void SetScrollLock(TUint aFlag);
williamr@2
   328
	/** SetKeepCursorInSight() sets cursor in sight flag
williamr@2
   329
     * @param aFlag flags
williamr@2
   330
	 */
williamr@2
   331
	IMPORT_C void SetKeepCursorInSight(TUint aFlag);
williamr@2
   332
	/** SetScrollBarVisibilityL() sets scrollbar visibility
williamr@2
   333
     * @param aHBarVisibility horizontal scrollbar visibility
williamr@2
   334
     * @param aVBarVisibility vertical scrollbar visibility
williamr@2
   335
	 */
williamr@2
   336
	IMPORT_C void SetScrollBarVisibilityL(CEikScrollBarFrame::TScrollBarVisibility aHBarVisibility, CEikScrollBarFrame::TScrollBarVisibility aVBarVisibility);
williamr@2
   337
	/** UpdateScrollBars() updates scrollbars
williamr@2
   338
	 * 
williamr@2
   339
	 */
williamr@2
   340
	IMPORT_C TBool UpdateScrollBars();
williamr@2
   341
williamr@2
   342
private:
williamr@2
   343
	// high-level history manipulation
williamr@2
   344
	void MemScrPut(const TDesC &aString,TPoint aPos,TUint8 aCharacterAttributes);
williamr@2
   345
	void MemScrClr(const TRect &aRect,TUint8 aCharacterAttributes);
williamr@2
   346
	void MemScrScrollUp(TUint aLines=1);
williamr@2
   347
	void MemScrMove(TPoint anOldPt,TPoint aNewPt,TUint aLen);
williamr@2
   348
	void MemScrScroll(const TRect &aRect,TPoint aVector);
williamr@2
   349
	// low-level history access
williamr@2
   350
	TPtr	MemChrPtr(TPoint aPos,TUint aLen);
williamr@2
   351
	TPtr8	MemAttPtr(TPoint aPos,TUint aLen);
williamr@2
   352
	// console screen-to-visible window conversion
williamr@2
   353
	TPoint 	ScrToVis(TPoint aPoint);
williamr@2
   354
	TRect 	ScrToVis(const TRect &aRect);
williamr@2
   355
	// recalculates iVisSize and iVisWin
williamr@2
   356
	TBool RecalculateSize();	
williamr@2
   357
	// calculate a TopLeft that would put aPosition in-sight
williamr@2
   358
	TPoint GetAnInSightPosition(TPoint aPosition) const;
williamr@2
   359
	// draw cursor or draw cursor in sight, depending on iKeepCursorInSight
williamr@2
   360
	void DrawCursorWhereNeeded();
williamr@2
   361
	// smart cursor-clipping: clips cursor to within screen, but allows it to be past the last character
williamr@2
   362
	void ClipCursor();
williamr@2
   363
	// redraw characters with doublewidth LEFT/RIGHT flag set depending on odd/even columns
williamr@2
   364
	void RedrawChars(TInt anX,TInt anY,TInt aLength,TUint aCharacterAttributes);
williamr@2
   365
	// routines needed for selection
williamr@2
   366
	void InvertOverlap(TPoint aStart,TPoint aEnd,TPoint bStart,TPoint bEnd);
williamr@2
   367
	void InvertRange(const TRect &aRect);
williamr@2
   368
williamr@2
   369
private:
williamr@2
   370
	CEikConsoleControl *iConsoleControl;// console window (handles redraw events)
williamr@2
   371
	TSize iConsoleSize; 		// size of console in characters (e.g. 80x24)	
williamr@2
   372
	HBufC *iConsoleTitle;		// console title
williamr@2
   373
	TRect iSelection; 			// current selection
williamr@2
   374
	TPoint iCursor;				// current cursor position
williamr@2
   375
	TUint iAtt;					// current character attribute
williamr@2
   376
williamr@2
   377
	TInt iWriteNow;				// if FALSE, Write()-calls can be buffered
williamr@2
   378
	TBuf<256> iWriteBuffer;		// the Write() buffer
williamr@2
   379
williamr@2
   380
	TInt	iMaxChrExtra;		// max nr of extra lines of characters stored
williamr@2
   381
	TInt	iNoChrExtra;		// actual nr of extra lines of characters stored
williamr@2
   382
	TInt	iMaxAttExtra;		// max nr of extra lines of character attributes stored
williamr@2
   383
	TText	*iChrBuf;			// character history
williamr@2
   384
	TUint8	*iAttBuf;			// attribute history
williamr@2
   385
williamr@2
   386
	TPoint	iTopLeft;			// coordinates of top left corner of visual display
williamr@2
   387
	TRect iVisWin;				// RECT visible window
williamr@2
   388
	TSize iVisSize;				// SIZE visible window
williamr@2
   389
williamr@2
   390
	// settings
williamr@2
   391
	TUint iPureCRLF;			// FALSE by default. If TRUE, CR and LF are "pure"
williamr@2
   392
	TUint iAllPrintable;		// FALSE by default. If TRUE, even chars 0-31 are printed
williamr@2
   393
	TUint iScrollLock;			// FALSE by default. If TRUE, will not scroll at bottom line
williamr@2
   394
	TUint iKeepCursorInSight;	// TRUE by default. If FALSE, cursor may be offscreen after a Write()
williamr@2
   395
	TUint iCursorBlinking; 		// TRUE if cursor should be visible (i.e. user WANTS it to be visible)
williamr@2
   396
williamr@2
   397
	TInt iConsFlags;
williamr@2
   398
	};
williamr@2
   399
williamr@2
   400
class CEikConsoleControl : public CAknControl, public MEikScrollBarObserver
williamr@2
   401
	{
williamr@2
   402
public:	
williamr@2
   403
	// constructors, destructors, initialization
williamr@2
   404
    /** Constructor
williamr@2
   405
     */
williamr@2
   406
	IMPORT_C CEikConsoleControl();
williamr@2
   407
	/** Destructor
williamr@2
   408
	 */
williamr@2
   409
	IMPORT_C ~CEikConsoleControl();
williamr@2
   410
    /* ConstructL()
williamr@2
   411
     */
williamr@2
   412
	IMPORT_C void	ConstructL(TInt aFlags);
williamr@2
   413
    /* ConstructL()
williamr@2
   414
     */
williamr@2
   415
	IMPORT_C void	ConstructL(TPoint aTopLeft,const TSize &aSize,TInt aFlags,TEikConsWinUnits aUnit);
williamr@2
   416
    /** SetRedrawer
williamr@2
   417
     * @param aConsole console screen
williamr@2
   418
     */
williamr@2
   419
	IMPORT_C void 	SetRedrawer(CEikConsoleScreen *aConsole);
williamr@2
   420
williamr@2
   421
	// font stuff
williamr@2
   422
	/** SetFontL() sets the console font
williamr@2
   423
	 * @param aFontSpec font specification
williamr@2
   424
	 * @param aFont font instance
williamr@2
   425
	 */
williamr@2
   426
	IMPORT_C void	SetFontL(const TFontSpec &aFontSpec,const CFbsFont* aFont);		// change to font aFontSpec
williamr@2
   427
	/** Font() gets font specification
williamr@2
   428
	 */
williamr@2
   429
	inline const TFontSpec& Font() const {return iFontSpec;};	// returns current fontspec
williamr@2
   430
williamr@2
   431
	/** CharSize() gets character size
williamr@2
   432
	 */
williamr@2
   433
	inline const TSize& CharSize() const {return iCharSize;};	
williamr@2
   434
    /** VisibibleSize() gets visible size
williamr@2
   435
     *
williamr@2
   436
     */
williamr@2
   437
	IMPORT_C TSize	VisibleSize() const;						// returns maximal visible nr of visible characters
williamr@2
   438
williamr@2
   439
	// cursor stuff
williamr@2
   440
	/** SetCursorHeight() Sets cursor height
williamr@2
   441
     * @param aPercentage value 0..100%
williamr@2
   442
	 */
williamr@2
   443
	IMPORT_C void	SetCursorHeight(TUint aPercentage);	// set cursor height (0-100%)
williamr@2
   444
    /** DrawCursor Draws cursor at position
williamr@2
   445
     * @param aPosition position
williamr@2
   446
     */
williamr@2
   447
	IMPORT_C void	DrawCursor(TPoint aPosition);		// draw cursor at character position
williamr@2
   448
    /** HideCursor hides cursor
williamr@2
   449
     */
williamr@2
   450
	IMPORT_C void	HideCursor();						// hide cursor
williamr@2
   451
williamr@2
   452
	// basic graphic functions
williamr@2
   453
	/** DrawChars() draws characters
williamr@2
   454
     * @param aString string to be drawn
williamr@2
   455
     * @param aPosition position of the string
williamr@2
   456
     * @param aCharacterAttributes attributes of the drawn string
williamr@2
   457
	 */
williamr@2
   458
	IMPORT_C void	DrawChars(const TDesC &aString,const TPoint &aPosition,TUint aCharacterAttributes);	// draw aString at character position aPosition using
williamr@2
   459
    /** ClearChars() clears characters
williamr@2
   460
     * @param anArea area to be cleared
williamr@2
   461
     * @param aCharacterAttributes attributes of cleared characters
williamr@2
   462
     */
williamr@2
   463
	IMPORT_C void	ClearChars(const TRect &anArea,TUint aCharacterAttributes);	// clear the character area
williamr@2
   464
    /** InsertChars() inserts character area
williamr@2
   465
     * @param anArea area to be inserted
williamr@2
   466
     */
williamr@2
   467
	IMPORT_C void	InvertChars(const TRect &anArea);	// invert the character area
williamr@2
   468
    /** ScrollChars scrolls character area
williamr@2
   469
     * @param anArea area to be scrolled
williamr@2
   470
     * @param aVector direction to be scrolled
williamr@2
   471
     */
williamr@2
   472
	IMPORT_C void	ScrollChars(const TRect &anArea,const TPoint &aVector);	// scroll characters inside anArea by the given vector
williamr@2
   473
williamr@2
   474
	// scrollbar stuff
williamr@2
   475
    /** sets scrollbar visibility
williamr@2
   476
     * @param aHBarVisibility horizontal scrollbar visibility
williamr@2
   477
     * @param aVBarVisibility vertical scrollbar visibility
williamr@2
   478
     */    
williamr@2
   479
	IMPORT_C TInt	SetScrollBarVisibilityL(CEikScrollBarFrame::TScrollBarVisibility aHBarVisibility, CEikScrollBarFrame::TScrollBarVisibility aVBarVisibility);
williamr@2
   480
    /** Updates scrollbar
williamr@2
   481
     * @param aDataSize size of the data
williamr@2
   482
     * @param aVisibleSize how much of the data is visible on the console
williamr@2
   483
     * @param aPos position of the visible area relative to whole data
williamr@2
   484
     * @return ETrue if as a result, the visible window has changed
williamr@2
   485
     */
williamr@2
   486
	IMPORT_C TBool	UpdateScrollbarsL(const TSize &aDataSize,const TSize& aVisibleSize,TPoint aPos);
williamr@2
   487
    /** Handles scroll event
williamr@2
   488
     * @param aScrollBar scrollbar to be used for the event
williamr@2
   489
     * @param aEventType type of the event that happened
williamr@2
   490
     */
williamr@2
   491
	IMPORT_C void	HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType);
williamr@2
   492
    /** Updates an area
williamr@2
   493
     */
williamr@2
   494
	IMPORT_C void	UpdateArea();
williamr@2
   495
williamr@2
   496
public:	// from CCoeControl
williamr@2
   497
	/** GetColorUseListL provides color use list for the control
williamr@2
   498
	 */
williamr@2
   499
	IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u
williamr@2
   500
    /** HandleResourceChange handles several kinds of resource change events
williamr@2
   501
     */
williamr@2
   502
	IMPORT_C virtual void HandleResourceChange(TInt aType);			// not available before Release 005u
williamr@2
   503
    /** HandlePointerEventL handles touch pointer events
williamr@2
   504
     */
williamr@2
   505
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   506
williamr@2
   507
protected:	// virtual
williamr@2
   508
	// window stuff
williamr@2
   509
    /** Draws the control
williamr@2
   510
     */
williamr@2
   511
	IMPORT_C void	Draw(const TRect& aRect) const;	
williamr@2
   512
    /** Size has changed
williamr@2
   513
     */
williamr@2
   514
	IMPORT_C void	SizeChanged();
williamr@2
   515
    /** Focus has changed
williamr@2
   516
     */
williamr@2
   517
	IMPORT_C void FocusChanged(TDrawNow aDrawNow);
williamr@2
   518
    /** Component controls count
williamr@2
   519
     */
williamr@2
   520
	IMPORT_C virtual TInt CountComponentControls() const;
williamr@2
   521
    /** Component controls
williamr@2
   522
     */
williamr@2
   523
	IMPORT_C virtual CCoeControl* ComponentControl(TInt aIndex) const;
williamr@2
   524
    /** Writes internal state
williamr@2
   525
     */
williamr@2
   526
	IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
williamr@2
   527
williamr@2
   528
private:  // virtual - Reserved from CCoeControl
williamr@2
   529
	IMPORT_C virtual void Reserved_2();
williamr@2
   530
williamr@2
   531
private:
williamr@2
   532
    /**
williamr@2
   533
    * From CAknControl
williamr@2
   534
    */
williamr@2
   535
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   536
williamr@2
   537
private:
williamr@2
   538
	TPoint	CharsToPixels(TPoint aPoint);
williamr@2
   539
	TRect	CharsToPixels(const TRect &aRect);
williamr@2
   540
	TRect	PixelsToChars(const TRect &aRect);
williamr@2
   541
	void	ClearPixels(const TRect &anArea,TRgb aColor) const;
williamr@2
   542
williamr@2
   543
	void 	NextFontL(); 			
williamr@2
   544
	void	InterpretAttribute(TUint AnAtt);
williamr@2
   545
	void	InterpretColorBits(TUint aCharacterAttributes);
williamr@2
   546
	inline 	CEikConsoleControl &M() const {return((CEikConsoleControl&)(*this));}
williamr@2
   547
 	void CreateScrollBarFrameLayout(TEikScrollBarFrameLayout& aLayout) const;
williamr@2
   548
	void	InitFontSpecL();
williamr@2
   549
williamr@2
   550
private:
williamr@2
   551
	CEikConsoleScreen *iConsole;	// the console that owns this window
williamr@2
   552
	TRgb iBackGray16;				// current background color 
williamr@2
   553
	TRgb iPenGray16;				// current pen color for characters
williamr@2
   554
	TUint iLastAtt;					// last attribute, to see if we need to change the gc
williamr@2
   555
	TUint iLastFontFlags;			// last attribute, to see if we need to load another font
williamr@2
   556
williamr@2
   557
	TSize iCharSize;				// size of a single character (in pixels)
williamr@2
   558
	TSize iViewInPixels;			// size of area available for characters (in pixels)
williamr@2
   559
	TSize iViewInChars;				// size of area available for characters (in characters)
williamr@2
   560
williamr@2
   561
	TTextCursor iTextCursor;		// cursor to use
williamr@2
   562
	TUint iCursorHeightPercentage;	// required height of cursor (as a percentage)
williamr@2
   563
williamr@2
   564
	TInt iRedrawing;				// NONZERO IF BUSY REDRAWING
williamr@2
   565
	
williamr@2
   566
	CEikScrollBarFrame* iSBFrame;
williamr@2
   567
	CEikScrollBarFrame::TScrollBarVisibility	iHBarVisibility;
williamr@2
   568
	CEikScrollBarFrame::TScrollBarVisibility	iVBarVisibility;
williamr@2
   569
	TPoint	iLastThumbPos;
williamr@2
   570
williamr@2
   571
	const CFont *iCurrentFont;		// Current font
williamr@2
   572
	TFontSpec iFontSpec;			// Current font spec
williamr@2
   573
	TFontUnderline iFontUnderline;	// Current font spec underline
williamr@2
   574
	TUint iFontHeight;				// Height of current font when not doubleheight/doublewidth
williamr@2
   575
	TUint iFontIsProportional; 		// nonzero if font is proportional
williamr@2
   576
	};
williamr@2
   577
williamr@2
   578
williamr@2
   579
williamr@2
   580
#endif