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.

204 lines
4.6 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. UIOPTIONS.H
  5. History:
  6. --*/
  7. #pragma once
  8. class CReport;
  9. #pragma warning(disable : 4251)
  10. class LTAPIENTRY CLocUIOptionData
  11. {
  12. public:
  13. enum OptVal
  14. {
  15. ovCurrent,
  16. ovDefault,
  17. ovUser,
  18. ovOverride
  19. };
  20. CLocOptionVal *GetOptionValue(OptVal);
  21. CLocOptionVal *GetOptionValue(OptVal) const;
  22. void SetOptionValue(OptVal, CLocOptionVal *);
  23. BOOL Purge(void);
  24. private:
  25. SmartRef<CLocOptionVal> m_spCurrentVal;
  26. SmartRef<CLocOptionVal> m_spUserVal;
  27. SmartRef<CLocOptionVal> m_spOverrideVal;
  28. };
  29. class CLocUIOptionSet;
  30. class LTAPIENTRY CLocUIOption: public CLocOptionVal
  31. {
  32. public:
  33. CLocUIOption();
  34. void AssertValid(void) const;
  35. //
  36. // New editor types should go at the END, so that old parsers
  37. // can still use the ENUM without being re-compiled..
  38. //
  39. enum EditorType
  40. {
  41. etNone,
  42. etInteger, // Maps to lvtInteger
  43. etUINT, // Maps to lvtInteger
  44. etString, // Maps to lvtString
  45. etFileName, // Maps to lvtFileName
  46. etDirName, // Maps to lvtString
  47. etStringList, // Maps to lvtStringList
  48. etPickOne, // Maps to lvtStringList
  49. etCheckBox, // Maps to lvtBOOL
  50. etTrueFalse, // Maps to lvtBOOL
  51. etYesNo, // Maps to lvtBOOL
  52. etOnOff, // Maps to lvtBOOL
  53. etCustom, // Custom editor
  54. };
  55. //
  56. // Used as bit flags to indicate where the option can be stored.
  57. enum StorageType
  58. {
  59. stUser = 0x0001,
  60. stOverride = 0x0002
  61. };
  62. enum OptionCode
  63. {
  64. ocNoError,
  65. ocUnknownOption,
  66. ocInvalidValue,
  67. ocInvalidType
  68. };
  69. void NOTHROW SetDescription(const HINSTANCE hDll, UINT nDescriptionID);
  70. void NOTHROW SetHelpText(const HINSTANCE hDll, UINT nHelpTextId);
  71. void NOTHROW SetEditor(EditorType);
  72. void NOTHROW SetStorageTypes(WORD);
  73. void NOTHROW SetDisplayOrder(UINT);
  74. void NOTHROW GetDescription(CLString &) const;
  75. void NOTHROW GetHelpText(CLString &) const;
  76. EditorType NOTHROW GetEditor(void) const;
  77. WORD NOTHROW GetStorageTypes(void) const;
  78. UINT NOTHROW GetDisplayOrder(void) const;
  79. CLocUIOptionData::OptVal GetOptionValLocation(void) const;
  80. virtual BOOL IsReadOnly(void) const = 0;
  81. virtual BOOL IsVisible(void) const = 0;
  82. virtual const CLString &GetGroupName(void) const = 0;
  83. virtual OptionCode ValidateOption(CReport *,
  84. const CLocVariant& var) const = 0;
  85. virtual void FormatDisplayString(const CLocVariant& var,
  86. CLString& strOut, BOOL fVerbose = FALSE) = 0;
  87. virtual void EditCustom(CWnd* pWndParent, CLocVariant& var) = 0;
  88. protected:
  89. virtual ~CLocUIOption();
  90. friend class CLocUIOptionSet;
  91. friend class CLocOptionManager;
  92. friend class CUpdateOptionValCallback;
  93. void SetParent(CLocUIOptionSet *);
  94. const CLocUIOptionSet *GetParent(void) const;
  95. const CLocUIOptionData &GetOptionValues(void) const;
  96. CLocUIOptionData &GetOptionValues(void);
  97. private:
  98. HINSTANCE m_hDescDll, m_hHelpDll;
  99. UINT m_idsDesc, m_idsHelp;
  100. EditorType m_etEditor;
  101. WORD m_wStorageTypes;
  102. UINT m_uiDisplayOrder;
  103. CLocUIOptionSet *m_pParent;
  104. CLocUIOptionData m_Values;
  105. };
  106. // Validate callback function
  107. // This function will be called during the ValidateOption handling.
  108. typedef CLocUIOption::OptionCode (*PFNOnValidateUIOption)
  109. (const CLocUIOption *pOption, CReport *pReport, const CLocVariant&);
  110. class LTAPIENTRY CLocUIOptionDef : public CLocUIOption
  111. {
  112. public:
  113. CLocUIOptionDef();
  114. enum ControlType
  115. {
  116. ctDefault,
  117. ctAlways,
  118. ctNever
  119. };
  120. void SetReadOnly(ControlType);
  121. void SetVisible(ControlType);
  122. virtual BOOL IsReadOnly(void) const;
  123. virtual BOOL IsVisible(void) const;
  124. virtual const CLString &GetGroupName(void) const;
  125. virtual OptionCode ValidateOption(CReport *,
  126. const CLocVariant& var) const;
  127. virtual void FormatDisplayString(const CLocVariant& var,
  128. CLString& strOut, BOOL fVerbose = FALSE);
  129. virtual void EditCustom(CWnd* pWndParent, CLocVariant& var);
  130. void SetValidationFunction(PFNOnValidateUIOption);
  131. private:
  132. ControlType m_ctReadOnly;
  133. ControlType m_ctVisible;
  134. PFNOnValidateUIOption m_pfnValidate;
  135. };
  136. #pragma warning(disable: 4275) // non dll-interface class 'foo' used
  137. // as base for dll-interface class 'bar'
  138. class LTAPIENTRY CLocUIOptionList :
  139. public CTypedPtrList<CPtrList, CLocUIOption *>
  140. {
  141. public:
  142. NOTHROW CLocUIOptionList();
  143. void AssertValid(void) const;
  144. NOTHROW ~CLocUIOptionList();
  145. private:
  146. CLocUIOptionList(const CLocUIOptionList &);
  147. void operator=(const CLocUIOptionList &);
  148. };
  149. #pragma warning(default: 4275 4251)
  150. #if !defined(_DEBUG) || defined(IMPLEMENT)
  151. #include "uioptions.inl"
  152. #endif