sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\include\e32cons.h sl@0: // sl@0: // sl@0: sl@0: #ifndef __E32CONS_H__ sl@0: #define __E32CONS_H__ sl@0: #include sl@0: #include sl@0: // sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Defines a default console width that can be used when creating a console. sl@0: sl@0: @see CConsoleBase::Create() sl@0: */ sl@0: const TInt KDefaultConsWidth=78; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Defines a default console height that can be used when creating a console. sl@0: sl@0: @see CConsoleBase::Create() sl@0: */ sl@0: const TInt KDefaultConsHeight=18; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Implies a full size screen console when passed as the width and height sl@0: values when creating a console. sl@0: sl@0: @see CConsoleBase::Create() sl@0: */ sl@0: const TInt KConsFullScreen=-1; sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Defines a set of text attributes used for consoles that support colour. sl@0: sl@0: @see CColorConsoleBase::SetTextAttribute(). sl@0: */ sl@0: enum TTextAttribute sl@0: { sl@0: ETextAttributeNormal, /**< Defines the normal text attribute. */ sl@0: ETextAttributeBold, /**< Defines the bold text attribute. */ sl@0: ETextAttributeInverse, /**< Defines the inverse text attribute. */ sl@0: ETextAttributeHighlight/**< Defines the highlight text attribute.*/ sl@0: }; sl@0: sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: A base class that defines a console interface. sl@0: */ sl@0: class CConsoleBase : public CBase sl@0: { sl@0: public: sl@0: IMPORT_C virtual ~CConsoleBase(); sl@0: IMPORT_C TKeyCode Getch(); sl@0: IMPORT_C void Printf(TRefByValue aFmt,...); sl@0: IMPORT_C void SetPos(TInt aX); sl@0: IMPORT_C void SetPos(TInt aX,TInt aY); sl@0: IMPORT_C TInt WhereX() const; sl@0: IMPORT_C TInt WhereY() const; sl@0: // Pure virtual sl@0: sl@0: sl@0: /** sl@0: Creates a new console window. sl@0: sl@0: @param aTitle The title text for the console. sl@0: This should not be longer than 256 characters. sl@0: @param aSize The size of the console window. sl@0: sl@0: @return KErrNone, if successful; otherwise one of the other sl@0: system wide error codes. sl@0: */ sl@0: virtual TInt Create(const TDesC &aTitle,TSize aSize) =0; sl@0: sl@0: sl@0: /** sl@0: Gets a keystroke from the console window, asynchronously. sl@0: sl@0: @param aStatus The request status object. sl@0: */ sl@0: virtual void Read(TRequestStatus &aStatus) =0; sl@0: sl@0: sl@0: /** sl@0: Cancels any outstanding request to get a keystroke from the console window. sl@0: */ sl@0: virtual void ReadCancel() =0; sl@0: sl@0: sl@0: /** sl@0: Writes the content of the specified descriptor to the console window. sl@0: sl@0: @param aDes Descriptor containing the characters to be written to sl@0: the console window. sl@0: */ sl@0: virtual void Write(const TDesC &aDes) =0; sl@0: sl@0: sl@0: /** sl@0: Gets the current cursor position relative to the console window. sl@0: sl@0: @return The current cursor position. sl@0: */ sl@0: virtual TPoint CursorPos() const =0; sl@0: sl@0: sl@0: /** sl@0: Puts the cursor at the absolute position in the window. sl@0: sl@0: @param aPoint The cursor position. sl@0: */ sl@0: virtual void SetCursorPosAbs(const TPoint &aPoint) =0; sl@0: sl@0: sl@0: /** sl@0: Puts the cursor at the specified position relative sl@0: to the current cursor position. sl@0: sl@0: @param aPoint The cursor position. sl@0: */ sl@0: virtual void SetCursorPosRel(const TPoint &aPoint) =0; sl@0: sl@0: sl@0: /** sl@0: Sets the percentage height of the cursor. sl@0: sl@0: @param aPercentage The percentage height. This is a value from 0 to 100. sl@0: If 0 is specified, then no cursor is displayed. sl@0: */ sl@0: virtual void SetCursorHeight(TInt aPercentage) =0; sl@0: sl@0: sl@0: /** sl@0: Sets a new console title. sl@0: sl@0: @param aTitle The title text for the console. sl@0: This should not be longer than 256 characters. sl@0: */ sl@0: virtual void SetTitle(const TDesC &aTitle) =0; sl@0: sl@0: sl@0: /** sl@0: Clears the console. sl@0: */ sl@0: virtual void ClearScreen() =0; sl@0: sl@0: sl@0: /** sl@0: Clears the console from the current cursor position to sl@0: the end of the line. sl@0: */ sl@0: virtual void ClearToEndOfLine() =0; sl@0: sl@0: sl@0: /** sl@0: Gets the size of the console. sl@0: */ sl@0: virtual TSize ScreenSize() const =0; sl@0: sl@0: sl@0: /** sl@0: Gets the current key code value. sl@0: sl@0: @return The key code value. sl@0: */ sl@0: virtual TKeyCode KeyCode() const =0; sl@0: sl@0: /** sl@0: Gets the current key modifiers. sl@0: sl@0: @return The key modifiers. sl@0: */ sl@0: virtual TUint KeyModifiers() const =0; sl@0: protected: sl@0: IMPORT_C CConsoleBase(); sl@0: protected: sl@0: IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1); sl@0: }; sl@0: sl@0: sl@0: class CProxyConsole; sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: sl@0: Adds colour support to the basic console interface. sl@0: */ sl@0: class CColorConsoleBase : public CConsoleBase sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Sets the text attribute as defined by TTextAttribute. sl@0: sl@0: @param anAttribute The text attribute to be set. sl@0: */ sl@0: virtual void SetTextAttribute(TTextAttribute /*anAttribute*/); sl@0: protected: sl@0: IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1); sl@0: sl@0: friend class CProxyConsole; sl@0: }; sl@0: // sl@0: sl@0: /** sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: extern "C" { sl@0: IMPORT_C TAny *NewConsole(); sl@0: } sl@0: #endif sl@0: