1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\include\e32cons.h
28 Defines a default console width that can be used when creating a console.
30 @see CConsoleBase::Create()
32 const TInt KDefaultConsWidth=78;
38 Defines a default console height that can be used when creating a console.
40 @see CConsoleBase::Create()
42 const TInt KDefaultConsHeight=18;
48 Implies a full size screen console when passed as the width and height
49 values when creating a console.
51 @see CConsoleBase::Create()
53 const TInt KConsFullScreen=-1;
60 Defines a set of text attributes used for consoles that support colour.
62 @see CColorConsoleBase::SetTextAttribute().
66 ETextAttributeNormal, /**< Defines the normal text attribute. */
67 ETextAttributeBold, /**< Defines the bold text attribute. */
68 ETextAttributeInverse, /**< Defines the inverse text attribute. */
69 ETextAttributeHighlight/**< Defines the highlight text attribute.*/
77 A base class that defines a console interface.
79 class CConsoleBase : public CBase
82 IMPORT_C virtual ~CConsoleBase();
83 IMPORT_C TKeyCode Getch();
84 IMPORT_C void Printf(TRefByValue<const TDesC> aFmt,...);
85 IMPORT_C void SetPos(TInt aX);
86 IMPORT_C void SetPos(TInt aX,TInt aY);
87 IMPORT_C TInt WhereX() const;
88 IMPORT_C TInt WhereY() const;
93 Creates a new console window.
95 @param aTitle The title text for the console.
96 This should not be longer than 256 characters.
97 @param aSize The size of the console window.
99 @return KErrNone, if successful; otherwise one of the other
100 system wide error codes.
102 virtual TInt Create(const TDesC &aTitle,TSize aSize) =0;
106 Gets a keystroke from the console window, asynchronously.
108 @param aStatus The request status object.
110 virtual void Read(TRequestStatus &aStatus) =0;
114 Cancels any outstanding request to get a keystroke from the console window.
116 virtual void ReadCancel() =0;
120 Writes the content of the specified descriptor to the console window.
122 @param aDes Descriptor containing the characters to be written to
125 virtual void Write(const TDesC &aDes) =0;
129 Gets the current cursor position relative to the console window.
131 @return The current cursor position.
133 virtual TPoint CursorPos() const =0;
137 Puts the cursor at the absolute position in the window.
139 @param aPoint The cursor position.
141 virtual void SetCursorPosAbs(const TPoint &aPoint) =0;
145 Puts the cursor at the specified position relative
146 to the current cursor position.
148 @param aPoint The cursor position.
150 virtual void SetCursorPosRel(const TPoint &aPoint) =0;
154 Sets the percentage height of the cursor.
156 @param aPercentage The percentage height. This is a value from 0 to 100.
157 If 0 is specified, then no cursor is displayed.
159 virtual void SetCursorHeight(TInt aPercentage) =0;
163 Sets a new console title.
165 @param aTitle The title text for the console.
166 This should not be longer than 256 characters.
168 virtual void SetTitle(const TDesC &aTitle) =0;
174 virtual void ClearScreen() =0;
178 Clears the console from the current cursor position to
181 virtual void ClearToEndOfLine() =0;
185 Gets the size of the console.
187 virtual TSize ScreenSize() const =0;
191 Gets the current key code value.
193 @return The key code value.
195 virtual TKeyCode KeyCode() const =0;
198 Gets the current key modifiers.
200 @return The key modifiers.
202 virtual TUint KeyModifiers() const =0;
204 IMPORT_C CConsoleBase();
206 IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
216 Adds colour support to the basic console interface.
218 class CColorConsoleBase : public CConsoleBase
223 Sets the text attribute as defined by TTextAttribute.
225 @param anAttribute The text attribute to be set.
227 virtual void SetTextAttribute(TTextAttribute /*anAttribute*/);
229 IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
231 friend class CProxyConsole;
240 IMPORT_C TAny *NewConsole();