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.

203 lines
5.5 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1998 **/
  4. /**********************************************************************/
  5. /*
  6. statsdlg.h
  7. Header file for the base class of the Statistics dialogs.
  8. FILE HISTORY:
  9. */
  10. #ifndef _STATSDLG_H
  11. #define _STATSDLG_H
  12. #if _MSC_VER >= 1000
  13. #pragma once
  14. #endif // _MSC_VER >= 1000
  15. #ifndef _DIALOG_H_
  16. #include "dialog.h"
  17. #endif
  18. #ifndef _COLUMN_H
  19. #include "column.h"
  20. #endif
  21. #include "commres.h"
  22. // forward declarations
  23. struct ColumnData;
  24. class ConfigStream;
  25. class CStatsListCtrl : public CListCtrl
  26. {
  27. public:
  28. afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  29. void CopyToClipboard();
  30. DECLARE_MESSAGE_MAP();
  31. };
  32. /*---------------------------------------------------------------------------
  33. These are the available options (they get passed in through
  34. the StatsDialog constructor).
  35. STATSDLG_FULLWINDOW
  36. Makes the list control fill the entire window
  37. STATSDLG_CONTEXTMENU
  38. Provides a context menu over the list control.
  39. STATSDLG_SELECT_COLUMNS
  40. Allows the user the ability to change the available column set
  41. STATSDLG_VERTICAL
  42. The data is displayed with the column headers going vertical rather
  43. than horizontal. The user has to be aware of this when writing the
  44. RefreshData() code.
  45. ---------------------------------------------------------------------------*/
  46. #define STATSDLG_FULLWINDOW 0x00000001
  47. #define STATSDLG_CONTEXTMENU 0x00000002
  48. #define STATSDLG_SELECT_COLUMNS 0x00000004
  49. #define STATSDLG_VERTICAL 0x00000008
  50. #define STATSDLG_CLEAR 0x00000010
  51. #define STATSDLG_DEFAULTSORT_ASCENDING 0x00010000
  52. class StatsDialog : public CBaseDialog
  53. {
  54. public:
  55. StatsDialog(DWORD dwOptions);
  56. virtual ~StatsDialog();
  57. HRESULT SetColumnInfo(const ContainerColumnInfo *pColumnInfo, UINT cColumnInfo);
  58. int MapColumnToSubitem(UINT nColumnId);
  59. BOOL IsSubitemVisible(UINT nSubitemId);
  60. int MapSubitemToColumn(UINT nSubitemId);
  61. HANDLE GetSignalEvent()
  62. { return m_hEventThreadKilled; }
  63. void UnloadHeaders();
  64. void LoadHeaders();
  65. // sets the width of the columns to the maximum of the text
  66. void SetColumnWidths(UINT uNumColumns);
  67. // Posts the command to do a refresh
  68. void PostRefresh();
  69. // Override this to implement the actual insertion of data
  70. virtual HRESULT RefreshData(BOOL fGrabNewData);
  71. // This is called prior to deleting all items from the list control
  72. // This allows for the removal of any private data items
  73. virtual void PreDeleteAllItems();
  74. // Override this to implement sorting
  75. virtual void Sort(UINT nColumn);
  76. // MFC Overrides
  77. virtual BOOL OnInitDialog();
  78. virtual void OnOK();
  79. virtual void OnCancel();
  80. virtual void PostNcDestroy();
  81. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  82. // Sets the configuration info location and the column id
  83. // for this dialog
  84. void SetConfigInfo(ConfigStream *pConfig, ULONG ulId);
  85. // Sets the preferred size and position
  86. void SetPosition(RECT rc);
  87. void GetPosition(RECT *prc);
  88. virtual HRESULT AddToContextMenu(CMenu* pMenu);
  89. // Deletes all items from the list control
  90. void DeleteAllItems();
  91. // copy data to the clipboard
  92. void CopyData();
  93. //{{AFX_DATA(ColumnDlg)
  94. CStatsListCtrl m_listCtrl;
  95. //}}AFX_DATA
  96. //{{AFX_VIRTUAL(ColumnDlg)
  97. protected:
  98. virtual VOID DoDataExchange(CDataExchange* pDX);
  99. //}}AFX_VIRTUAL
  100. DWORD m_dwOptions;
  101. ConfigStream * m_pConfig;
  102. ULONG m_ulId; // id to be used when saving/getting info
  103. ViewInfo m_viewInfo;
  104. BOOL m_bAfterInitDialog;
  105. BOOL m_fSortDirection;
  106. BOOL m_fDefaultSortDirection;
  107. RECT m_rcPosition;
  108. // These hold the position of the buttons relative to the
  109. // right and bottom of the dialog. They are used to hold
  110. // the resizing information.
  111. RECT m_rcList;
  112. // This holds the minimum size rectangle
  113. SIZE m_sizeMinimum;
  114. // This is used by the thread and the handler (the thread signals
  115. // the handler that it has cleaned up after itself).
  116. HANDLE m_hEventThreadKilled;
  117. protected:
  118. // These hold the position of the buttons relative to the
  119. // right and bottom of the dialog. They are used to hold
  120. // the resizing information.
  121. enum
  122. {
  123. INDEX_CLOSE = 0,
  124. INDEX_REFRESH = 1,
  125. INDEX_SELECT = 2,
  126. INDEX_CLEAR = 3,
  127. INDEX_COUNT = 4, // this is the number of enums
  128. };
  129. struct StatsDialogBtnInfo
  130. {
  131. ULONG m_ulId;
  132. RECT m_rc;
  133. };
  134. StatsDialogBtnInfo m_rgBtn[INDEX_COUNT];
  135. float m_ColWidthMultiple;
  136. DWORD m_ColWidthAdder;
  137. protected:
  138. //{{AFX_MSG(StatsDialog)
  139. virtual afx_msg void OnRefresh();
  140. afx_msg void OnSelectColumns();
  141. afx_msg void OnMove(int x, int y);
  142. afx_msg void OnSize(UINT nType, int cx, int cy);
  143. afx_msg void OnGetMinMaxInfo(MINMAXINFO *pMinMax);
  144. afx_msg void OnContextMenu(CWnd *pWnd, CPoint pos);
  145. afx_msg void OnNotifyListControlClick(NMHDR *pNmHdr, LRESULT *pResult);
  146. //}}AFX_MSG
  147. DECLARE_MESSAGE_MAP();
  148. };
  149. void CreateNewStatisticsWindow(StatsDialog *pWndStats,
  150. HWND hWndParent,
  151. UINT nIDD);
  152. void WaitForStatisticsWindow(StatsDialog *pWndStats);
  153. #endif // _STATSDLG_H