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.

319 lines
11 KiB

  1. //-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: A U N I D L G . H
  7. //
  8. // Contents: ATMUNI call manager dialogbox message handler declaration
  9. //
  10. // Notes:
  11. //
  12. // Author: tongl 21 Mar 1997
  13. //
  14. //-----------------------------------------------------------------------
  15. #pragma once
  16. #include "ncxbase.h"
  17. #include "ncatlps.h"
  18. class CPvcInfo;
  19. const WCHAR c_szItoa[] = L"%d";
  20. const int MAX_VPI_LENGTH = 3;
  21. const int MAX_VCI_LENGTH = 4;
  22. void InitComboWithStringArray(HWND hwndDlg, int nIDDlgItem,
  23. int csid, const int* asid);
  24. void SetDwordEdtField(HWND hDlg, DWORD dwData, int nIDDlgItem);
  25. void GetDwordEdtField(HWND hDlg, DWORD * pdwData, int nIDDlgItem);
  26. void ShowContextHelp(HWND hDlg, UINT uCommand, const DWORD* pdwHelpIDs);
  27. // ATM UNI Property Dialog
  28. class CUniPage: public CPropSheetPage
  29. {
  30. public:
  31. BEGIN_MSG_MAP(CUniPage)
  32. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  33. MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
  34. MESSAGE_HANDLER(WM_HELP, OnHelp)
  35. // Property page notification message handlers
  36. NOTIFY_CODE_HANDLER(PSN_APPLY, OnApply)
  37. NOTIFY_CODE_HANDLER(PSN_KILLACTIVE, OnKillActive)
  38. NOTIFY_CODE_HANDLER(PSN_SETACTIVE, OnActive)
  39. NOTIFY_CODE_HANDLER(PSN_RESET, OnCancel)
  40. // Message handlers for the push buttons
  41. COMMAND_ID_HANDLER(IDC_PBN_PVC_Add, OnAddPVC)
  42. COMMAND_ID_HANDLER(IDC_PBN_PVC_Remove, OnRemovePVC)
  43. COMMAND_ID_HANDLER(IDC_PBN_PVC_Properties, OnPVCProperties)
  44. // Message handlers for the PVC list view
  45. COMMAND_ID_HANDLER(IDC_LVW_PVC_LIST, OnPVCListChange)
  46. END_MSG_MAP()
  47. // Constructors/Destructors
  48. CUniPage(CAtmUniCfg * pAtmUniCfg, const DWORD * padwHelpIDs = NULL);
  49. ~CUniPage();
  50. // Command handlers
  51. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  52. LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  53. LRESULT OnHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  54. // notify handlers for the property page
  55. LRESULT OnApply(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  56. LRESULT OnKillActive(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  57. LRESULT OnActive(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  58. LRESULT OnCancel(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  59. // command handlers
  60. LRESULT OnAddPVC(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  61. LRESULT OnRemovePVC(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  62. LRESULT OnPVCProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  63. LRESULT OnPVCListChange(WORD wNotifyCode, WORD wID,
  64. HWND hWndCtl, BOOL& bHandled);
  65. private:
  66. BOOL IsModified() {return m_fModified;}
  67. void SetModifiedTo(BOOL bState) {m_fModified = bState;}
  68. void PageModified() {
  69. m_fModified = TRUE;
  70. PropSheet_Changed(GetParent(), m_hWnd);
  71. }
  72. void SetButtons();
  73. void GetNewPvcId(CUniAdapterInfo * pAdapterInfo, tstring * pstrNewPvcId);
  74. BOOL IsUniquePvcId(CUniAdapterInfo * pAdapterInfo, tstring& strNewPvcId);
  75. void InsertNewPvc(CPvcInfo * pPvcInfo, int idx);
  76. void UpdatePvc(CPvcInfo * pPvcInfo, int idx);
  77. int CheckDupPvcId();
  78. // data members
  79. CAtmUniCfg *m_patmunicfg;
  80. CUniAdapterInfo * m_pAdapterInfo;
  81. HWND m_hPVCList;
  82. BOOL m_fModified;
  83. const DWORD* m_adwHelpIDs;
  84. };
  85. // The main PVC dialog
  86. class CPVCMainDialog : public CDialogImpl<CPVCMainDialog>
  87. {
  88. public:
  89. enum { IDD = IDD_PVC_Main };
  90. BEGIN_MSG_MAP(CPVCMainDialog)
  91. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog);
  92. MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu);
  93. MESSAGE_HANDLER(WM_HELP, OnHelp);
  94. COMMAND_ID_HANDLER(IDOK, OnOk);
  95. COMMAND_ID_HANDLER(IDCANCEL, OnCancel);
  96. COMMAND_ID_HANDLER(IDC_CMB_PVC_Type, OnType);
  97. COMMAND_ID_HANDLER(IDC_CHK_PVC_CallAddr, OnSpecifyCallAddr);
  98. COMMAND_ID_HANDLER(IDC_CHK_PVC_AnswerAddr, OnSpecifyAnswerAddr);
  99. COMMAND_ID_HANDLER(IDC_PBN_PVC_Advanced, OnAdvanced);
  100. END_MSG_MAP()
  101. public:
  102. CPVCMainDialog(CUniPage * pUniPage,
  103. CPvcInfo * pPvcInfo,
  104. const DWORD* padwHelpIDs = NULL);
  105. ~CPVCMainDialog();
  106. // Dialog creation overrides
  107. public:
  108. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  109. LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  110. LRESULT OnHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  111. LRESULT OnOk(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  112. LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  113. LRESULT OnType(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  114. LRESULT OnSpecifyCallAddr(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  115. LRESULT OnSpecifyAnswerAddr(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  116. LRESULT OnAdvanced(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  117. public:
  118. BOOL m_fDialogModified;
  119. BOOL m_fPropShtOk;
  120. BOOL m_fPropShtModified;
  121. private:
  122. // The PVC we are adding or modifying
  123. CPvcInfo * m_pPvcInfo ;
  124. // The current application type of the PVC
  125. PVCType m_CurType;
  126. // We save the pointer to the parent dialog
  127. CUniPage * m_pParentDlg;
  128. const DWORD* m_adwHelpIDs;
  129. class CPvcQosPage * m_pQosPage;
  130. class CPvcLocalPage * m_pLocalPage;
  131. class CPvcDestPage * m_pDestPage;
  132. // help functions
  133. void InitInfo();
  134. void SetInfo();
  135. void UpdateInfo();
  136. HRESULT HrDoPvcPropertySheet(CPvcInfo * pPvcInfoDlg);
  137. HRESULT HrSetupPropPages(CPvcInfo * pPvcInfoDlg, HPROPSHEETPAGE ** pahpsp, INT * pcPages);
  138. };
  139. class CPvcQosPage: public CPropSheetPage
  140. {
  141. public:
  142. BEGIN_MSG_MAP(CPvcQosPage)
  143. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  144. MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
  145. MESSAGE_HANDLER(WM_HELP, OnHelp)
  146. // Property page notification message handlers
  147. NOTIFY_CODE_HANDLER(PSN_APPLY, OnApply)
  148. NOTIFY_CODE_HANDLER(PSN_KILLACTIVE, OnKillActive)
  149. NOTIFY_CODE_HANDLER(PSN_SETACTIVE, OnActive)
  150. NOTIFY_CODE_HANDLER(PSN_RESET, OnCancel)
  151. END_MSG_MAP()
  152. // Constructors/Destructors
  153. CPvcQosPage(CPVCMainDialog * pParentDlg, CPvcInfo * pPvcInfo, const DWORD * padwHelpIDs = NULL);
  154. ~CPvcQosPage();
  155. public:
  156. // Command handlers
  157. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  158. LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  159. LRESULT OnHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  160. // notify handlers for the property page
  161. LRESULT OnApply(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  162. LRESULT OnKillActive(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  163. LRESULT OnActive(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  164. LRESULT OnCancel(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  165. private:
  166. void SetQosServiceCategory(ATM_SERVICE_CATEGORY dwServiceType, int nIDDlgItem);
  167. void GetQosServiceCategory(ATM_SERVICE_CATEGORY * pdwServiceType, int nIDDlgItem);
  168. // data
  169. CPVCMainDialog * m_pParentDlg;
  170. CPvcInfo * m_pPvcInfo;
  171. const DWORD * m_adwHelpIDs;
  172. };
  173. class CPvcLocalPage: public CPropSheetPage
  174. {
  175. public:
  176. BEGIN_MSG_MAP(CPvcLocalPage)
  177. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  178. MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
  179. MESSAGE_HANDLER(WM_HELP, OnHelp)
  180. // Property page notification message handlers
  181. NOTIFY_CODE_HANDLER(PSN_APPLY, OnApply)
  182. NOTIFY_CODE_HANDLER(PSN_KILLACTIVE, OnKillActive)
  183. NOTIFY_CODE_HANDLER(PSN_SETACTIVE, OnActive)
  184. NOTIFY_CODE_HANDLER(PSN_RESET, OnCancel)
  185. // Control notification handlers
  186. COMMAND_ID_HANDLER(IDC_CMB_PVC_Layer2, OnLayer2);
  187. COMMAND_ID_HANDLER(IDC_CMB_PVC_Layer3, OnLayer3);
  188. COMMAND_ID_HANDLER(IDC_CMB_PVC_High_Type, OnHighLayer);
  189. END_MSG_MAP()
  190. // Constructors/Destructors
  191. CPvcLocalPage(CPVCMainDialog * pParentDlg, CPvcInfo * pPvcInfo, const DWORD * padwHelpIDs = NULL);
  192. ~CPvcLocalPage();
  193. // Command handlers
  194. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  195. LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  196. LRESULT OnHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  197. // notify handlers for the property page
  198. LRESULT OnApply(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  199. LRESULT OnKillActive(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  200. LRESULT OnActive(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  201. LRESULT OnCancel(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  202. // Control notification handlers
  203. LRESULT OnLayer2(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  204. LRESULT OnLayer3(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  205. LRESULT OnHighLayer(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  206. private:
  207. // data
  208. CPVCMainDialog * m_pParentDlg;
  209. CPvcInfo * m_pPvcInfo;
  210. const DWORD * m_adwHelpIDs;
  211. };
  212. class CPvcDestPage: public CPropSheetPage
  213. {
  214. public:
  215. BEGIN_MSG_MAP(CPvcDestPage)
  216. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  217. MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
  218. MESSAGE_HANDLER(WM_HELP, OnHelp)
  219. // Property page notification message handlers
  220. NOTIFY_CODE_HANDLER(PSN_APPLY, OnApply)
  221. NOTIFY_CODE_HANDLER(PSN_KILLACTIVE, OnKillActive)
  222. NOTIFY_CODE_HANDLER(PSN_SETACTIVE, OnActive)
  223. NOTIFY_CODE_HANDLER(PSN_RESET, OnCancel)
  224. // Control notification handlers
  225. COMMAND_ID_HANDLER(IDC_CMB_PVC_Layer2, OnLayer2);
  226. COMMAND_ID_HANDLER(IDC_CMB_PVC_Layer3, OnLayer3);
  227. COMMAND_ID_HANDLER(IDC_CMB_PVC_High_Type, OnHighLayer);
  228. END_MSG_MAP()
  229. // Constructors/Destructors
  230. CPvcDestPage(CPVCMainDialog * pParentDlg, CPvcInfo * pPvcInfo, const DWORD * padwHelpIDs = NULL);
  231. ~CPvcDestPage();
  232. // Command handlers
  233. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  234. LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  235. LRESULT OnHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  236. // notify handlers for the property page
  237. LRESULT OnApply(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  238. LRESULT OnKillActive(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  239. LRESULT OnActive(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  240. LRESULT OnCancel(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  241. // Control notification handlers
  242. LRESULT OnLayer2(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  243. LRESULT OnLayer3(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  244. LRESULT OnHighLayer(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  245. private:
  246. // data
  247. CPVCMainDialog * m_pParentDlg;
  248. CPvcInfo * m_pPvcInfo;
  249. const DWORD * m_adwHelpIDs;
  250. };