plugins/consoles/win32cons/src/console.h
changeset 0 7f656887cf89
child 30 35cb3fe43f60
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // console.h
       
     2 // 
       
     3 // Copyright (c) 2006 - 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "Eclipse Public License v1.0"
       
     6 // which accompanies this distribution, and is available
       
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 // 
       
     9 // Initial Contributors:
       
    10 // Accenture - Initial contribution
       
    11 //
       
    12 
       
    13 #include <e32cons.h>
       
    14 #include <e32msgqueue.h>
       
    15 #include <fshell/consoleextensions.h>
       
    16 #include "win32cons.h"
       
    17 
       
    18 
       
    19 class TKeyPress
       
    20 	{
       
    21 public:
       
    22 	TKeyCode iCode;
       
    23 	TUint iModifiers;
       
    24 	};
       
    25 
       
    26 class TReaderThreadParams
       
    27 	{
       
    28 public:
       
    29 	TWin32Console* iWin32;
       
    30 	RMsgQueue<TKeyPress> iKeyQueue;
       
    31 	RThread iOwner;
       
    32 	};
       
    33 	
       
    34 	
       
    35 /**
       
    36 Symbian CConsoleBase implementation that uses a Win32 console.
       
    37 
       
    38 It supports all of the CConsoleBase API. It also supports piping of test written
       
    39 to the console into a Win32 file or process, if the emulator is launched from a
       
    40 script in an appropriate manner.
       
    41 
       
    42 More specifally:
       
    43 - Redirection to a file: i.e. if the emulator is launched the emulator STDOUT
       
    44   piped to a file, data written to this console will end up in that file
       
    45 - Attaching to the console of the parent process: i.e. when the emulator is
       
    46   launched from a windows Command Prompt box, output will appear there
       
    47 - Creating a new console, if the emulator is lauched from a process with no
       
    48   console. This will happen if the emulator is launched from an IDE.
       
    49   
       
    50 Piping into the emulator process via this console is as yet untested.
       
    51 */
       
    52 #ifdef EKA2
       
    53 NONSHARABLE_CLASS(CWin32Console)
       
    54 #else
       
    55 class CWin32Console
       
    56 #endif
       
    57 	 : public CConsoleBase
       
    58 	{
       
    59 public:
       
    60 	CWin32Console();
       
    61 public: // From CConsoleBase.
       
    62 	virtual ~CWin32Console();
       
    63 	virtual TInt Create(const TDesC& aTitle, TSize aSize);
       
    64 	virtual void Read(TRequestStatus& aStatus);
       
    65 	virtual void ReadCancel();
       
    66 	virtual void Write(const TDesC& aDes);
       
    67 	virtual TPoint CursorPos() const;
       
    68 	virtual void SetCursorPosAbs(const TPoint& aPoint);
       
    69 	virtual void SetCursorPosRel(const TPoint& aPoint);
       
    70 	virtual void SetCursorHeight(TInt aPercentage);
       
    71 	virtual void SetTitle(const TDesC& aTitle);
       
    72 	virtual void ClearScreen();
       
    73 	virtual void ClearToEndOfLine();
       
    74 	virtual TSize ScreenSize() const;
       
    75 	virtual TKeyCode KeyCode() const;
       
    76 	virtual TUint KeyModifiers() const;
       
    77 	virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
       
    78 	
       
    79 	virtual void WriteStdErr(const TDesC& aDes);
       
    80 private:
       
    81 	TInt CreateNewConsole(const TDesC& aTitle, TSize aSize);
       
    82 	TInt FindClientThreadId(TThreadId& aThreadId);
       
    83 	static void HeapWalk(TAny* aSelf, RHeap::TCellType aCellType, TAny* aCellPtr, TInt aLength);
       
    84 private:
       
    85 	TWin32Console iWin32;
       
    86 	mutable RMsgQueue<TKeyPress> iKeyQueue;
       
    87 	RThread iReaderThread;
       
    88 	TReaderThreadParams iThreadParams;
       
    89 	
       
    90 	mutable TBool iReadKp;
       
    91 	mutable TKeyPress iKp;
       
    92 	};
       
    93 	
       
    94 static int ReaderThread(TAny* aParams);
       
    95