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