1 //
2 // Console.h: interface for the CConsole class.
3 //
4 //////////////////////////////////////////////////////////////////////
5 
6 #if !defined(CONSOLE_H__FEF419EC_6EB6_11D3_907D_204C4F4F5020__INCLUDED_)
7 #define CONSOLE_H__FEF419EC_6EB6_11D3_907D_204C4F4F5020__INCLUDED_
8 
9 #include "TextHistory.h"
10 #include "Completion.h"
11 
12 class CConsole
13 {
14 public:
15 	void EnableWrite();
16 	void DisableWrite();
17 	void SetReplaceCompletionCallback(ReplaceCompletionCallback pfCallback);
18 	BOOL SetInsertMode(BOOL blnInsetMode);
19 	void BeginScrollingOperation();
20 	TCHAR * Init(DWORD dwBufferSize, DWORD dwMaxHistoryLines = 0);
21 	BOOL ReadLine();
22 	BOOL FlushInputBuffer();
23 //	BOOL SetOutputMode(DWORD dwMode);
24 //	BOOL SetInputMode(DWORD dwMode);
25 	BOOL SetTextAttribute(WORD wAttributes);
26 	BOOL GetTextAttribute(WORD& rwAttributes);
27 	BOOL SetTitle(const TCHAR *p);
28 	BOOL Write(const TCHAR *p, DWORD dwChars = 0);
29 	CConsole();
30 	virtual ~CConsole();
31   unsigned int GetTabWidth();
32 private:
33 	HANDLE m_hStdOut;
34 	HANDLE m_hStdIn;
35 	HANDLE m_hStdError;
36 	COORD m_CursorPosition;
37 	COORD m_BufferSize;
38 	WORD m_wAttributes;
39 	SHORT m_Lines;
40 	BOOL WriteString(const TCHAR *pchString, COORD Position);
41 	BOOL WriteChar(TCHAR ch);
42 	BOOL m_blnInsetMode;	// TRUE - insert, FALSE - overwrite
43 	DWORD m_dwInsertModeCursorHeight;
44 	DWORD m_dwOverwriteModeCursorHeight;
45 	TCHAR *m_pchBuffer;
46 	TCHAR *m_pchBuffer1;
47 	TCHAR *m_pchBuffer2;
48 	DWORD m_dwBufferSize;
49 	ReplaceCompletionCallback m_pfReplaceCompletionCallback;
50 	SHORT m_LinesScrolled;
51 	BOOL m_blnMoreMode;
52 	CTextHistory m_History;
53 	BOOL m_blnDisableWrite;
54 	DWORD m_dwOldOutputMode;
55 	DWORD m_dwOldInputMode;
56 	BOOL m_blnOldInputModeSaved;
57 	BOOL m_blnOldOutputModeSaved;
58 };
59 
60 #endif // !defined(CONSOLE_H__FEF419EC_6EB6_11D3_907D_204C4F4F5020__INCLUDED_)
61