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.

241 lines
7.9 KiB

  1. #ifndef _INC_DSKQUOTA_VOLPROP_H
  2. #define _INC_DSKQUOTA_VOLPROP_H
  3. ///////////////////////////////////////////////////////////////////////////////
  4. /* File: volprop.h
  5. Description: Provides declarations for quota property pages.
  6. Revision History:
  7. Date Description Programmer
  8. -------- --------------------------------------------------- ----------
  9. 08/15/96 Initial creation. BrianAu
  10. */
  11. ///////////////////////////////////////////////////////////////////////////////
  12. #ifndef _INC_DSKQUOTA_PRSHTEXT_H
  13. # include "prshtext.h"
  14. #endif
  15. #ifndef _INC_DSKQUOTA_DETAILS_H
  16. # include "details.h"
  17. #endif
  18. #ifdef POLICY_MMC_SNAPIN
  19. # ifndef _INC_DSKQUOTA_POLICY_H
  20. # include "policy.h"
  21. # endif
  22. #endif
  23. #include "resource.h"
  24. const DWORD IDT_STATUS_UPDATE = 1;
  25. const DWORD STATUS_UPDATE_TIMER_PERIOD = 2000; // Update every 2 sec.
  26. #define TLM_SETSTATE (WM_USER + 100) // TLM = Traffic Light Message.
  27. //
  28. // Volume property page.
  29. //
  30. class VolumePropPage : public DiskQuotaPropSheetExt
  31. {
  32. protected:
  33. class TrafficLight
  34. {
  35. private:
  36. HWND m_hwndAnimateCtl;
  37. INT m_idAviClipRes;
  38. //
  39. // Prevent copy.
  40. //
  41. TrafficLight(const TrafficLight& rhs);
  42. TrafficLight& operator = (const TrafficLight& rhs);
  43. public:
  44. TrafficLight(VOID)
  45. : m_hwndAnimateCtl(NULL),
  46. m_idAviClipRes(-1)
  47. { }
  48. TrafficLight(HWND hwndAnimateCtl, INT idAviClipRes)
  49. : m_hwndAnimateCtl(hwndAnimateCtl),
  50. m_idAviClipRes(idAviClipRes)
  51. {
  52. Initialize(hwndAnimateCtl, idAviClipRes);
  53. }
  54. VOID Initialize(HWND hwndAnimateCtl, INT idAviClipRes);
  55. ~TrafficLight(VOID)
  56. { Animate_Close(m_hwndAnimateCtl); }
  57. enum { YELLOW, OFF, RED, GREEN, FLASHING_YELLOW };
  58. VOID Show(INT eShow);
  59. INT_PTR ForwardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
  60. };
  61. DWORD m_dwQuotaState;
  62. DWORD m_dwQuotaLogFlags;
  63. LONGLONG m_llDefaultQuotaThreshold;
  64. LONGLONG m_llDefaultQuotaLimit;
  65. UINT64 m_cVolumeMaxBytes;
  66. UINT_PTR m_idStatusUpdateTimer;
  67. DWORD m_dwLastStatusMsgID;
  68. int m_idCtlNextFocus;
  69. DetailsView *m_pDetailsView;
  70. XBytes *m_pxbDefaultLimit;
  71. XBytes *m_pxbDefaultThreshold;
  72. TrafficLight m_TrafficLight;
  73. virtual INT_PTR OnInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam);
  74. INT_PTR OnCommand(HWND hDlg, WPARAM wParam, LPARAM lParam);
  75. INT_PTR OnNotify(HWND hDlg, WPARAM wParam, LPARAM lParam);
  76. INT_PTR OnContextMenu(HWND hwndItem, int xPos, int yPos);
  77. INT_PTR OnHelp(HWND hDlg, WPARAM wParam, LPARAM lParam);
  78. INT_PTR OnTimer(HWND hDlg, WPARAM wParam, LPARAM lParam);
  79. INT_PTR OnButtonDetails(HWND hDlg, WPARAM wParam, LPARAM lParam);
  80. INT_PTR OnButtonEventLog(HWND hDlg, WPARAM wParam, LPARAM lParam);
  81. //
  82. // PSN_xxxx handlers.
  83. //
  84. virtual INT_PTR OnSheetNotifyApply(HWND hDlg, WPARAM wParam, LPARAM lParam);
  85. virtual INT_PTR OnSheetNotifyKillActive(HWND hDlg, WPARAM wParam, LPARAM lParam);
  86. virtual INT_PTR OnSheetNotifyReset(HWND hDlg, WPARAM wParam, LPARAM lParam);
  87. virtual INT_PTR OnSheetNotifySetActive(HWND hDlg, WPARAM wParam, LPARAM lParam);
  88. //
  89. // EN_xxxx handlers.
  90. //
  91. INT_PTR OnEditNotifyUpdate(HWND hDlg, WPARAM wParam, LPARAM lParam);
  92. INT_PTR OnEditNotifyKillFocus(HWND hDlg, WPARAM wParam, LPARAM lParam);
  93. INT_PTR OnEditNotifySetFocus(HWND hDlg, WPARAM wParam, LPARAM lParam);
  94. //
  95. // CBN_xxxx handlers.
  96. //
  97. INT_PTR OnComboNotifySelChange(HWND hDlg, WPARAM wParam, LPARAM lParam);
  98. HRESULT UpdateControls(HWND hDlg) const;
  99. HRESULT InitializeControls(HWND hDlg);
  100. HRESULT EnableControls(HWND hDlg);
  101. HRESULT RefreshCachedVolumeQuotaInfo(VOID);
  102. HRESULT ApplySettings(HWND hDlg);
  103. HRESULT QuotaStateFromControls(HWND hDlg, LPDWORD pdwState) const;
  104. HRESULT LogFlagsFromControls(HWND hDlg, LPDWORD pdwLogFlags) const;
  105. BOOL ActivateExistingDetailsView(VOID) const;
  106. bool SetByPolicy(LPCTSTR pszPolicyValue);
  107. HRESULT UpdateStatusIndicators(HWND hDlg);
  108. VOID SetStatusUpdateTimer(HWND hDlg)
  109. {
  110. if (0 == m_idStatusUpdateTimer)
  111. m_idStatusUpdateTimer = SetTimer(hDlg,
  112. IDT_STATUS_UPDATE,
  113. STATUS_UPDATE_TIMER_PERIOD,
  114. NULL);
  115. }
  116. VOID KillStatusUpdateTimer(HWND hDlg)
  117. {
  118. if (0 != m_idStatusUpdateTimer)
  119. {
  120. KillTimer(hDlg, m_idStatusUpdateTimer);
  121. m_idStatusUpdateTimer = 0;
  122. }
  123. }
  124. //
  125. // Prevent copy.
  126. //
  127. VolumePropPage(const VolumePropPage& rhs);
  128. VolumePropPage& operator = (const VolumePropPage& rhs);
  129. public:
  130. VolumePropPage(VOID);
  131. ~VolumePropPage(VOID);
  132. //
  133. // Dialog Proc callback.
  134. //
  135. static INT_PTR APIENTRY DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  136. };
  137. #ifdef POLICY_MMC_SNAPIN
  138. //
  139. // A specialization of VolumePropPage to address the specific needs of
  140. // of the disk quota policy property sheet displayed from within MMC. The
  141. // similarities between the two classes called for reusing as much of the
  142. // VolumePropPage implementation as possible.
  143. // The differences from VolumePropPage are:
  144. //
  145. // 1. "Quota Entries" and "Event Log" buttons are hidden.
  146. // 2. Traffic light and status messages are hidden.
  147. // 3. Page is not opened up "over" a specific volume.
  148. // 4. When user selects "OK" or "Apply", quota information is written to
  149. // the registry.
  150. //
  151. class CSnapInCompData; // fwd decl.
  152. class SnapInVolPropPage : public VolumePropPage
  153. {
  154. public:
  155. SnapInVolPropPage(void)
  156. : m_pPolicy(NULL) { }
  157. ~SnapInVolPropPage(void);
  158. private:
  159. LPDISKQUOTAPOLICY m_pPolicy;
  160. virtual INT_PTR OnInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam);
  161. virtual HRESULT CreateDiskQuotaPolicyObject(IDiskQuotaPolicy **ppOut);
  162. //
  163. // PSN_xxxx handlers.
  164. //
  165. virtual INT_PTR OnSheetNotifyApply(HWND hDlg, WPARAM wParam, LPARAM lParam);
  166. virtual INT_PTR OnSheetNotifyKillActive(HWND hDlg, WPARAM wParam, LPARAM lParam);
  167. virtual INT_PTR OnSheetNotifyReset(HWND hDlg, WPARAM wParam, LPARAM lParam);
  168. virtual INT_PTR OnSheetNotifySetActive(HWND hDlg, WPARAM wParam, LPARAM lParam);
  169. };
  170. #endif // POLICY_MMC_SNAPIN
  171. #ifdef PER_DIRECTORY_QUOTAS
  172. //
  173. // Folder property page.
  174. //
  175. class FolderPropPage : public DiskQuotaPropSheetExt
  176. {
  177. //
  178. // This class has not been implemented.
  179. // At some future date, we may implement per-directory quota management.
  180. // If such support is required, look at class VolumePropPage.
  181. // You should be able to provide a similar implementation only with
  182. // directory-specific features. All features common to volumes and
  183. // directories are in class DiskQuotaPropSheetExt.
  184. //
  185. public:
  186. //
  187. // Dialog Proc callback.
  188. //
  189. static INT_PTR APIENTRY DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  190. { return FALSE; }
  191. };
  192. #endif // PER_DIRECTORY_QUOTAS
  193. #endif // __DSKQUOTA_PROPSHEET_EXT_H