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.

202 lines
4.8 KiB

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