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.

212 lines
6.4 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. FIELDDEF.H
  5. History:
  6. --*/
  7. #pragma once
  8. #pragma warning(disable:4275) // Exported classes
  9. //------------------------------------------------------------------------------
  10. struct LTAPIENTRY COLUMN_STRING_ENTRY
  11. {
  12. // Construction
  13. public:
  14. COLUMN_STRING_ENTRY();
  15. COLUMN_STRING_ENTRY(const COLUMN_STRING_ENTRY & entry);
  16. // Data
  17. public:
  18. CLString st; // Display String
  19. long nID; // User value (unique ID)
  20. // Operations
  21. public:
  22. const COLUMN_STRING_ENTRY & operator=(const COLUMN_STRING_ENTRY & entry);
  23. };
  24. typedef CArray<COLUMN_STRING_ENTRY, COLUMN_STRING_ENTRY&> CColStrEntryArray;
  25. //------------------------------------------------------------------------------
  26. class LTAPIENTRY CColumnStrList : public CLocThingList<COLUMN_STRING_ENTRY>
  27. {
  28. // Operations
  29. public:
  30. BOOL FindDisplayName(long nID, CLString & stName) const;
  31. BOOL FindID(const CLString &stName,long &nID) const;
  32. };
  33. // RAID: LS42 Bug 46 fixed by MikeL
  34. // Pointer to a function to allow each column
  35. // type to have its own validation function.
  36. typedef BOOL (* PFNVALIDATE) (LPCTSTR, DWORD);
  37. // RAID: LS42 Bug 46 fixed by MikeL
  38. // Added m_pfnValidateFunc to allow each column
  39. // type to have its own validation function.
  40. //------------------------------------------------------------------------------
  41. class LTAPIENTRY CColumnDefinition : public CRefCount
  42. {
  43. public:
  44. CColumnDefinition(const WCHAR * pszInternalName, long nID,
  45. const CLString &strName, const CLString &strHelp,
  46. CColumnVal::ColumnValType vt, Operators ops,
  47. BOOL fDisplayable, BOOL fSortable, BOOL fReadOnly,
  48. PFNVALIDATE pfnValidateFunc);
  49. void SetStringList(const CColumnStrList & lstColumnStr);
  50. const CPascalString & GetInternalName() const;
  51. long GetID() const;
  52. const CLString & GetDisplayName() const;
  53. const CLString & GetHelpText() const;
  54. BOOL IsDisplayable() const;
  55. BOOL IsSortable() const;
  56. BOOL IsReadOnly() const;
  57. CColumnVal::ColumnValType GetColumnType() const;
  58. Operators GetOperators() const;
  59. const CColumnStrList & GetStringList() const;
  60. BOOL Validate (LPCTSTR lpsz, DWORD dw) const;
  61. private:
  62. CPascalString m_pasInternalName; // Unique String ID
  63. long m_nID; // Unique Number ID (can be any number)
  64. CLString m_strDisplayName; // Displayed name
  65. CLString m_strHelpText; // Description of column
  66. CColumnVal::ColumnValType m_vt; // Type of data
  67. Operators m_ops; // Valid filtering operations
  68. BOOL m_fDisplayable; // Column is displayable
  69. BOOL m_fSortable; // Column is sortable
  70. BOOL m_fReadOnly; // Column is read-only
  71. PFNVALIDATE m_pfnValidateFunc; // Pointer to column value validation func
  72. CColumnStrList m_lstColumnStr;
  73. };
  74. //------------------------------------------------------------------------------
  75. // CEnumIntoColStrList provides a method of enumerating directly into a list of
  76. // COLUMN_STRING_ENTRY's.
  77. //
  78. class LTAPIENTRY CEnumIntoColStrList : public CEnumCallback
  79. {
  80. // Construction
  81. public:
  82. CEnumIntoColStrList(CColumnStrList & lstColStr, BOOL fLock = TRUE);
  83. ~CEnumIntoColStrList();
  84. // CEnumCallback implementation
  85. public:
  86. virtual BOOL ProcessEnum(const EnumInfo &);
  87. protected:
  88. CColumnStrList & m_lstColStr;
  89. BOOL m_fLock; // Lock list when finished
  90. };
  91. //------------------------------------------------------------------------------
  92. class LTAPIENTRY CColDefUtil
  93. {
  94. // Operations
  95. public:
  96. static void FillBool(CButton * pbtn, BOOL fValue = TRUE);
  97. static void FillBool(CListBox * plbc, BOOL fValue = TRUE, BOOL fEmpty = TRUE);
  98. static void FillBool(CComboBox * pcbc, BOOL fValue = TRUE, BOOL fEmpty = TRUE);
  99. static void FillStringList(CListBox * plbc, const CColumnStrList & lstColStr,
  100. long idSelect = -1, BOOL fEmpty = TRUE);
  101. static void FillStringList(CComboBox * pcbc, const CColumnStrList & lstColStr,
  102. long idSelect = -1, BOOL fEmpty = TRUE);
  103. //------------------------------------------------------------------------------
  104. class LTAPIENTRY CColDefCB : public CObject
  105. {
  106. public:
  107. virtual int AddItem(const CLString & stName, long nID);
  108. virtual void SetCurSel(long nSelect);
  109. virtual void FillBool(BOOL fValue = TRUE, BOOL fEmpty = TRUE);
  110. virtual void FillStringList(const CColumnStrList & lstColStr, long idSelect = -1, BOOL fEmpty = TRUE);
  111. virtual void Empty();
  112. #ifdef _DEBUG
  113. virtual void AssertValid() const;
  114. #endif
  115. };
  116. //------------------------------------------------------------------------------
  117. class LTAPIENTRY CCheckBoxCB : public CColDefCB
  118. {
  119. public:
  120. CCheckBoxCB(CButton * pbtn);
  121. virtual void FillBool(BOOL fValue = TRUE, BOOL fEmpty = TRUE);
  122. #ifdef _DEBUG
  123. virtual void AssertValid() const;
  124. #endif
  125. protected:
  126. CButton * const m_pbtn;
  127. };
  128. //------------------------------------------------------------------------------
  129. class LTAPIENTRY CListBoxCB : public CColDefCB
  130. {
  131. public:
  132. CListBoxCB(CListBox * plbc);
  133. virtual int AddItem(const CLString & stName, long nID);
  134. virtual void SetCurSel(long nSelect);
  135. virtual void FillBool(BOOL fValue = TRUE, BOOL fEmpty = TRUE);
  136. virtual void FillStringList(const CColumnStrList & lstColStr, long idSelect = -1, BOOL fEmpty = TRUE);
  137. virtual void Empty();
  138. #ifdef _DEBUG
  139. virtual void AssertValid() const;
  140. #endif
  141. protected:
  142. CListBox * const m_plbc;
  143. };
  144. //------------------------------------------------------------------------------
  145. class LTAPIENTRY CComboBoxCB : public CColDefCB
  146. {
  147. public:
  148. CComboBoxCB(CComboBox * pcbc);
  149. virtual int AddItem(const CLString & stName, long nID);
  150. virtual void SetCurSel(long nSelect);
  151. virtual void FillBool(BOOL fValue = TRUE, BOOL fEmpty = TRUE);
  152. virtual void FillStringList(const CColumnStrList & lstColStr, long idSelect = -1, BOOL fEmpty = TRUE);
  153. virtual void Empty();
  154. #ifdef _DEBUG
  155. virtual void AssertValid() const;
  156. #endif
  157. protected:
  158. CComboBox * const m_pcbc;
  159. };
  160. };
  161. LTAPIENTRY int AddListBoxItem(CListBox * plbc, const CLString & stAdd, DWORD dwItemData);
  162. LTAPIENTRY int AddComboBoxItem(CComboBox * pcbc, const CLString & stAdd, DWORD dwItemData);
  163. LTAPIENTRY int AddListBoxItem(CListBox * plbc, HINSTANCE hDll, UINT nStringID, DWORD dwItemData);
  164. LTAPIENTRY int AddComboBoxItem(CComboBox * pcbc, HINSTANCE hDll, UINT nStringID, DWORD dwItemData);
  165. LTAPIENTRY void GetBoolValue(BOOL fValue, CLString & stValue);
  166. #pragma warning(default:4275) // Exported classes