1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/include/e32cons.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,243 @@
1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32\include\e32cons.h
1.18 +//
1.19 +//
1.20 +
1.21 +#ifndef __E32CONS_H__
1.22 +#define __E32CONS_H__
1.23 +#include <e32base.h>
1.24 +#include <e32keys.h>
1.25 +//
1.26 +
1.27 +/**
1.28 +@publishedAll
1.29 +@released
1.30 +
1.31 +Defines a default console width that can be used when creating a console.
1.32 +
1.33 +@see CConsoleBase::Create()
1.34 +*/
1.35 +const TInt KDefaultConsWidth=78;
1.36 +
1.37 +/**
1.38 +@publishedAll
1.39 +@released
1.40 +
1.41 +Defines a default console height that can be used when creating a console.
1.42 +
1.43 +@see CConsoleBase::Create()
1.44 +*/
1.45 +const TInt KDefaultConsHeight=18;
1.46 +
1.47 +/**
1.48 +@publishedAll
1.49 +@released
1.50 +
1.51 +Implies a full size screen console when passed as the width and height
1.52 +values when creating a console.
1.53 +
1.54 +@see CConsoleBase::Create()
1.55 +*/
1.56 +const TInt KConsFullScreen=-1;
1.57 +
1.58 +
1.59 +/**
1.60 +@publishedAll
1.61 +@released
1.62 +
1.63 +Defines a set of text attributes used for consoles that support colour.
1.64 +
1.65 +@see CColorConsoleBase::SetTextAttribute().
1.66 +*/
1.67 +enum TTextAttribute
1.68 + {
1.69 + ETextAttributeNormal, /**< Defines the normal text attribute. */
1.70 + ETextAttributeBold, /**< Defines the bold text attribute. */
1.71 + ETextAttributeInverse, /**< Defines the inverse text attribute. */
1.72 + ETextAttributeHighlight/**< Defines the highlight text attribute.*/
1.73 + };
1.74 +
1.75 +
1.76 +/**
1.77 +@publishedAll
1.78 +@released
1.79 +
1.80 +A base class that defines a console interface.
1.81 +*/
1.82 +class CConsoleBase : public CBase
1.83 + {
1.84 +public:
1.85 + IMPORT_C virtual ~CConsoleBase();
1.86 + IMPORT_C TKeyCode Getch();
1.87 + IMPORT_C void Printf(TRefByValue<const TDesC> aFmt,...);
1.88 + IMPORT_C void SetPos(TInt aX);
1.89 + IMPORT_C void SetPos(TInt aX,TInt aY);
1.90 + IMPORT_C TInt WhereX() const;
1.91 + IMPORT_C TInt WhereY() const;
1.92 +// Pure virtual
1.93 +
1.94 +
1.95 + /**
1.96 + Creates a new console window.
1.97 +
1.98 + @param aTitle The title text for the console.
1.99 + This should not be longer than 256 characters.
1.100 + @param aSize The size of the console window.
1.101 +
1.102 + @return KErrNone, if successful; otherwise one of the other
1.103 + system wide error codes.
1.104 + */
1.105 + virtual TInt Create(const TDesC &aTitle,TSize aSize) =0;
1.106 +
1.107 +
1.108 + /**
1.109 + Gets a keystroke from the console window, asynchronously.
1.110 +
1.111 + @param aStatus The request status object.
1.112 + */
1.113 + virtual void Read(TRequestStatus &aStatus) =0;
1.114 +
1.115 +
1.116 + /**
1.117 + Cancels any outstanding request to get a keystroke from the console window.
1.118 + */
1.119 + virtual void ReadCancel() =0;
1.120 +
1.121 +
1.122 + /**
1.123 + Writes the content of the specified descriptor to the console window.
1.124 +
1.125 + @param aDes Descriptor containing the characters to be written to
1.126 + the console window.
1.127 + */
1.128 + virtual void Write(const TDesC &aDes) =0;
1.129 +
1.130 +
1.131 + /**
1.132 + Gets the current cursor position relative to the console window.
1.133 +
1.134 + @return The current cursor position.
1.135 + */
1.136 + virtual TPoint CursorPos() const =0;
1.137 +
1.138 +
1.139 + /**
1.140 + Puts the cursor at the absolute position in the window.
1.141 +
1.142 + @param aPoint The cursor position.
1.143 + */
1.144 + virtual void SetCursorPosAbs(const TPoint &aPoint) =0;
1.145 +
1.146 +
1.147 + /**
1.148 + Puts the cursor at the specified position relative
1.149 + to the current cursor position.
1.150 +
1.151 + @param aPoint The cursor position.
1.152 + */
1.153 + virtual void SetCursorPosRel(const TPoint &aPoint) =0;
1.154 +
1.155 +
1.156 + /**
1.157 + Sets the percentage height of the cursor.
1.158 +
1.159 + @param aPercentage The percentage height. This is a value from 0 to 100.
1.160 + If 0 is specified, then no cursor is displayed.
1.161 + */
1.162 + virtual void SetCursorHeight(TInt aPercentage) =0;
1.163 +
1.164 +
1.165 + /**
1.166 + Sets a new console title.
1.167 +
1.168 + @param aTitle The title text for the console.
1.169 + This should not be longer than 256 characters.
1.170 + */
1.171 + virtual void SetTitle(const TDesC &aTitle) =0;
1.172 +
1.173 +
1.174 + /**
1.175 + Clears the console.
1.176 + */
1.177 + virtual void ClearScreen() =0;
1.178 +
1.179 +
1.180 + /**
1.181 + Clears the console from the current cursor position to
1.182 + the end of the line.
1.183 + */
1.184 + virtual void ClearToEndOfLine() =0;
1.185 +
1.186 +
1.187 + /**
1.188 + Gets the size of the console.
1.189 + */
1.190 + virtual TSize ScreenSize() const =0;
1.191 +
1.192 +
1.193 + /**
1.194 + Gets the current key code value.
1.195 +
1.196 + @return The key code value.
1.197 + */
1.198 + virtual TKeyCode KeyCode() const =0;
1.199 +
1.200 + /**
1.201 + Gets the current key modifiers.
1.202 +
1.203 + @return The key modifiers.
1.204 + */
1.205 + virtual TUint KeyModifiers() const =0;
1.206 +protected:
1.207 + IMPORT_C CConsoleBase();
1.208 +protected:
1.209 + IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
1.210 + };
1.211 +
1.212 +
1.213 +class CProxyConsole;
1.214 +
1.215 +/**
1.216 +@publishedAll
1.217 +@released
1.218 +
1.219 +Adds colour support to the basic console interface.
1.220 +*/
1.221 +class CColorConsoleBase : public CConsoleBase
1.222 + {
1.223 +public:
1.224 +
1.225 + /**
1.226 + Sets the text attribute as defined by TTextAttribute.
1.227 +
1.228 + @param anAttribute The text attribute to be set.
1.229 + */
1.230 + virtual void SetTextAttribute(TTextAttribute /*anAttribute*/);
1.231 +protected:
1.232 + IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
1.233 +
1.234 + friend class CProxyConsole;
1.235 + };
1.236 +//
1.237 +
1.238 +/**
1.239 +@publishedAll
1.240 +@released
1.241 +*/
1.242 +extern "C" {
1.243 +IMPORT_C TAny *NewConsole();
1.244 +}
1.245 +#endif
1.246 +