Source code of Windows XP (NT5)
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.

125 lines
3.3 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995
  5. //
  6. // File: statusdialog.h
  7. //
  8. // Contents: Contains the CStatusDialog class
  9. //
  10. //----------------------------------------------------------------------------
  11. #ifndef STATUSDIALOG_H
  12. #define STATUSDIALOG_H
  13. #include "Resizer.h"
  14. #define MAX_STATUS_MESSAGES 300
  15. class CMTScript;
  16. class CCustomListBox
  17. {
  18. public:
  19. DECLARE_MEMCLEAR_NEW_DELETE();
  20. CCustomListBox();
  21. ~CCustomListBox();
  22. void Refresh() const
  23. {
  24. if (_hwnd)
  25. InvalidateRect(_hwnd, 0, 0);
  26. }
  27. // Add another string
  28. void AppendString(const TCHAR *sz);
  29. // Change or add a string at a given position.
  30. void SetString(int nItem, const TCHAR *sz);
  31. // Shorten the list of strings.
  32. void SetEnd(int nItems);
  33. // Clear the contents of the listbox
  34. void ResetContent();
  35. // Handle windows messages for this control.
  36. void Init(HWND dlg, UINT idCtrl);
  37. void Destroy()
  38. {
  39. _hwnd = 0;
  40. }
  41. void DrawItem(DRAWITEMSTRUCT *pdis) ;
  42. void MeasureItem(MEASUREITEMSTRUCT *pmis);
  43. const TCHAR *GetString(int nItem);
  44. LRESULT SendMessage(UINT Msg, WPARAM wParam, LPARAM lParam)
  45. {
  46. return ::SendMessage(_hwnd, Msg, wParam, lParam);
  47. }
  48. private:
  49. HWND _hwnd; // The handle to this list
  50. CPtrAry<TCHAR *> _Messages;
  51. int _nAllocatedMessageLength;
  52. int _nExtent; // the width of the listbox
  53. };
  54. class CStatusDialog
  55. {
  56. public:
  57. DECLARE_MEMCLEAR_NEW_DELETE();
  58. CStatusDialog(HWND parent, CMTScript *pMTScript);
  59. ~CStatusDialog();
  60. bool Show();
  61. BOOL IsDialogMessage(MSG *msg);
  62. void OUTPUTDEBUGSTRING(LPWSTR pszMsg);
  63. void Refresh();
  64. void Pause();
  65. void Restart();
  66. private:
  67. HWND _parent; // Parent window
  68. HWND _hwnd; // me
  69. WINDOWPLACEMENT _WindowPlacement; // my current size & position
  70. BOOL _fMaximized;
  71. RECT _rect; // my current size & position
  72. BOOL _fStatusOpen; // Used for registry IO
  73. BOOL _fLogToFile; // if logging to a file is enabled
  74. CStr _cstrLogFileName; // The name of the log file
  75. BOOL _fPaused; // Used by Pause/Restart
  76. CMTScript *_pMTScript; // Used to retrieve status info
  77. TCHAR _achLogFileName[MAX_PATH];
  78. bool _fCreatedLogFileName; // Have we created the filename for the logfile yet?
  79. bool _fAddedHeaderToFile; // Have we put a timestamp line into the logfile yet?
  80. CCustomListBox _CScriptListBox;
  81. CCustomListBox _CProcessListBox;
  82. CCustomListBox _CSignalListBox;
  83. CCustomListBox _COutputListBox;
  84. POINT _InitialSize;
  85. CResizer _Resizer;
  86. // message handlers
  87. void InitDialog();
  88. void Destroy();
  89. void Resize(int width, int height);
  90. void GetMinMaxInfo(MINMAXINFO *mmi);
  91. CCustomListBox *CtrlIDToListBox(UINT CtrlID);
  92. HRESULT UpdateOptionSettings(BOOL fSave);
  93. static BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  94. void PopulateScripts();
  95. void PopulateSignals();
  96. void PopulateProcesses();
  97. void ClearOutput();
  98. void ToggleSignal();
  99. void UpdateLogging();
  100. };
  101. #endif