Source code of Windows XP (NT5)
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.

209 lines
6.4 KiB

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