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.

178 lines
6.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2000 - 2001.
  5. //
  6. // File: AttrMap.h
  7. //
  8. // Contents: Attribute maps to define a property page
  9. //
  10. // History: 8-2001 Hiteshr Created
  11. //
  12. //----------------------------------------------------------------------------
  13. //
  14. //Forward Declarations
  15. //
  16. struct ATTR_MAP;
  17. class CBaseRolePropertyPage;
  18. typedef HRESULT (*PATTR_FCN)(CDialog* pDlg,
  19. CBaseAz* pBaseAz,
  20. ATTR_MAP * pAttrMap,
  21. BOOL bDlgReadOnly,
  22. CWnd* pWnd,
  23. BOOL bNewObject,
  24. BOOL *pbSilent);
  25. //
  26. //Enum for attribute Types
  27. //
  28. enum ATTR_TYPE
  29. {
  30. ARG_TYPE_BOOL,
  31. ARG_TYPE_STR,
  32. ARG_TYPE_INT,
  33. ARG_TYPE_LONG,
  34. };
  35. //
  36. //Information about one attibute
  37. //
  38. struct ATTR_INFO
  39. {
  40. ATTR_TYPE attrType; //Type of attribute.
  41. ULONG ulPropId; //Correspoding Property for the attribute
  42. ULONG ulMaxLen; //Maxlen for the property, only applicable for
  43. //property of ARG_TYPE_STR
  44. };
  45. //
  46. //Map attribute to control, plus some extra info
  47. //
  48. struct ATTR_MAP
  49. {
  50. ATTR_INFO attrInfo;
  51. BOOL bReadOnly; //Is Readonly
  52. BOOL bUseForInitOnly; //Use this map for property page initialization
  53. //only Saving will be taken care somewhere else
  54. BOOL bRequired; //Attribute is required.
  55. ULONG idRequired; //Message to show if required attribute is not
  56. //entered by user
  57. BOOL bDefaultValue; //Attribute has default value
  58. union //Default value of attribute
  59. {
  60. void* vValue;
  61. LPTSTR pszValue;
  62. long lValue;
  63. BOOL bValue;
  64. };
  65. UINT nControlId; //Control ID corresponding to attribute
  66. PATTR_FCN pAttrInitFcn; //Use this function for attribute init instead
  67. //of generic routine
  68. PATTR_FCN pAttrSaveFcn; //Use this function for attribute save instead
  69. //of generic routine
  70. };
  71. //+----------------------------------------------------------------------------
  72. // Function:InitOneAttribute
  73. // Synopsis: Initializes one attribute defined by pAttrMapEntry
  74. // Arguments:pBaseAz: BaseAz object whose attribute is to be initialized
  75. // pAttrMapEntry: Map entry defining the attribute
  76. // bDlgReadOnly: If dialog box is readonly
  77. // pWnd: Control Associated with attribute
  78. // pbErrorDisplayed: Is Error Displayed by this function
  79. // Returns:
  80. // Note: if Object is newly created, we directly set the value,
  81. // For existing objects, get the current value of attribute and
  82. // only if its different from new value, set it.
  83. //-----------------------------------------------------------------------------
  84. HRESULT
  85. InitOneAttribute(IN CDialog* pDlg,
  86. IN CBaseAz * pBaseAz,
  87. IN ATTR_MAP* pAttrMap,
  88. IN BOOL bDlgReadOnly,
  89. IN CWnd* pWnd,
  90. OUT BOOL *pbErrorDisplayed);
  91. //+----------------------------------------------------------------------------
  92. // Function:SaveOneAttribute
  93. // Synopsis:Saves one attribute defined by pAttrMapEntry
  94. // Arguments:pBaseAz: BaseAz object whose attribute is to be saved
  95. // pAttrMapEntry: Map entry defining the attribute
  96. // pWnd: Control Associated with attribute
  97. // bNewObject: If the object is a newly created object.
  98. // pbErrorDisplayed: Is Error Displayed by this function
  99. // Returns:
  100. // Note: if Object is newly created, we directly set the value,
  101. // For existing objects, get the current value of attribute and
  102. // only if its different from new value, set it.
  103. //-----------------------------------------------------------------------------
  104. HRESULT
  105. SaveOneAttribute(IN CDialog *pDlg,
  106. IN CBaseAz * pBaseAz,
  107. IN ATTR_MAP* pAttrMap,
  108. IN CWnd* pWnd,
  109. IN BOOL bNewObject,
  110. OUT BOOL *pbErrorDisplayed);
  111. //+----------------------------------------------------------------------------
  112. // Function:InitDlgFromAttrMap
  113. // Synopsis:Initializes Dialog box from Attribute Map
  114. // Arguments:
  115. // pDlg: Dialog Box
  116. // pAttrMap: Attribute Map
  117. // pBaseAz: BaseAz object corresponding to attribute map
  118. // bDlgReadOnly: Dialog box is in Readonly Mode
  119. //-----------------------------------------------------------------------------
  120. BOOL
  121. InitDlgFromAttrMap(IN CDialog *pDlg,
  122. IN ATTR_MAP* pAttrMap,
  123. IN CBaseAz* pBaseAz,
  124. IN BOOL bDlgReadOnly);
  125. //+----------------------------------------------------------------------------
  126. // Function:SaveAttrMapChanges
  127. // Synopsis:Saves the attributes defined in AttrMap
  128. // Arguments:pDlg: Dialog box
  129. // pAttrMap: Attribute Map
  130. // pBaseAz: BaseAz object corresponding to attribute map
  131. // pbErrorDisplayed: Is Error Displayed by this function
  132. // ppErrorAttrMapEntry: In case of failuer get pointer to error
  133. // Attribute Map Entry.
  134. // Returns:
  135. //-----------------------------------------------------------------------------
  136. HRESULT
  137. SaveAttrMapChanges(IN CDialog* pDlg,
  138. IN ATTR_MAP* pAttrMap,
  139. IN CBaseAz* pBaseAz,
  140. BOOL bNewObject,
  141. OUT BOOL *pbErrorDisplayed,
  142. OUT ATTR_MAP** ppErrorAttrMapEntry);
  143. //
  144. //Declarations for attribute maps
  145. //
  146. extern ATTR_MAP ATTR_MAP_ADMIN_MANAGER_GENERAL_PROPERTY[];
  147. extern ATTR_MAP ATTR_MAP_APPLICATION_GENERAL_PROPERTY[];
  148. extern ATTR_MAP ATTR_MAP_SCOPE_GENERAL_PROPERTY[];
  149. extern ATTR_MAP ATTR_MAP_GROUP_GENERAL_PROPERTY[];
  150. extern ATTR_MAP ATTR_MAP_TASK_GENERAL_PROPERTY[];
  151. extern ATTR_MAP ATTR_MAP_ROLE_GENERAL_PROPERTY[];
  152. extern ATTR_MAP ATTR_MAP_OPERATION_GENERAL_PROPERTY[];
  153. extern ATTR_MAP ATTR_MAP_NEW_OPERATION[];
  154. extern ATTR_MAP ATTR_MAP_NEW_APPLICATION[];
  155. extern ATTR_MAP ATTR_MAP_NEW_SCOPE[];
  156. extern ATTR_MAP ATTR_MAP_NEW_GROUP[];
  157. extern ATTR_MAP ATTR_MAP_NEW_TASK[];
  158. extern ATTR_MAP ATTR_MAP_NEW_ADMIN_MANAGER[];
  159. extern ATTR_MAP ATTR_MAP_OPEN_ADMIN_MANAGER[];
  160. extern ATTR_MAP ATTR_MAP_ADMIN_MANAGER_ADVANCED_PROPERTY[];
  161. extern ATTR_MAP ATTR_MAP_GROUP_QUERY_PROPERTY[];
  162. extern ATTR_MAP ATTR_MAP_SCRIPT_DIALOG[];