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.

132 lines
3.7 KiB

  1. //
  2. //
  3. //
  4. #ifndef _MAPPING_PAGE_H
  5. #define _MAPPING_PAGE_H
  6. #include "resource.h"
  7. #include "ExchControls.h"
  8. #include "PropSheet.h"
  9. class CAppMappingPage :
  10. public WTL::CPropertyPageImpl<CAppMappingPage>,
  11. public WTL::CWinDataExchange<CAppMappingPage>
  12. {
  13. typedef WTL::CPropertyPageImpl<CAppMappingPage> baseClass;
  14. public:
  15. CAppMappingPage(CAppData * pData)
  16. {
  17. m_pData = pData;
  18. }
  19. ~CAppMappingPage()
  20. {
  21. }
  22. enum {IDD = IDD_APPMAP};
  23. BEGIN_MSG_MAP_EX(CAppMappingPage)
  24. MSG_WM_INITDIALOG(OnInitDialog)
  25. COMMAND_HANDLER_EX(IDC_ADD, BN_CLICKED, OnAdd)
  26. COMMAND_HANDLER_EX(IDC_EDIT, BN_CLICKED, OnEdit)
  27. COMMAND_HANDLER_EX(IDC_REMOVE, BN_CLICKED, OnRemove)
  28. COMMAND_HANDLER_EX(IDC_CACHE_ISAPI, BN_CLICKED, OnCacheISAPI)
  29. NOTIFY_HANDLER_EX(IDC_LIST, NM_DBLCLK, OnDblClickList)
  30. CHAIN_MSG_MAP(baseClass)
  31. END_MSG_MAP()
  32. BEGIN_DDX_MAP(CAppMappingPage)
  33. DDX_CHECK(IDC_CACHE_ISAPI, m_pData->m_CacheISAPI)
  34. DDX_CONTROL(IDC_LIST, m_list)
  35. END_DDX_MAP()
  36. LRESULT OnInitDialog(HWND hDlg, LPARAM lParam);
  37. void OnAdd(UINT nCode, UINT nID, HWND hWnd);
  38. void OnEdit(UINT nCode, UINT nID, HWND hWnd);
  39. void OnRemove(UINT nCode, UINT nID, HWND hWnd);
  40. void OnCacheISAPI(UINT nCode, UINT nID, HWND hWnd);
  41. LRESULT OnDblClickList(LPNMHDR pHdr);
  42. BOOL OnKillActive();
  43. void OnHelp();
  44. protected:
  45. CAppData * m_pData;
  46. CListViewExch m_list;
  47. };
  48. class CEditMap :
  49. public CDialogImpl<CEditMap>,
  50. public WTL::CWinDataExchange<CEditMap>
  51. {
  52. public:
  53. CEditMap() :
  54. m_script_engine(FALSE),
  55. m_file_exists(FALSE),
  56. m_verbs_index(0),
  57. m_new(FALSE),
  58. m_bExecValid(FALSE),
  59. m_bExtValid(FALSE),
  60. m_bVerbsValid(FALSE)
  61. {
  62. m_exec[0] = 0;
  63. m_ext[0] = 0;
  64. m_verbs[0] = 0;
  65. }
  66. ~CEditMap()
  67. {
  68. }
  69. enum {IDD = IDD_EDITMAP};
  70. protected:
  71. BEGIN_MSG_MAP_EX(CEditMap)
  72. MSG_WM_INITDIALOG(OnInitDialog)
  73. COMMAND_HANDLER_EX(IDC_HELPBTN, BN_CLICKED, OnHelp)
  74. COMMAND_HANDLER_EX(IDOK, BN_CLICKED, OnOK)
  75. COMMAND_HANDLER_EX(IDCANCEL, BN_CLICKED, OnCancel)
  76. COMMAND_HANDLER_EX(IDC_ALL_VERBS, BN_CLICKED, OnVerbs)
  77. COMMAND_HANDLER_EX(IDC_LIMIT_VERBS, BN_CLICKED, OnVerbs)
  78. COMMAND_HANDLER_EX(IDC_EXTENSION, EN_CHANGE, OnExtChanged)
  79. COMMAND_HANDLER_EX(IDC_EXECUTABLE, EN_CHANGE, OnExecChanged)
  80. COMMAND_HANDLER_EX(IDC_VERBS, EN_CHANGE, OnVerbsChanged)
  81. END_MSG_MAP()
  82. BEGIN_DDX_MAP(CEditMap)
  83. // DDX_TEXT_LEN(IDC_EXECUTABLE, m_exec, MAX_PATH)
  84. DDX_TEXT_LEN(IDC_EXTENSION, m_ext, MAX_PATH)
  85. DDX_TEXT_LEN(IDC_VERBS, m_verbs, MAX_PATH)
  86. DDX_RADIO(IDC_ALL_VERBS, m_verbs_index)
  87. DDX_CHECK(IDC_SCRIPT_ENGINE, m_script_engine)
  88. DDX_CHECK(IDC_FILE_EXISTS, m_file_exists)
  89. END_DDX_MAP()
  90. LRESULT OnInitDialog(HWND hDlg, LPARAM lParam);
  91. void OnBrowse(UINT nCode, UINT nID, HWND hWnd);
  92. void OnHelp(UINT nCode, UINT nID, HWND hWnd);
  93. void OnOK(UINT nCode, UINT nID, HWND hWnd);
  94. void OnCancel(UINT nCode, UINT nID, HWND hWnd);
  95. void OnVerbs(UINT nCode, UINT nID, HWND hWnd);
  96. void OnExtChanged(UINT nCode, UINT nID, HWND hWnd);
  97. void OnExecChanged(UINT nCode, UINT nID, HWND hWnd);
  98. void OnVerbsChanged(UINT nCode, UINT nID, HWND hWnd);
  99. public:
  100. // There is a bug in DDX_Text routine -- they pass sizeof(var) there which is site in bytes, not in chars,
  101. // as should be for GetWindowText(). These ugly buffers are for protection
  102. TCHAR m_exec[MAX_PATH];
  103. TCHAR buffer1[MAX_PATH];
  104. TCHAR m_ext[MAX_PATH];
  105. TCHAR buffer2[MAX_PATH];
  106. TCHAR m_prev_ext[MAX_PATH];
  107. TCHAR buffer3[MAX_PATH];
  108. TCHAR m_verbs[MAX_PATH];
  109. TCHAR buffer4[MAX_PATH];
  110. int m_verbs_index;
  111. BOOL m_script_engine, m_file_exists;
  112. BOOL m_new, m_bExtValid, m_bExecValid, m_bVerbsValid;
  113. DWORD m_flags;
  114. CFileChooser m_FileChooser;
  115. CAppData * m_pData;
  116. };
  117. #endif //_MAPPING_PAGE_H