plugins/consoles/terminalkeyboardcons/terminalkeyboardcons.h
author Tom Sutcliffe <thomas.sutcliffe@accenture.com>
Thu, 26 Aug 2010 00:49:35 +0100
changeset 37 534b01198c2d
parent 35 f8e05215af4a
child 39 e7ccdc7f7dbe
permissions -rw-r--r--
Added ENotifyKeypresses and ECaptureCtrlC flags to CCommandBase. Commands can now get keypresses and handle ctrl-C via callbacks instead of having to implement custom active objects. As part of this extended the CCommandBase extension interface to MCommandExtensionsV2 for the new virtual functions KeyPressed(TUint aKeyCode, TUint aModifiers) and CtrlCPressed(). sudo now cleans up correctly by using ECaptureCtrlC.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     1
// terminalkeyboardcons.h
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     2
// 
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     3
// Copyright (c) 2010 Accenture. All rights reserved.
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     4
// This component and the accompanying materials are made available
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     5
// under the terms of the "Eclipse Public License v1.0"
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     6
// which accompanies this distribution, and is available
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     7
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     8
// 
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     9
// Initial Contributors:
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    10
// Accenture - Initial contribution
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    11
//
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    12
#ifndef TERMINALKEYBOARDCONS_H
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    13
#define TERMINALKEYBOARDCONS_H
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    14
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    15
#include <e32std.h>
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    16
#include <e32cons.h>
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    17
#include <TcDriverIf.h>
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    18
#include <fshell/consoleextensions.h>
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    19
#include "vtc_cursor_tracker.h"
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    20
class CMessageWatcher;
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    21
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    22
//#define SHOW_TEXTSHELL_BORDERS
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    23
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    24
NONSHARABLE_CLASS(CTerminalKeyboardCons) : public CConsoleBase, public MIosrvConsoleHelper, public MConsoleScrollHandler
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    25
	{
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    26
public:
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    27
	CTerminalKeyboardCons();
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    28
	virtual ~CTerminalKeyboardCons();
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    29
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    30
public: // From CConsoleBase
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    31
	virtual TInt Create(const TDesC& aTitle, TSize aSize);
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    32
	virtual void Read(TRequestStatus& aStatus);
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    33
	virtual void ReadCancel();
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    34
	virtual void Write(const TDesC& aDes);
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    35
	virtual TPoint CursorPos() const;
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    36
	virtual void SetCursorPosAbs(const TPoint& aPoint);
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    37
	virtual void SetCursorPosRel(const TPoint& aPoint);
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    38
	virtual void SetCursorHeight(TInt aPercentage);
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    39
	virtual void SetTitle(const TDesC& aTitle);
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    40
	virtual void ClearScreen();
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    41
	virtual void ClearToEndOfLine();
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    42
	virtual TSize ScreenSize() const;
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    43
	virtual TKeyCode KeyCode() const;
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    44
	virtual TUint KeyModifiers() const;
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    45
	virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    46
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    47
private: // From MConsoleScrollHandler
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    48
	void ConsoleScrolled(TInt aNumberOfLines);
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    49
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    50
private:
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    51
	virtual void ConstructL(const TDesC& aTitle, const TSize& aSize);
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    52
	void Update();
35
f8e05215af4a Performance improvements to terminalkeyboardcons.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 33
diff changeset
    53
	void DoUpdate();
33
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    54
	void MessageReceived(TInt aError);
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    55
	void Transmit(const TDesC& aBuf, TInt aWidth, TInt aHeight);
35
f8e05215af4a Performance improvements to terminalkeyboardcons.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 33
diff changeset
    56
	static TInt UpdateCallback(TAny* aSelf);
33
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    57
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    58
protected:
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    59
	TRequestStatus* iClientStatus;
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    60
	TBool iGotKey;
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    61
	TKeyCode iKeyCode;
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    62
	TUint iKeyModifiers;
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    63
	CConsoleBase* iUnderlyingConsole;
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    64
	RTcDriver iDriver;
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    65
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    66
	RBuf iTextBuffer;
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    67
	RBuf iMungedTextBuffer; // With the borders
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    68
	TCursorTracker iTracker;
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    69
	CMessageWatcher* iWatcher;
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    70
	friend class CMessageWatcher;
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    71
	TBool iBacktickModifierDown;
35
f8e05215af4a Performance improvements to terminalkeyboardcons.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents: 33
diff changeset
    72
	CPeriodic* iIdleUpdateTimer;
33
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    73
	};
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    74
cfabd0207208 Added terminalkeyboard console (terminalkeyboardcons.dll)
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    75
#endif // TERMINALKEYBOARDCONS_H