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.

318 lines
7.2 KiB

  1. #ifndef LEFTVIEW_H
  2. #define LEFTVIEW_H
  3. #include "stdafx.h"
  4. #include "Document.h"
  5. #include "resource.h"
  6. #include "MNLBUIData.h"
  7. #define IDT_REFRESH 1
  8. class LeftView : public CTreeView
  9. {
  10. DECLARE_DYNCREATE( LeftView )
  11. public:
  12. //
  13. // The following enum identifies some operations -- these are used in the implementation of
  14. // certain dialog classes to decide how to present their UI elements -- eg ClusterPage (clusterpage.h,.cpp).
  15. //
  16. typedef enum
  17. {
  18. OP_NEWCLUSTER,
  19. OP_EXISTINGCLUSTER,
  20. OP_ADDHOST,
  21. OP_CLUSTERPROPERTIES,
  22. OP_HOSTPROPERTIES
  23. } OPERATION;
  24. virtual void OnInitialUpdate();
  25. LeftView();
  26. ~LeftView();
  27. //
  28. // Called to indicate that deinitialization will soon follow.
  29. // After return from this call, the the left view will ignore
  30. // any HandleEngineEvent entries and the various cmdhandlers (in particular)
  31. // OnRefresh and auto-refresh) will be no-ops.
  32. //
  33. void
  34. PrepareToDeinitialize(void)
  35. {
  36. m_fPrepareToDeinitialize = TRUE;
  37. }
  38. void Deinitialize(void);
  39. //
  40. // Get connection information about a specific host.
  41. //
  42. BOOL
  43. GetConnectString(
  44. IN OUT CHostSpec& host
  45. );
  46. //
  47. // Update the view because of change relating to a specific instance of
  48. // a specific object type.
  49. //
  50. void
  51. HandleEngineEvent(
  52. IN IUICallbacks::ObjectType objtype,
  53. IN ENGINEHANDLE ehClusterId, // could be NULL
  54. IN ENGINEHANDLE ehObjId,
  55. IN IUICallbacks::EventCode evt
  56. );
  57. // world level.
  58. void OnFileLoadHostlist(void);
  59. void OnFileSaveHostlist(void);
  60. void OnWorldConnect(void);
  61. void OnWorldNewCluster(void);
  62. // cluster level.
  63. UINT m_refreshTimer;
  64. void OnTimer(UINT nIDEvent);
  65. void OnRefresh(BOOL bRefreshAll);
  66. void OnClusterProperties(void);
  67. void OnClusterRemove(void);
  68. void OnClusterUnmanage(void);
  69. void OnClusterAddHost(void);
  70. void OnOptionsCredentials(void);
  71. void OnOptionsLogSettings(void);
  72. void OnClusterControl(UINT nID );
  73. void OnClusterPortControl(UINT nID );
  74. // host level
  75. void OnHostProperties(void);
  76. void OnHostStatus(void);
  77. void OnHostRemove(void);
  78. void OnHostControl(UINT nID );
  79. void OnHostPortControl(UINT nID );
  80. Document* GetDocument();
  81. protected:
  82. private:
  83. TVINSERTSTRUCT rootItem;
  84. CString worldName;
  85. _bstr_t title;
  86. // message handlers.
  87. afx_msg BOOL OnHelpInfo (HELPINFO* helpInfo );
  88. afx_msg void OnContextMenu( CWnd* pWnd, CPoint point );
  89. afx_msg void OnRButtonDown( UINT nFlags, CPoint point );
  90. afx_msg void OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags );
  91. afx_msg void OnLButtonDblClk( UINT nFlags, CPoint point );
  92. // change in selection.
  93. afx_msg void OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult);
  94. void
  95. mfn_InsertCluster(
  96. ENGINEHANDLE ehClusterId,
  97. const CClusterSpec *pCSpec
  98. );
  99. void
  100. mfn_DeleteCluster(
  101. ENGINEHANDLE ehID
  102. );
  103. void
  104. mfn_InsertInterface(
  105. ENGINEHANDLE ehClusterID,
  106. ENGINEHANDLE ehInterfaceID,
  107. const CHostSpec *pHSpec,
  108. const CInterfaceSpec *pISpec
  109. );
  110. void
  111. mfn_DeleteInterface(
  112. ENGINEHANDLE ehInterfaceID
  113. );
  114. WLBS_OPERATION_CODES
  115. mfn_MapResourceIdToOpcode(bool bClusterWide, DWORD dwResourceId);
  116. map< ENGINEHANDLE, HTREEITEM > mapIdToInterfaceItem;
  117. map< ENGINEHANDLE, HTREEITEM > mapIdToClusterItem;
  118. CRITICAL_SECTION m_crit;
  119. BOOL m_fPrepareToDeinitialize;
  120. void mfn_Lock(void);
  121. void mfn_Unlock(void) {LeaveCriticalSection(&m_crit);}
  122. NLBERROR
  123. mfn_GetSelectedInterface(
  124. ENGINEHANDLE &ehInterface,
  125. ENGINEHANDLE &ehCluster
  126. );
  127. NLBERROR
  128. mfn_GetSelectedCluster(
  129. ENGINEHANDLE &ehCluster
  130. );
  131. int
  132. mfn_GetFileNameFromDialog(
  133. bool bLoadHostList,
  134. CString &FileName
  135. );
  136. void
  137. mfn_EnableClusterMenuItems(BOOL fEnable);
  138. void
  139. mfn_EnableHostMenuItems(BOOL fEnable);
  140. DECLARE_MESSAGE_MAP()
  141. };
  142. class LogSettingsDialog : public CDialog
  143. {
  144. public:
  145. enum
  146. {
  147. IDD = IDD_DIALOG_LOGSETTINGS
  148. };
  149. LogSettingsDialog(Document* pDocument, CWnd* parent = NULL);
  150. virtual BOOL OnInitDialog();
  151. virtual void OnOK();
  152. afx_msg BOOL OnHelpInfo (HELPINFO* helpInfo );
  153. afx_msg void OnContextMenu( CWnd* pWnd, CPoint point );
  154. afx_msg void OnSpecifyLogSettings();
  155. afx_msg void OnUpdateEditLogfileName();
  156. // overrides CDialog -- see SDK documentation on DoDataExchange.
  157. // Used to map controls in resources to corresponding objects in this class.
  158. virtual void DoDataExchange( CDataExchange* pDX );
  159. CEdit m_LogFileName;
  160. CEdit m_DoLogging;
  161. bool m_fLoggingEnabledOnInit;
  162. Document *m_pDocument;
  163. static
  164. DWORD
  165. s_HelpIDs[];
  166. DECLARE_MESSAGE_MAP()
  167. };
  168. //
  169. // This dialog is a read-only dialog that reports on log details or
  170. // misconfiguration details.
  171. //
  172. class DetailsDialog : public CDialog
  173. {
  174. public:
  175. enum
  176. {
  177. IDD = IDD_DIALOG_LOG_DETAILS
  178. };
  179. DetailsDialog(
  180. Document* pDocument,
  181. LPCWSTR szCaption,
  182. LPCWSTR szDate,
  183. LPCWSTR szTime,
  184. LPCWSTR szCluster,
  185. LPCWSTR szHost,
  186. LPCWSTR szInterface,
  187. LPCWSTR szSummary,
  188. LPCWSTR szDetails,
  189. CWnd* parent = NULL
  190. );
  191. ~DetailsDialog();
  192. virtual BOOL OnInitDialog();
  193. afx_msg void OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized );
  194. // overrides CDialog -- see SDK documentation on DoDataExchange.
  195. // Used to map controls in resources to corresponding objects in this class.
  196. virtual void DoDataExchange( CDataExchange* pDX );
  197. Document *m_pDocument;
  198. LPCWSTR m_szCaption;
  199. LPCWSTR m_szDate;
  200. LPCWSTR m_szTime;
  201. LPCWSTR m_szCluster;
  202. LPCWSTR m_szHost;
  203. LPCWSTR m_szInterface;
  204. LPCWSTR m_szSummary;
  205. CEdit m_Details;
  206. LPWSTR m_szMungedDetails;
  207. DECLARE_MESSAGE_MAP()
  208. };
  209. /*
  210. * All NLB manager property sheets must use this property sheet, which inherits
  211. * from CPropertySheet in order to add the context sensitive help icon to the
  212. * title bar, as per KB Q244232. (shouse, 9.25.01)
  213. */
  214. class CNLBMgrPropertySheet : public CPropertySheet {
  215. public:
  216. CNLBMgrPropertySheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0 ) {
  217. CPropertySheet::CPropertySheet(nIDCaption, pParentWnd, iSelectPage);
  218. }
  219. CNLBMgrPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0) {
  220. CPropertySheet::CPropertySheet(pszCaption, pParentWnd, iSelectPage);
  221. }
  222. virtual BOOL OnInitDialog () {
  223. BOOL bResult = CPropertySheet::OnInitDialog();
  224. /* Add the context help icon to the title bar. */
  225. ModifyStyleEx(0, WS_EX_CONTEXTHELP);
  226. return bResult;
  227. }
  228. };
  229. #endif