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.

326 lines
5.5 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1996 - 1999
  3. All rights reserved.
  4. Module Name:
  5. driverlv.hxx
  6. Abstract:
  7. Driver List View Header
  8. Author:
  9. Steve Kiraly (SteveKi) 19-Nov-1996
  10. Revision History:
  11. --*/
  12. #ifndef _DRIVERLV_HXX
  13. #define _DRIVERLV_HXX
  14. /********************************************************************
  15. Forward reference.
  16. ********************************************************************/
  17. class TDriversLVNotify;
  18. /********************************************************************
  19. Drivers list view control.
  20. ********************************************************************/
  21. class TDriversLV {
  22. SIGNATURE( 'drlv' )
  23. ALWAYS_VALID
  24. public:
  25. enum EConstants {
  26. kEnumDriversLevel = 3,
  27. kDriverHeaderMax = 3,
  28. kDriverDefaultHeaderWidth = 40,
  29. kMaxDriverInfo = 4,
  30. };
  31. enum EColumns {
  32. kDriverNameColumn,
  33. kEnvironmentColumn,
  34. kVersionColumn,
  35. kMaxColumn,
  36. };
  37. enum EOrder {
  38. kAscending,
  39. kDecending,
  40. };
  41. class THandle{
  42. public:
  43. THandle( VOID ) : _iIndex( -1 ) { }
  44. VOID vReset( VOID ) { _iIndex = -1; }
  45. INT Index( VOID ) { return _iIndex; }
  46. VOID Index( INT iIndex ) { _iIndex = iIndex; }
  47. private:
  48. INT _iIndex;
  49. };
  50. TDriversLV(
  51. VOID
  52. );
  53. ~TDriversLV(
  54. VOID
  55. );
  56. BOOL
  57. bSetUI(
  58. IN LPCTSTR pszServerName,
  59. IN HWND hwnd,
  60. IN WPARAM wmDblClickMsg = 0,
  61. IN WPARAM wmSingleClickMsg = 0,
  62. IN WPARAM wmDeleteKeyMsg = 0
  63. );
  64. BOOL
  65. bIsAnyItemSelcted(
  66. VOID
  67. ) const;
  68. BOOL
  69. bHandleMessage(
  70. IN UINT uMsg,
  71. IN WPARAM wParam,
  72. IN LPARAM lParam
  73. );
  74. BOOL
  75. bRefresh(
  76. VOID
  77. );
  78. BOOL
  79. bGetSelectedDriverInfo(
  80. IN TDriverInfo **ppDriverInfo,
  81. IN TDriversLV::THandle &Handle
  82. ) const;
  83. BOOL
  84. bGetSelectedDriverInfo(
  85. IN TDriverTransfer &DriverTransfer,
  86. IN UINT *pnCount = NULL
  87. );
  88. VOID
  89. vDeleteDriverInfoFromListView(
  90. IN TDriverInfo *pDriverInfo
  91. );
  92. VOID
  93. vDeleteDriverInfoFromListView(
  94. IN TDriverTransfer &DriverTransfer
  95. );
  96. BOOL
  97. bAddDriverInfoToListView(
  98. IN TDriverInfo *pDriverInfo,
  99. IN BOOL bCheckForDuplicates = TRUE
  100. );
  101. BOOL
  102. bAddDriverInfoToListView(
  103. IN TDriverTransfer &DriverTransfer
  104. );
  105. VOID
  106. vDeleteAllListViewItems(
  107. VOID
  108. );
  109. BOOL
  110. bSendDriverInfoNotification(
  111. IN TDriversLVNotify &Notify
  112. ) const;
  113. UINT
  114. uGetListViewItemCount(
  115. VOID
  116. ) const;
  117. VOID
  118. vSelectItem(
  119. IN UINT iIndex
  120. );
  121. BOOL
  122. bSortColumn(
  123. IN const EColumns Column,
  124. IN const EOrder Order = kAscending
  125. );
  126. BOOL
  127. bGetFullDriverList(
  128. IN TDriverTransfer &DriverTransfer,
  129. IN UINT *pnCount = NULL
  130. );
  131. VOID
  132. vDumpList(
  133. VOID
  134. );
  135. VOID
  136. vReturnDriverInfoToListView(
  137. IN TDriverInfo *pDriverInfo
  138. );
  139. VOID
  140. vReturnDriverInfoToListView(
  141. IN TDriverTransfer &DriverTransfer
  142. );
  143. UINT
  144. uGetSelectedDriverInfoCount(
  145. VOID
  146. ) const;
  147. private:
  148. //
  149. // Copying and assignment are not defined.
  150. //
  151. TDriversLV(
  152. const TDriversLV &
  153. );
  154. TDriversLV &
  155. operator =(
  156. const TDriversLV &
  157. );
  158. BOOL
  159. bLoadDrivers(
  160. VOID
  161. );
  162. VOID
  163. vRelease(
  164. VOID
  165. );
  166. BOOL
  167. bGetItemData(
  168. IN INT iItem,
  169. IN TDriverInfo **ppDriverInfo
  170. ) const;
  171. VOID
  172. vAddDriverToListView(
  173. IN TDriverInfo *pDriverInfo
  174. );
  175. BOOL
  176. bDriverListViewSort(
  177. UINT uColumn
  178. );
  179. static
  180. INT
  181. CALLBACK
  182. iCompareProc(
  183. IN LPARAM lParam1,
  184. IN LPARAM lParam2,
  185. IN LPARAM lParamSort
  186. );
  187. INT
  188. iFindDriver(
  189. IN TDriverInfo *pDriverInfo
  190. ) const;
  191. BOOL
  192. bFindDriverInfo(
  193. IN TDriverInfo *pDriverInfo,
  194. IN TDriverInfo **ppDriverInfo
  195. ) const;
  196. BOOL
  197. bGetSelectedItem(
  198. IN INT *pIndex
  199. ) const;
  200. VOID
  201. vAddInSortedOrder(
  202. IN TDriverInfo *pDriverInfo
  203. );
  204. HWND _hwnd;
  205. HWND _hwndLV;
  206. UINT _cLVDrivers;
  207. WPARAM _wmDoubleClickMsg;
  208. WPARAM _wmSingleClickMsg;
  209. WPARAM _wmDeleteKeyMsg;
  210. TBitArray _ColumnSortState;
  211. UINT _uCurrentColumn;
  212. TString _strServerName;
  213. DLINK_BASE( TDriverInfo, DriverInfoList, DriverInfo );
  214. };
  215. /********************************************************************
  216. Drivers list view callback
  217. ********************************************************************/
  218. class TDriversLVNotify {
  219. SIGNATURE( 'dlvn' )
  220. ALWAYS_VALID
  221. public:
  222. TDriversLVNotify(
  223. VOID
  224. );
  225. virtual
  226. ~TDriversLVNotify(
  227. VOID
  228. );
  229. virtual
  230. BOOL
  231. bNotify(
  232. IN TDriverInfo *pDriverInfo
  233. ) = 0;
  234. private:
  235. //
  236. // Operator = and copy are not defined.
  237. //
  238. TDriversLVNotify &
  239. operator =(
  240. const TDriversLVNotify &
  241. );
  242. TDriversLVNotify(
  243. const TDriversLVNotify &
  244. );
  245. };
  246. #endif