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.

174 lines
4.4 KiB

  1. /*++
  2. Copyright (c) 1994-2000 Microsoft Corporation
  3. Module Name :
  4. W3PropPage.h
  5. Abstract:
  6. IIS Shell extension PropertyPage class definition
  7. Author:
  8. Sergei Antonov (sergeia)
  9. Project:
  10. Internet Services Manager
  11. Revision History:
  12. --*/
  13. #ifndef __W3PROPPAGE_H_
  14. #define __W3PROPPAGE_H_
  15. #include "resource.h" // main symbols
  16. class CPropShellExt;
  17. class CMetaEnumerator;
  18. #define LOCAL_KEY ((CComAuthInfo *)NULL)
  19. template <class T, bool bAutoDelete = true>
  20. class CShellExtPropertyPageImpl : public CDialogImplBase
  21. {
  22. public:
  23. PROPSHEETPAGE m_psp;
  24. operator PROPSHEETPAGE*() { return &m_psp; }
  25. // Construction
  26. CShellExtPropertyPageImpl(LPCTSTR lpszTitle = NULL)
  27. {
  28. // initialize PROPSHEETPAGE struct
  29. memset(&m_psp, 0, sizeof(PROPSHEETPAGE));
  30. m_psp.dwSize = sizeof(PROPSHEETPAGE);
  31. m_psp.dwFlags = PSP_USECALLBACK | PSP_USEREFPARENT | PSP_DEFAULT;
  32. m_psp.hInstance = _Module.GetResourceInstance();
  33. m_psp.pszTemplate = MAKEINTRESOURCE(T::IDD);
  34. m_psp.pfnDlgProc = (DLGPROC)T::StartDialogProc;
  35. m_psp.pfnCallback = T::PropPageCallback;
  36. m_psp.pcRefParent = reinterpret_cast<UINT *>(&_Module.m_nLockCnt);
  37. m_psp.lParam = reinterpret_cast<LPARAM>(this);
  38. if(lpszTitle != NULL)
  39. {
  40. m_psp.pszTitle = lpszTitle;
  41. m_psp.dwFlags |= PSP_USETITLE;
  42. }
  43. }
  44. static UINT CALLBACK PropPageCallback(HWND hWnd, UINT uMsg, LPPROPSHEETPAGE ppsp)
  45. {
  46. ATLASSERT(hWnd == NULL);
  47. if(uMsg == PSPCB_CREATE || uMsg == PSPCB_ADDREF)
  48. {
  49. CDialogImplBase * pPage = (CDialogImplBase *)ppsp->lParam;
  50. _Module.AddCreateWndData(&pPage->m_thunk.cd, pPage);
  51. }
  52. if (bAutoDelete && uMsg == PSPCB_RELEASE)
  53. {
  54. T * pPage = (T *)ppsp->lParam;
  55. delete pPage;
  56. }
  57. return 1;
  58. }
  59. HPROPSHEETPAGE Create()
  60. {
  61. return ::CreatePropertySheetPage(&m_psp);
  62. }
  63. BOOL EndDialog(int)
  64. {
  65. // do nothing here, calling ::EndDialog will close the whole sheet
  66. ATLASSERT(FALSE);
  67. return FALSE;
  68. }
  69. };
  70. class CComboBoxExch : public CWindowImpl<CComboBoxExch, CComboBox>
  71. {
  72. public:
  73. BEGIN_MSG_MAP_EX(CComboBoxExch)
  74. END_MSG_MAP()
  75. };
  76. class CListBoxExch : public CWindowImpl<CListBoxExch, CListBox>
  77. {
  78. public:
  79. BEGIN_MSG_MAP_EX(CListBoxExch)
  80. END_MSG_MAP()
  81. };
  82. /////////////////////////////////////////////////////////////////////////////
  83. // CW3PropPage
  84. // We cannot make this class autodelete -- we are storing instance of this page
  85. // inside of shell extension module
  86. //
  87. class CW3PropPage :
  88. public CShellExtPropertyPageImpl<CW3PropPage, false>,
  89. public CWinDataExchange<CW3PropPage>
  90. {
  91. public:
  92. CW3PropPage() :
  93. CShellExtPropertyPageImpl<CW3PropPage, false>(MAKEINTRESOURCE(IDS_PAGE_TITLE)),
  94. m_pParentExt(NULL)
  95. {
  96. }
  97. ~CW3PropPage()
  98. {
  99. }
  100. enum { IDD = IDD_W3PROPERTY_PAGE };
  101. BEGIN_MSG_MAP_EX(CW3PropPage)
  102. MSG_WM_INITDIALOG(OnInitDialog)
  103. MSG_WM_DESTROY(OnDestroy)
  104. COMMAND_ID_HANDLER_EX(IDC_ADD, OnAdd)
  105. COMMAND_ID_HANDLER_EX(IDC_REMOVE, OnRemove)
  106. COMMAND_ID_HANDLER_EX(IDC_EDIT, OnEdit)
  107. COMMAND_HANDLER_EX(IDC_COMBO_SERVER, CBN_SELCHANGE, OnServerChange)
  108. COMMAND_HANDLER_EX(IDC_SHARE_OFF, BN_CLICKED, OnShareYesNo)
  109. COMMAND_HANDLER_EX(IDC_SHARE_ON, BN_CLICKED, OnShareYesNo)
  110. COMMAND_HANDLER_EX(IDC_LIST, LBN_SELCHANGE, OnVDirChange)
  111. COMMAND_HANDLER_EX(IDC_LIST, LBN_DBLCLK, OnEdit)
  112. END_MSG_MAP()
  113. // Handler prototypes:
  114. // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  115. // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  116. // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  117. LRESULT OnInitDialog(HWND hDlg, LPARAM lParam);
  118. void OnDestroy();
  119. void OnAdd(WORD wNotifyCode, WORD wID, HWND hWndCtl);
  120. void OnRemove(WORD wNotifyCode, WORD wID, HWND hWndCtl);
  121. void OnEdit(WORD wNotifyCode, WORD wID, HWND hWndCtl);
  122. void OnServerChange(WORD wNotifyCode, WORD wID, HWND hWndCtl);
  123. void OnShareYesNo(WORD wNotifyCode, WORD wID, HWND hWndCtl);
  124. void OnVDirChange(WORD wNotifyCode, WORD wID, HWND hWndCtl);
  125. BEGIN_DDX_MAP(CW3PropPage)
  126. DDX_CONTROL(IDC_COMBO_SERVER, m_servers_list)
  127. DDX_CONTROL(IDC_LIST, m_share_list)
  128. END_DDX_MAP()
  129. void SetParentExt(CPropShellExt * pExt)
  130. {
  131. m_pParentExt = pExt;
  132. }
  133. protected:
  134. void RecurseVDirs(CMetaEnumerator& en, LPCTSTR path);
  135. void EnableOnShare();
  136. protected:
  137. CComboBoxExch m_servers_list;
  138. CListBoxExch m_share_list;
  139. BOOL m_ShareThis;
  140. CPropShellExt * m_pParentExt;
  141. };
  142. #endif //__W3PROPPAGE_H_