Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

133 lines
3.2 KiB

  1. /*++
  2. Copyright (c) 1992-2002 Microsoft Corporation
  3. Module Name:
  4. ncmdwin.h
  5. Abstract:
  6. Command Window data structure and definition
  7. Environment:
  8. Win32, User Mode
  9. --*/
  10. extern BOOL g_AutoCmdScroll;
  11. class CMDWIN_DATA : public COMMONWIN_DATA
  12. {
  13. public:
  14. //
  15. // Internal class
  16. //
  17. class HISTORY_LIST : public LIST_ENTRY
  18. {
  19. public:
  20. PTSTR m_psz;
  21. HISTORY_LIST()
  22. {
  23. InitializeListHead( (PLIST_ENTRY) this );
  24. m_psz = NULL;
  25. }
  26. virtual ~HISTORY_LIST()
  27. {
  28. RemoveEntryList( (PLIST_ENTRY) this );
  29. if (m_psz) {
  30. free(m_psz);
  31. }
  32. }
  33. };
  34. public:
  35. //
  36. // Used to resize the divided windows.
  37. //
  38. BOOL m_bTrackingMouse;
  39. int m_nDividerPosition;
  40. int m_EditHeight;
  41. //
  42. // Handle to the two main cmd windows.
  43. //
  44. HWND m_hwndHistory;
  45. HWND m_hwndEdit;
  46. BOOL m_bHistoryActive;
  47. // Prompt display static text control.
  48. HWND m_Prompt;
  49. ULONG m_PromptWidth;
  50. HISTORY_LIST m_listHistory;
  51. // Character index to place output at.
  52. LONG m_OutputIndex;
  53. BOOL m_OutputIndexAtEnd;
  54. CHARRANGE m_FindSel;
  55. ULONG m_FindFlags;
  56. BOOL m_Wrap;
  57. BOOL m_TabDown;
  58. static HMENU s_ContextMenu;
  59. CMDWIN_DATA();
  60. virtual void Validate();
  61. virtual void SetFont(ULONG FontIndex);
  62. virtual BOOL CanCopy();
  63. virtual BOOL CanCut();
  64. virtual BOOL CanPaste();
  65. virtual void Copy();
  66. virtual void Cut();
  67. virtual void Paste();
  68. virtual BOOL CanSelectAll();
  69. virtual void SelectAll();
  70. virtual BOOL CanWriteTextToFile(void);
  71. virtual HRESULT WriteTextToFile(HANDLE File);
  72. virtual HMENU GetContextMenu(void);
  73. virtual void OnContextMenuSelection(UINT Item);
  74. virtual void Find(PTSTR Text, ULONG Flags, BOOL FromDlg);
  75. // Functions called in response to WM messages
  76. virtual BOOL OnCreate(void);
  77. virtual LRESULT OnCommand(WPARAM wParam, LPARAM lParam);
  78. virtual void OnSetFocus(void);
  79. virtual void OnSize(void);
  80. virtual void OnButtonDown(ULONG Button);
  81. virtual void OnButtonUp(ULONG Button);
  82. virtual void OnMouseMove(ULONG Modifiers, ULONG X, ULONG Y);
  83. virtual LRESULT OnNotify(WPARAM wParam, LPARAM lParam);
  84. virtual void OnUpdate(UpdateType Type);
  85. virtual ULONG GetWorkspaceSize(void);
  86. virtual PUCHAR SetWorkspace(PUCHAR Data);
  87. virtual PUCHAR ApplyWorkspace1(PUCHAR Data, PUCHAR End);
  88. virtual void UpdateColors(void);
  89. void MoveDivider(int Pos);
  90. void AddCmdToHistory(PCSTR);
  91. void AddText(PTSTR Text, COLORREF Fg, COLORREF Bg);
  92. void Clear(void);
  93. void SetWordWrap(BOOL Wrap);
  94. void ResizeChildren(BOOL PromptChange);
  95. };
  96. typedef CMDWIN_DATA *PCMDWIN_DATA;
  97. void ClearCmdWindow(void);
  98. BOOL CmdOutput(PTSTR pszStr, COLORREF Fg, COLORREF Bg);
  99. void CmdLogFmt(PCTSTR buf, ...);
  100. int CmdExecuteCmd(PCTSTR, UiCommand);