epoc32/include/e32cons.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     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
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
// e32\include\e32cons.h
williamr@2
    15
// 
williamr@2
    16
//
williamr@2
    17
williamr@2
    18
#ifndef __E32CONS_H__
williamr@2
    19
#define __E32CONS_H__
williamr@2
    20
#include <e32base.h>
williamr@2
    21
#include <e32keys.h>
williamr@2
    22
//
williamr@2
    23
williamr@2
    24
/**
williamr@2
    25
@publishedAll
williamr@2
    26
@released
williamr@2
    27
williamr@2
    28
Defines a default console width that can be used when creating a console.
williamr@2
    29
williamr@2
    30
@see CConsoleBase::Create()
williamr@2
    31
*/
williamr@2
    32
const TInt KDefaultConsWidth=78;
williamr@2
    33
williamr@2
    34
/**
williamr@2
    35
@publishedAll
williamr@2
    36
@released
williamr@2
    37
williamr@2
    38
Defines a default console height that can be used when creating a console.
williamr@2
    39
williamr@2
    40
@see CConsoleBase::Create()
williamr@2
    41
*/
williamr@2
    42
const TInt KDefaultConsHeight=18;
williamr@2
    43
williamr@2
    44
/**
williamr@2
    45
@publishedAll
williamr@2
    46
@released
williamr@2
    47
williamr@2
    48
Implies a full size screen console when passed as the width and height
williamr@2
    49
values when creating a console.
williamr@2
    50
williamr@2
    51
@see CConsoleBase::Create()
williamr@2
    52
*/
williamr@2
    53
const TInt KConsFullScreen=-1;
williamr@2
    54
williamr@2
    55
williamr@2
    56
/**
williamr@2
    57
@publishedAll
williamr@2
    58
@released
williamr@2
    59
williamr@2
    60
Defines a set of text attributes used for consoles that support colour.
williamr@2
    61
williamr@2
    62
@see CColorConsoleBase::SetTextAttribute().
williamr@2
    63
*/
williamr@2
    64
enum TTextAttribute
williamr@2
    65
	{
williamr@2
    66
	ETextAttributeNormal,  /**< Defines the normal text attribute.   */
williamr@2
    67
	ETextAttributeBold,    /**< Defines the bold text attribute.     */
williamr@2
    68
	ETextAttributeInverse, /**< Defines the inverse text attribute.  */
williamr@2
    69
	ETextAttributeHighlight/**< Defines the highlight text attribute.*/
williamr@2
    70
	};
williamr@2
    71
williamr@2
    72
williamr@2
    73
/**
williamr@2
    74
@publishedAll
williamr@2
    75
@released
williamr@2
    76
williamr@2
    77
A base class that defines a console interface.
williamr@2
    78
*/
williamr@2
    79
class CConsoleBase : public CBase
williamr@2
    80
	{
williamr@2
    81
public:
williamr@2
    82
	IMPORT_C virtual ~CConsoleBase();
williamr@2
    83
	IMPORT_C TKeyCode Getch();
williamr@2
    84
	IMPORT_C void Printf(TRefByValue<const TDesC> aFmt,...);
williamr@2
    85
	IMPORT_C void SetPos(TInt aX);
williamr@2
    86
	IMPORT_C void SetPos(TInt aX,TInt aY);
williamr@2
    87
	IMPORT_C TInt WhereX() const;
williamr@2
    88
	IMPORT_C TInt WhereY() const;
williamr@2
    89
// Pure virtual
williamr@2
    90
williamr@2
    91
williamr@2
    92
    /**
williamr@2
    93
    Creates a new console window.
williamr@2
    94
    
williamr@2
    95
    @param aTitle The title text for the console.
williamr@2
    96
                  This should not be longer than 256 characters.
williamr@2
    97
    @param aSize  The size of the console window.
williamr@2
    98
    
williamr@2
    99
    @return KErrNone, if successful; otherwise one of the other
williamr@2
   100
                      system wide error codes.
williamr@2
   101
    */
williamr@2
   102
	virtual TInt Create(const TDesC &aTitle,TSize aSize) =0;
williamr@2
   103
williamr@2
   104
	
williamr@2
   105
    /**
williamr@2
   106
    Gets a keystroke from the console window, asynchronously.
williamr@2
   107
    
williamr@2
   108
    @param aStatus The request status object.
williamr@2
   109
    */
williamr@2
   110
	virtual void Read(TRequestStatus &aStatus) =0;
williamr@2
   111
	
williamr@2
   112
	
williamr@2
   113
	/**
williamr@2
   114
	Cancels any outstanding request to get a keystroke from the console window.
williamr@2
   115
	*/
williamr@2
   116
	virtual void ReadCancel() =0;
williamr@2
   117
	
williamr@2
   118
	
williamr@2
   119
	/**
williamr@2
   120
	Writes the content of the specified descriptor to the console window.
williamr@2
   121
	
williamr@2
   122
	@param aDes Descriptor containing the characters to be written to
williamr@2
   123
	            the console window.
williamr@2
   124
	*/
williamr@2
   125
	virtual void Write(const TDesC &aDes) =0;
williamr@2
   126
	
williamr@2
   127
	
williamr@2
   128
	/**
williamr@2
   129
	Gets the current cursor position relative to the console window.
williamr@2
   130
	
williamr@2
   131
	@return  The current cursor position.
williamr@2
   132
	*/
williamr@2
   133
	virtual TPoint CursorPos() const =0;
williamr@2
   134
	
williamr@2
   135
	
williamr@2
   136
	/**
williamr@2
   137
    Puts the cursor at the absolute position in the window.
williamr@2
   138
    
williamr@2
   139
    @param aPoint The cursor position.
williamr@2
   140
	*/
williamr@2
   141
	virtual void SetCursorPosAbs(const TPoint &aPoint) =0;
williamr@2
   142
	
williamr@2
   143
	
williamr@2
   144
	/**
williamr@2
   145
	Puts the cursor at the specified position relative
williamr@2
   146
	to the current cursor position.
williamr@2
   147
	
williamr@2
   148
	@param aPoint The cursor position.
williamr@2
   149
	*/
williamr@2
   150
	virtual void SetCursorPosRel(const TPoint &aPoint) =0;
williamr@2
   151
	
williamr@2
   152
	
williamr@2
   153
	/**
williamr@2
   154
	Sets the percentage height of the cursor.
williamr@2
   155
	
williamr@2
   156
    @param aPercentage The percentage height. This is a value from 0 to 100.
williamr@2
   157
                       If 0 is specified, then no cursor is displayed.
williamr@2
   158
	*/
williamr@2
   159
	virtual void SetCursorHeight(TInt aPercentage) =0;
williamr@2
   160
williamr@2
   161
	
williamr@2
   162
	/**
williamr@2
   163
	Sets a new console title.
williamr@2
   164
	
williamr@2
   165
	@param aTitle The title text for the console.
williamr@2
   166
                  This should not be longer than 256 characters.
williamr@2
   167
	*/
williamr@2
   168
	virtual void SetTitle(const TDesC &aTitle) =0;
williamr@2
   169
williamr@2
   170
	
williamr@2
   171
	/**
williamr@2
   172
	Clears the console.
williamr@2
   173
	*/
williamr@2
   174
	virtual void ClearScreen() =0;
williamr@2
   175
	
williamr@2
   176
	
williamr@2
   177
	/**
williamr@2
   178
	Clears the console from the current cursor position to
williamr@2
   179
	the end of the line.
williamr@2
   180
	*/
williamr@2
   181
	virtual void ClearToEndOfLine() =0;
williamr@2
   182
	
williamr@2
   183
	
williamr@2
   184
	/**
williamr@2
   185
	Gets the size of the console.
williamr@2
   186
	*/
williamr@2
   187
	virtual TSize ScreenSize() const =0;
williamr@2
   188
	
williamr@2
   189
	
williamr@2
   190
	/**
williamr@2
   191
	Gets the current key code value.
williamr@2
   192
	
williamr@2
   193
	@return The key code value.
williamr@2
   194
	*/
williamr@2
   195
	virtual TKeyCode KeyCode() const =0;
williamr@2
   196
	
williamr@2
   197
	/**
williamr@2
   198
	Gets the current key modifiers.
williamr@2
   199
	
williamr@2
   200
	@return The key modifiers.
williamr@2
   201
	*/
williamr@2
   202
	virtual TUint KeyModifiers() const =0;
williamr@2
   203
protected:
williamr@2
   204
	IMPORT_C CConsoleBase();
williamr@2
   205
protected:
williamr@2
   206
	IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
williamr@2
   207
	};
williamr@2
   208
williamr@2
   209
williamr@2
   210
class CProxyConsole;
williamr@2
   211
williamr@2
   212
/**
williamr@2
   213
@publishedAll
williamr@2
   214
@released
williamr@2
   215
williamr@2
   216
Adds colour support to the basic console interface.
williamr@2
   217
*/
williamr@2
   218
class CColorConsoleBase : public CConsoleBase
williamr@2
   219
	{
williamr@2
   220
public:
williamr@2
   221
williamr@2
   222
    /**
williamr@2
   223
    Sets the text attribute as defined by TTextAttribute.
williamr@2
   224
    
williamr@2
   225
    @param anAttribute The text attribute to be set.
williamr@2
   226
    */
williamr@2
   227
	virtual void SetTextAttribute(TTextAttribute /*anAttribute*/); 
williamr@2
   228
protected:
williamr@2
   229
	IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
williamr@2
   230
williamr@2
   231
	friend class CProxyConsole;
williamr@2
   232
	};
williamr@2
   233
//
williamr@2
   234
williamr@2
   235
/**
williamr@2
   236
@publishedAll
williamr@2
   237
@released
williamr@2
   238
*/
williamr@2
   239
extern "C" {
williamr@2
   240
IMPORT_C TAny *NewConsole();
williamr@2
   241
}
williamr@2
   242
#endif