|
1 // ConsoleWindow.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_CONSOLEWINDOW_H__F891F8FC_FA99_41C1_93FB_6C1BB31F655D__INCLUDED_) |
|
14 #define AFX_CONSOLEWINDOW_H__F891F8FC_FA99_41C1_93FB_6C1BB31F655D__INCLUDED_ |
|
15 |
|
16 #if _MSC_VER > 1000 |
|
17 #pragma once |
|
18 #endif // _MSC_VER > 1000 |
|
19 |
|
20 #include "Window.h" |
|
21 |
|
22 class CTextBuffer; |
|
23 class CTextView; |
|
24 |
|
25 |
|
26 class MConsoleCharHandler |
|
27 { |
|
28 public: |
|
29 virtual void HandleConsoleChar(TCHAR aChar, UINT aModifiers) = 0; |
|
30 virtual void HandleConsoleString(LPCTSTR aString, int aLength) = 0; |
|
31 }; |
|
32 |
|
33 |
|
34 class CConsoleWindow : public CWindow |
|
35 { |
|
36 public: |
|
37 static CConsoleWindow* New(HINSTANCE aAppHandle, LPCTSTR aWindowClass, LPCTSTR aTitle, int aPosX, int aPosY, int aCharWidth, int aCharHeight, int aNumOverflowLines, MWindowObserver* aWindowObserver, MConsoleCharHandler* aCharHandler, bool aNoSelection); |
|
38 virtual ~CConsoleWindow(); |
|
39 void Write(LPCTSTR aString); |
|
40 void Write(LPCTSTR aString, int aLength); |
|
41 void WriteFormat(LPCTSTR aFormat, ...); |
|
42 void GetCursorPos(int& aX, int& aY); |
|
43 void SetAbsCursorPos(int aX, int aY); |
|
44 void SetRelCursorPos(int aX, int aY); |
|
45 void SetCursorHeight(int aHeight); |
|
46 void GetConsoleSize(int& aWidth, int& aHeight); |
|
47 void ClearScreen(); |
|
48 void ClearToEndOfLine(); |
|
49 void CaptureToFile(LPCTSTR aFileName); |
|
50 void StopCaptureToFile(); |
|
51 bool IsCapturingToFile() const; |
|
52 void PasteFromClipboard(); |
|
53 void CopyToClipboard() const; |
|
54 void SetDimmed(bool aDimmed); |
|
55 private: |
|
56 CConsoleWindow(bool aNoSelection); |
|
57 void Construct(HINSTANCE aAppHandle, LPCTSTR aWindowClass, LPCTSTR aTitle, int aPosX, int aPosY, int aWidth, int aHeight, int aNumOverflowLines, MWindowObserver* aWindowObserver, MConsoleCharHandler* aCharHandler); |
|
58 private: // From CWindow. |
|
59 virtual void Draw() const; |
|
60 virtual LRESULT HandleChar(TCHAR aChar, UINT aModifiers); |
|
61 virtual LRESULT HandleFocusChange(bool aFocused); |
|
62 virtual void HandleScrollEvent(UINT aMessage, WPARAM aWParam); |
|
63 virtual void HandleSizeChanged(int aWidth, int aHeight); |
|
64 virtual void HandleMouseEvent(UINT aMessage, WPARAM aWParam, LPARAM aLParam); |
|
65 virtual void HandleMenuPopUp(HMENU aMenu); |
|
66 private: |
|
67 MConsoleCharHandler* iCharHandler; |
|
68 CTextBuffer* iBuffer; |
|
69 CTextView* iView; |
|
70 bool iNoSelection; |
|
71 }; |
|
72 |
|
73 #endif // !defined(AFX_CONSOLEWINDOW_H__F891F8FC_FA99_41C1_93FB_6C1BB31F655D__INCLUDED_) |