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.

177 lines
6.1 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000-2002 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // TaskTreeView.h
  7. //
  8. // Maintained By:
  9. // David Potter (DavidP) 27-MAR-2001
  10. // Geoffrey Pease (GPease) 22-MAY-2000
  11. //
  12. //////////////////////////////////////////////////////////////////////////////
  13. #pragma once
  14. class CAnalyzePage;
  15. class CCommitPage;
  16. //////////////////////////////////////////////////////////////////////////////
  17. // Type Definitions
  18. //////////////////////////////////////////////////////////////////////////////
  19. //
  20. // This structure is on the lParam of all tree view items.
  21. //
  22. typedef struct STreeItemLParamData
  23. {
  24. // Data collected from SendStatusReport.
  25. CLSID clsidMajorTaskId;
  26. CLSID clsidMinorTaskId;
  27. BSTR bstrNodeName;
  28. ULONG nMin;
  29. ULONG nMax;
  30. ULONG nCurrent;
  31. HRESULT hr;
  32. BSTR bstrDescription;
  33. FILETIME ftTime;
  34. BSTR bstrReference;
  35. // Data not collected from SendStatusReport.
  36. BOOL fParentToAllNodeTasks;
  37. BSTR bstrNodeNameWithoutDomain;
  38. } STreeItemLParamData, * PSTreeItemLParamData;
  39. typedef enum ETaskStatus
  40. {
  41. tsUNKNOWN = 0,
  42. tsPENDING, // E_PENDING
  43. tsDONE, // S_OK
  44. tsWARNING, // S_FALSE
  45. tsFAILED, // FAILED( hr )
  46. tsMAX
  47. } ETaskStatus;
  48. //////////////////////////////////////////////////////////////////////////////
  49. //++
  50. //
  51. // class CTaskTreeView
  52. //
  53. // Description:
  54. // Handles the tree view control that displays tasks.
  55. //
  56. //--
  57. //////////////////////////////////////////////////////////////////////////////
  58. class CTaskTreeView
  59. {
  60. friend class CAnalyzePage;
  61. friend class CCommitPage;
  62. private: // data
  63. HWND m_hwndParent;
  64. HWND m_hwndTV;
  65. HWND m_hwndProg;
  66. HWND m_hwndStatus;
  67. HIMAGELIST m_hImgList; // Image list of icons for tree view
  68. ULONG m_nRangeHigh; // Progress bar high range
  69. ULONG m_nInitialTickCount; // Initial count passed in via constructor
  70. ULONG m_nCurrentPos; // Remember the current position
  71. BOOL m_fThresholdBroken; // Has the initial count threshold been broken?
  72. ULONG m_nRealPos; // Real position on the progress bar.
  73. HTREEITEM m_htiSelected; // Selected item in the tree
  74. BSTR m_bstrClientMachineName; // Default node name for SendStatusReport
  75. BOOL m_fDisplayErrorsAsWarnings; // If TRUE, uses yellow bang icon for errors instead of red x
  76. PSTreeItemLParamData * m_ptipdProgressArray; // Dynamic sparse array of tasks that reported a progress_update.
  77. size_t m_cPASize; // The currently allocated size of the array.
  78. size_t m_cPACount; // The number of entries currently stored in the array.
  79. private: // methods
  80. CTaskTreeView(
  81. HWND hwndParentIn
  82. , UINT uIDTVIn
  83. , UINT uIDProgressIn
  84. , UINT uIDStatusIn
  85. , size_t uInitialTickCount
  86. );
  87. virtual ~CTaskTreeView( void );
  88. void OnNotifyDeleteItem( LPNMHDR pnmhdrIn );
  89. void OnNotifySelChanged( LPNMHDR pnmhdrIn );
  90. HRESULT HrInsertTaskIntoTree(
  91. HTREEITEM htiFirstIn
  92. , STreeItemLParamData * ptipdIn
  93. , int nImageIn
  94. , BSTR bstrDescriptionIn
  95. );
  96. HRESULT HrProcessUpdateProgressTask( const STreeItemLParamData * ptipdIn );
  97. HRESULT HrUpdateProgressBar(
  98. const STreeItemLParamData * ptipdPrevIn
  99. , const STreeItemLParamData * ptipdNewIn
  100. );
  101. HRESULT HrPropagateChildStateToParents(
  102. HTREEITEM htiChildIn
  103. , int nImageIn
  104. , BOOL fOnlyUpdateProgressIn
  105. );
  106. public: // methods
  107. HRESULT HrOnInitDialog( void );
  108. HRESULT HrOnSendStatusReport(
  109. LPCWSTR pcszNodeNameIn
  110. , CLSID clsidTaskMajorIn
  111. , CLSID clsidTaskMinorIn
  112. , ULONG nMinIn
  113. , ULONG nMaxIn
  114. , ULONG nCurrentIn
  115. , HRESULT hrStatusIn
  116. , LPCWSTR pcszDescriptionIn
  117. , FILETIME * pftTimeIn
  118. , LPCWSTR pcszReferenceIn
  119. );
  120. HRESULT HrAddTreeViewRootItem( UINT idsIn, REFCLSID rclsidTaskIDIn )
  121. {
  122. return THR( HrAddTreeViewItem(
  123. NULL // phtiOut
  124. , idsIn
  125. , rclsidTaskIDIn
  126. , IID_NULL
  127. , TVI_ROOT
  128. , TRUE // fParentToAllNodeTasksIn
  129. ) );
  130. } //*** CTaskTreeView::HrAddTreeViewRootItem
  131. HRESULT HrAddTreeViewItem(
  132. HTREEITEM * phtiOut
  133. , UINT idsIn
  134. , REFCLSID rclsidMinorTaskIDIn
  135. , REFCLSID rclsidMajorTaskIDIn = IID_NULL
  136. , HTREEITEM htiParentIn = TVI_ROOT
  137. , BOOL fParentToAllNodeTasksIn = FALSE
  138. );
  139. HRESULT HrOnNotifySetActive( void );
  140. LRESULT OnNotify( LPNMHDR pnmhdrIn );
  141. HRESULT HrShowStatusAsDone( void );
  142. HRESULT HrDisplayDetails( void );
  143. BOOL FGetItem( HTREEITEM htiIn, STreeItemLParamData ** pptipdOut );
  144. HRESULT HrFindPrevItem( HTREEITEM * phtiOut );
  145. HRESULT HrFindNextItem( HTREEITEM * phtiOut );
  146. HRESULT HrSelectItem( HTREEITEM htiIn );
  147. void SetDisplayErrorsAsWarnings( BOOL fDisplayErrorsAsWarningsIn )
  148. {
  149. m_fDisplayErrorsAsWarnings = fDisplayErrorsAsWarningsIn;
  150. } //*** CTaskTreeView::SetDisplayErrorsAsWarnings
  151. BOOL FDisplayErrorsAsWarnings( void )
  152. {
  153. return m_fDisplayErrorsAsWarnings;
  154. } //*** CTaskTreeView::FDisplayErrorsAsWarnings
  155. }; //*** class CTaskTreeView