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.

160 lines
6.6 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // RuleDesc.h
  4. //
  5. ///////////////////////////////////////////////////////////////////////////////
  6. // Bring in only once
  7. #pragma once
  8. #include "oerules.h"
  9. #define NM_RULE_CHANGED (WMN_FIRST + 1)
  10. typedef struct tagRULEDESCRIPT_LIST
  11. {
  12. ULONG ulIndex;
  13. BOOL fError;
  14. ULONG ulStart;
  15. ULONG ulEnd;
  16. LPSTR pszText;
  17. DWORD dwFlags;
  18. PROPVARIANT propvar;
  19. ULONG ulStartLogic;
  20. ULONG ulEndLogic;
  21. struct tagRULEDESCRIPT_LIST * pNext;
  22. } RULEDESCRIPT_LIST, * PRULEDESCRIPT_LIST;
  23. const int RDF_READONLY = 0x00000001;
  24. const int RDF_APPLYDLG = 0x00000002;
  25. // Class definitions
  26. class CRuleDescriptUI
  27. {
  28. private:
  29. enum
  30. {
  31. STATE_UNINIT = 0x00000000,
  32. STATE_INITIALIZED = 0x00000001,
  33. STATE_DIRTY = 0x00000002,
  34. STATE_READONLY = 0x00000004,
  35. STATE_HASRULE = 0x00000008,
  36. STATE_APPLYDLG = 0x00000010,
  37. STATE_ENABLED = 0x00000020
  38. };
  39. private:
  40. HWND m_hwndOwner;
  41. DWORD m_dwFlags;
  42. DWORD m_dwState;
  43. RULE_TYPE m_typeRule;
  44. RULEDESCRIPT_LIST * m_pDescriptListCrit;
  45. ULONG m_cDescriptListCrit;
  46. RULEDESCRIPT_LIST * m_pDescriptListAct;
  47. ULONG m_cDescriptListAct;
  48. HFONT m_hfont;
  49. WNDPROC m_wpcOld;
  50. CRIT_LOGIC m_logicCrit;
  51. BOOL m_fErrorLogic;
  52. public:
  53. CRuleDescriptUI();
  54. ~CRuleDescriptUI();
  55. // The main UI methods
  56. HRESULT HrInit(HWND hwndOwner, DWORD dwFlags);
  57. HRESULT HrIsDirty(void) { return (0 == (m_dwState & STATE_DIRTY)) ? S_FALSE : S_OK; }
  58. HRESULT HrClearDirty(void)
  59. {
  60. HRESULT hr = (0 == (m_dwState & STATE_DIRTY)) ? S_FALSE : S_OK;
  61. m_dwState &= ~STATE_DIRTY;
  62. return hr;
  63. }
  64. HRESULT HrIsReadOnly(void) { return (0 == (m_dwState & STATE_READONLY)) ? S_FALSE : S_OK; }
  65. HRESULT HrSetReadOnly(BOOL fSet)
  66. {
  67. if (fSet)
  68. {
  69. m_dwState |= STATE_READONLY;
  70. }
  71. else
  72. {
  73. m_dwState &= ~STATE_READONLY;
  74. }
  75. return S_OK;
  76. }
  77. HRESULT HrIsEnabled(void) { return (0 == (m_dwState & STATE_ENABLED)) ? S_FALSE : S_OK; }
  78. HRESULT HrSetEnabled(BOOL fSet)
  79. {
  80. if (fSet)
  81. {
  82. m_dwState |= STATE_ENABLED;
  83. }
  84. else
  85. {
  86. m_dwState &= ~STATE_ENABLED;
  87. }
  88. return S_OK;
  89. }
  90. HRESULT HrSetRule(RULE_TYPE typeRule, IOERule * pIRule);
  91. HRESULT HrVerifyRule(void);
  92. HRESULT HrEnableCriteria(CRIT_TYPE type, BOOL fEnable);
  93. HRESULT HrEnableActions(ACT_TYPE type, BOOL fEnable);
  94. HRESULT HrGetCriteria(CRIT_ITEM ** ppCritList, ULONG * pcCritList);
  95. HRESULT HrGetActions(ACT_ITEM ** ppActList, ULONG * pcActList);
  96. // Message handling functions
  97. void ShowDescriptionString(VOID);
  98. private:
  99. // Utility functions
  100. void _ShowLinkedString(ULONG ulText, RULEDESCRIPT_LIST * pruilist, BOOL fFirst, BOOL fCrit);
  101. BOOL _FChangeLogicValue(RULEDESCRIPT_LIST * pDescriptList);
  102. HRESULT _HrBuildCriteriaList(IOERule * pIRule, RULEDESCRIPT_LIST ** ppDescriptList,
  103. ULONG * pcDescriptList, CRIT_LOGIC * plogicCrit);
  104. BOOL _FChangeCriteriaValue(RULEDESCRIPT_LIST * pCritList);
  105. BOOL _FBuildCriteriaText(CRIT_TYPE type, DWORD dwFlags, PROPVARIANT * ppropvar, LPSTR * ppszText);
  106. BOOL _FVerifyCriteria(RULEDESCRIPT_LIST * pDescriptList);
  107. HRESULT _HrBuildActionList(IOERule * pIRule,
  108. RULEDESCRIPT_LIST ** ppDescriptList, ULONG * pcDescriptList);
  109. BOOL _FChangeActionValue(RULEDESCRIPT_LIST * pActList);
  110. BOOL _FBuildActionText(ACT_TYPE type, PROPVARIANT * ppropvar, LPSTR * ppszText);
  111. BOOL _FVerifyAction(RULEDESCRIPT_LIST * pDescriptList);
  112. void _UpdateRanges(LONG lDiff, ULONG ulStart);
  113. void _InsertDescription(RULEDESCRIPT_LIST ** ppDescriptList, RULEDESCRIPT_LIST * pDescriptListNew);
  114. BOOL _FRemoveDescription(RULEDESCRIPT_LIST ** ppDescriptList, ULONG ulIndex,
  115. RULEDESCRIPT_LIST ** ppDescriptListRemove);
  116. void _FreeDescriptionList(RULEDESCRIPT_LIST * pDescriptList);
  117. BOOL _FOnDescriptClick(UINT uiMsg, RULEDESCRIPT_LIST * pDescriptList, BOOL fCrit, BOOL fLogic);
  118. BOOL _FInLink(int chPos, RULEDESCRIPT_LIST ** ppDescriptList, BOOL * pfCrit, BOOL * pfLogic);
  119. BOOL _FMoveToLink(UINT uiKeyCode);
  120. static LRESULT CALLBACK _DescriptWndProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam);
  121. // The Change Subject dialog function
  122. static INT_PTR CALLBACK _FSelectTextDlgProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam);
  123. static INT_PTR CALLBACK _FSelectAddrDlgProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam);
  124. static INT_PTR CALLBACK _FSelectAcctDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  125. static INT_PTR CALLBACK _FSelectColorDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  126. static INT_PTR CALLBACK _FSelectSizeDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  127. static INT_PTR CALLBACK _FSelectLinesDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  128. static INT_PTR CALLBACK _FSelectAgeDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  129. static INT_PTR CALLBACK _FSelectPriorityDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  130. static INT_PTR CALLBACK _FSelectSecureDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  131. static INT_PTR CALLBACK _FSelectThreadStateDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  132. static INT_PTR CALLBACK _FSelectShowDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  133. static INT_PTR CALLBACK _FSelectLogicDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  134. static INT_PTR CALLBACK _FSelectFlagDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  135. static INT_PTR CALLBACK _FSelectDownloadedDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  136. static INT_PTR CALLBACK _FSelectReadDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  137. static INT_PTR CALLBACK _FSelectWatchDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  138. };