plugins/consoles/rcons/server/win32/RemoteConsole.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // RemoteConsole.h
       
     2 // 
       
     3 // Copyright (c) 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 #if !defined(AFX_REMOTECONSOLE_H__EE1B18FE_34CC_42EE_8102_A6C62658E7EA__INCLUDED_)
       
    14 #define AFX_REMOTECONSOLE_H__EE1B18FE_34CC_42EE_8102_A6C62658E7EA__INCLUDED_
       
    15 
       
    16 #if _MSC_VER > 1000
       
    17 #pragma once
       
    18 #endif // _MSC_VER > 1000
       
    19 
       
    20 #include "Base.h"
       
    21 #include "ClientSocket.h"
       
    22 #include "SocketCommandHandler.h"
       
    23 #include "Server.h"
       
    24 #include "ConsoleWindow.h"
       
    25 
       
    26 
       
    27 class CRemoteConsole : public CBase, public MSocketClosureObserver, public MWindowObserver, public MConsoleCharHandler, public MSocketCommandHandler
       
    28 	{
       
    29 public:
       
    30 	static CRemoteConsole* Instance(int aId);
       
    31 	static CRemoteConsole* New(HINSTANCE aAppHandle, CSocketCommandReader& aCommandReader, LPCTSTR aTitle, int aWidth, int aHeight, TPreferences& aPreferences);
       
    32 	virtual ~CRemoteConsole();
       
    33 	int Id() const;
       
    34 	void AttachKeyEventSocket(CClientSocket& aSocket);
       
    35 private:
       
    36 	CRemoteConsole(CSocketCommandReader& aCommandReader, TPreferences& aPreferences);
       
    37 	void Construct(HINSTANCE aAppHandle, LPCTSTR aTitle, int aWidth, int aHeight);
       
    38 private: // From MSocketClosureObserver.
       
    39 	virtual void HandleSocketClosure(CSocket& aSocket);
       
    40 private: // From MWindowObserver.
       
    41 	virtual void HandleWindowClosure(CWindow& aWindow);
       
    42 	virtual LRESULT HandleWindowCommand(UINT aMessage, WPARAM aWParam, LPARAM aLParam);
       
    43 private: // From MConsoleCharHandler.
       
    44 	virtual void HandleConsoleChar(TCHAR aChar, UINT aModifiers);
       
    45 	virtual void HandleConsoleString(LPCTSTR aString, int aLength);
       
    46 private: // From MSocketCommandHandler.
       
    47 	virtual void HandleSocketCommand(TPacketHeader::TPacketType aCommand, const char* aPacket, int aPacketLength, CSocketCommandReader& aReader);
       
    48 	virtual void HandleSocketClosure(CSocketCommandReader& aReader);
       
    49 private:
       
    50 	bool GetCaptureFileName(LPTSTR aFileName) const;
       
    51 	void GetDefaultCaptureFileName(LPTSTR aFileName) const;
       
    52 	void SetDefaultCaptureFilePath(LPCTSTR aFileName) const;
       
    53 private:
       
    54 	static bool sWindowClassRegistered;
       
    55 	static int sNextId;
       
    56 	static CRemoteConsole* sFirst;
       
    57 	static CRemoteConsole* sLast;
       
    58 	int iId;
       
    59 	CRemoteConsole* iNext;
       
    60 	CRemoteConsole* iPrevious;
       
    61 	CSocketCommandReader* iCommandReader;
       
    62 	CClientSocket* iKeyEventSocket;
       
    63 	CConsoleWindow* iConsole;
       
    64 	bool iClosing;
       
    65 	TPreferences& iPreferences;
       
    66 	};
       
    67 
       
    68 #endif // !defined(AFX_REMOTECONSOLE_H__EE1B18FE_34CC_42EE_8102_A6C62658E7EA__INCLUDED_)