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.

159 lines
5.8 KiB

  1. //------------------------------------------------------------------------
  2. //
  3. // File: shell\themes\test\ctlperf\CtlPerfView.h
  4. //
  5. // Contents: View window, manages the client area. All the work is done there
  6. //
  7. // Classes: CCtlPerfView
  8. //
  9. //------------------------------------------------------------------------
  10. #pragma once
  11. #include "PerfLog.h" // We have a member of this class
  12. #include <atlddx.h> // For Options dialog DDX
  13. //-----------------------------------------------------------
  14. //
  15. // Class: CCtlPerfView
  16. //
  17. // Synopsis: View window, manages the client area.
  18. //
  19. //-----------------------------------------------------------
  20. class CCtlPerfView
  21. : public CWindowImpl<CCtlPerfView>
  22. {
  23. public:
  24. DECLARE_WND_CLASS(NULL)
  25. BEGIN_MSG_MAP(CCtlPerfView)
  26. MESSAGE_HANDLER(WM_SIZE, OnSize)
  27. MESSAGE_HANDLER(WM_CREATE, OnCreate)
  28. MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo)
  29. COMMAND_ID_HANDLER(IDM_SUITE1, OnSuite1)
  30. COMMAND_ID_HANDLER(IDM_SUITE2, OnSuite2)
  31. COMMAND_ID_HANDLER(IDM_BATCH1, OnBatch1)
  32. COMMAND_ID_HANDLER(IDM_BATCH2, OnBatch2)
  33. COMMAND_ID_HANDLER(IDM_BATCH3, OnBatch3)
  34. COMMAND_ID_HANDLER(IDM_FRAME, OnFrame)
  35. COMMAND_RANGE_HANDLER(IDM_CONTROL, IDM_CONTROL + 99, OnControl)
  36. END_MSG_MAP()
  37. //** Construction/destruction
  38. CCtlPerfView();
  39. ~CCtlPerfView();
  40. // Called after window destruction
  41. virtual void OnFinalMessage(HWND /*hWnd*/);
  42. //** Public methods
  43. // Receive status bar from parent
  44. void SetStatusBar(HWND hWndStatusBar);
  45. // Test a single control class
  46. void TestControl(LPTSTR szClassName);
  47. // Destroy all child windows
  48. void ClearChildren();
  49. // Resize the controls inside the client area
  50. void ResizeChildren();
  51. // Process INI file
  52. void ParseIniFile();
  53. // Does the whole resizing timing
  54. void TimeResize();
  55. // Processes all the control classes
  56. void RunSuite();
  57. //** Message handlers
  58. LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
  59. LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
  60. LRESULT OnGetMinMaxInfo(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
  61. LRESULT OnRunBatch(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
  62. //** Command handlers
  63. LRESULT OnControl(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  64. LRESULT OnFrame(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  65. LRESULT OnSuite1(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  66. LRESULT OnSuite2(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  67. LRESULT OnBatch1(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  68. LRESULT OnBatch2(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  69. LRESULT OnBatch3(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  70. private:
  71. //** Private members
  72. // The status bar window, in the parent frame
  73. HWND m_hWndStatusBar;
  74. // Array of handles to the children
  75. HWND* m_rgWnds;
  76. // Array of control class names
  77. LPTSTR* m_rgzClasses;
  78. // Number of elements in m_rgzClasses
  79. UINT m_cClasses;
  80. // Number of controls to create horizontally
  81. UINT m_cxCtrl;
  82. // Number of controls to create vertically
  83. UINT m_cyCtrl;
  84. // Number of iterations to do for each test
  85. UINT m_cLoops;
  86. // Maximum frame window width
  87. UINT m_cX;
  88. // Maximum frame window height
  89. UINT m_cY;
  90. // Are we doing two passes?
  91. bool m_bTwoPasses;
  92. // Are we in batch mode (command line)?
  93. bool m_bBatch;
  94. // Do we have to be silent (command line)?
  95. bool m_bSilent;
  96. // Name of pass 1
  97. TCHAR m_szPass1[256];
  98. // Name of pass 2
  99. TCHAR m_szPass2[256];
  100. // Name of viewer app
  101. TCHAR m_szViewer[_MAX_PATH + 1];
  102. // Name of log file
  103. TCHAR m_szLogFileName[_MAX_PATH + 1];
  104. // specify type of output
  105. TCHAR m_szNumberOnly[10 * sizeof(TCHAR) + 1];
  106. // The logging object
  107. CPerfLog m_perfLog;
  108. //** Private classes
  109. //-----------------------------------------------------------
  110. //
  111. // Class: COptionsDialog
  112. //
  113. // Synopsis: Options dialog, to display/override the INI file settings.
  114. //
  115. //-----------------------------------------------------------
  116. class COptionsDialog
  117. : public CSimpleDialog<IDD_OPTIONS> // Centers automatically
  118. , public CWinDataExchange<COptionsDialog> // For DDX
  119. {
  120. public:
  121. explicit COptionsDialog(CCtlPerfView *pView);
  122. BEGIN_MSG_MAP(COptionsDialog)
  123. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  124. COMMAND_RANGE_HANDLER(IDOK, IDNO, OnCloseCmd)
  125. CHAIN_MSG_MAP(thisClass)
  126. END_MSG_MAP()
  127. BEGIN_DDX_MAP(COptionsDialog)
  128. DDX_INT(IDC_EDIT_CTLX, m_pView->m_cxCtrl);
  129. DDX_INT(IDC_EDIT_CTLY, m_pView->m_cyCtrl);
  130. DDX_INT(IDC_EDIT_CX, m_pView->m_cX);
  131. DDX_INT(IDC_EDIT_CY, m_pView->m_cY);
  132. DDX_INT(IDC_EDIT_NUMLOOPS, m_pView->m_cLoops);
  133. DDX_TEXT(IDC_EDIT_PASS1, m_pView->m_szPass1);
  134. DDX_TEXT(IDC_EDIT_PASS2, m_pView->m_szPass2);
  135. DDX_TEXT(IDC_EDIT_LOGFILE, m_pView->m_szLogFileName);
  136. END_DDX_MAP()
  137. LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
  138. LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
  139. private:
  140. CCtlPerfView* m_pView;
  141. };
  142. // Let this dialog operate directly on our memebers
  143. friend class COptionsDialog;
  144. };