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.

374 lines
6.4 KiB

  1. /*+
  2. Copyright (C) Microsoft Corporation, 1996 - 1999
  3. All rights reserved.
  4. Module Name:
  5. portslv.hxx
  6. Abstract:
  7. Ports List View header
  8. Author:
  9. Albert Ting (AlbertT) 17-Aug-1995
  10. Steve Kiraly (SteveKi) 29-Mar-1996
  11. Revision History:
  12. --*/
  13. #ifndef _PORTLV_HXX
  14. #define _PORTLV_HXX
  15. /********************************************************************
  16. Ports list view control.
  17. ********************************************************************/
  18. class TPortsLV {
  19. SIGNATURE( 'ptlv' )
  20. SAFE_NEW
  21. ALWAYS_VALID
  22. public:
  23. TPortsLV::
  24. TPortsLV(
  25. VOID
  26. );
  27. TPortsLV::
  28. ~TPortsLV(
  29. VOID
  30. );
  31. BOOL
  32. bSetUI(
  33. IN HWND hwndLV,
  34. IN BOOL bTwoColumnMode,
  35. IN BOOL bSelectionState,
  36. IN BOOL bAllowSelectionChange,
  37. IN HWND hwnd = NULL,
  38. IN WPARAM wmDoubleClickMsg = 0,
  39. IN WPARAM wmSingleClickMsg = 0,
  40. IN WPARAM wmDeleteKeyMsg = 0
  41. );
  42. BOOL
  43. bReadUI(
  44. IN TString &strPortString,
  45. IN BOOL bSelectedPort = FALSE
  46. );
  47. BOOL
  48. bReloadPorts(
  49. IN LPCTSTR pszServerName,
  50. IN BOOL bSelect = FALSE
  51. );
  52. VOID
  53. vCheckPorts(
  54. LPTSTR strPortString
  55. );
  56. VOID
  57. vSelectPort(
  58. IN LPCTSTR strPortString
  59. );
  60. COUNT
  61. cSelectedPorts(
  62. VOID
  63. );
  64. COUNT
  65. cSelectedItems(
  66. VOID
  67. );
  68. VOID
  69. vEnable(
  70. IN BOOL bRetainSelection
  71. );
  72. VOID
  73. vDisable(
  74. IN BOOL bRetainSelection
  75. );
  76. BOOL
  77. bLocateAddedPort(
  78. IN LPCTSTR pszServerName,
  79. IN TString &strNewPort
  80. );
  81. BOOL
  82. bHandleNotifyMessage(
  83. IN LPARAM lParam
  84. );
  85. VOID
  86. vSelectItem(
  87. IN INT iItem
  88. );
  89. BOOL
  90. bDeletePorts(
  91. IN HWND hDlg,
  92. IN LPCTSTR pszServerName
  93. );
  94. BOOL
  95. bConfigurePort(
  96. IN HWND hDlg,
  97. IN LPCTSTR pszServer
  98. );
  99. VOID
  100. vSetSingleSelection(
  101. IN BOOL bSingleSelection
  102. );
  103. BOOL
  104. bGetSingleSelection(
  105. VOID
  106. );
  107. VOID
  108. vSetFocus(
  109. VOID
  110. );
  111. VOID
  112. vGetPortList(
  113. OUT LPTSTR pszPortList,
  114. IN COUNT cchSpaceLeft
  115. );
  116. VOID
  117. vRemoveAllChecks(
  118. VOID
  119. );
  120. private:
  121. enum _CONSTANTS {
  122. //
  123. // Listview and column header fromat
  124. //
  125. kListViewSBWidth = 16,
  126. kPortHeaderTitleMax = 80,
  127. kPortHeaderMax = 3,
  128. kPortHeaderWidthDefault = 125,
  129. //
  130. // Listview item states. Bit 12-15 hold the image state.
  131. //
  132. kStateUnchecked = 1 << 12,
  133. kStateChecked = 2 << 12,
  134. kStateMask = kStateChecked | kStateUnchecked | LVIS_STATEIMAGEMASK,
  135. //
  136. // Max port string,
  137. //
  138. kPortNameMax = MAX_PATH,
  139. //
  140. // Max ports list.
  141. //
  142. kPortListMax = kPortNameMax * 16
  143. };
  144. //
  145. // Port datahelper class need for sorting the list view.
  146. //
  147. class TPortData {
  148. public:
  149. TPortData(
  150. IN LPCTSTR pszName,
  151. IN LPCTSTR pszMonitor,
  152. IN LPCTSTR pszDescription,
  153. IN LPCTSTR pszPrinters
  154. );
  155. ~TPortData(
  156. VOID
  157. );
  158. BOOL
  159. bValid(
  160. VOID
  161. );
  162. DLINK( TPortData, PortData );
  163. TString _strName;
  164. TString _strMonitor;
  165. TString _strDescription;
  166. TString _strPrinters;
  167. private:
  168. //
  169. // Copying and assignment are not defined.
  170. //
  171. TPortData(
  172. const TPortData &
  173. );
  174. TPortData &
  175. operator =(
  176. const TPortData &
  177. );
  178. };
  179. TPortsLV::TPortData *
  180. AddPortDataList(
  181. IN LPCTSTR pszName,
  182. IN LPCTSTR pszMonitor,
  183. IN LPCTSTR pszDescription,
  184. IN LPCTSTR pszPrinters
  185. );
  186. BOOL
  187. DeletePortDataList(
  188. IN LPCTSTR pszName
  189. );
  190. BOOL
  191. bListViewSort(
  192. IN UINT uColumn
  193. );
  194. static
  195. INT
  196. CALLBACK
  197. iCompareProc(
  198. IN LPARAM lParam1,
  199. IN LPARAM lParam2,
  200. IN LPARAM RefData
  201. );
  202. VOID
  203. vCreatePortDataList(
  204. VOID
  205. );
  206. VOID
  207. vDestroyPortDataList(
  208. VOID
  209. );
  210. VOID
  211. vAddPortToListView(
  212. IN LPCTSTR pszName,
  213. IN LPCTSTR pszMonitor,
  214. IN LPCTSTR pszDescription,
  215. IN LPCTSTR pszPrinters
  216. );
  217. VOID
  218. vDeletePortFromListView(
  219. LPCTSTR pszName
  220. );
  221. INT
  222. iFindPort(
  223. IN LPCTSTR pszPort
  224. );
  225. INT
  226. iCheckPort(
  227. LPCTSTR pszPort
  228. );
  229. INT
  230. iSelectPort(
  231. IN LPCTSTR pszPort
  232. );
  233. BOOL
  234. bLocateAddedPort(
  235. IN OUT TString &strPort,
  236. IN PPORT_INFO_2 pPorts,
  237. IN DWORD cPorts,
  238. IN DWORD dwLevel
  239. );
  240. VOID
  241. vItemClicked(
  242. INT iItem
  243. );
  244. INT
  245. iGetPorts(
  246. VOID
  247. );
  248. VOID
  249. vPrintersUsingPort(
  250. IN OUT TString &strPrinters,
  251. IN PRINTER_INFO_2 *pPrinterInfo,
  252. IN DWORD cPrinterInfo,
  253. IN LPCTSTR pszPortName
  254. );
  255. BOOL
  256. bGetSelectedPort(
  257. IN LPTSTR pszPort,
  258. IN COUNT cchPort
  259. );
  260. BOOL
  261. bGetSelectedPort(
  262. IN LPTSTR pszPort,
  263. IN COUNT cchPort,
  264. INT *pItem
  265. );
  266. VOID
  267. vHandleItemClicked(
  268. IN LPARAM lParam
  269. );
  270. VOID
  271. vInsertPortsByMask(
  272. IN UINT cPorts,
  273. IN PORT_INFO_2 pPorts[],
  274. IN UINT cPrinters,
  275. IN PRINTER_INFO_2 pPrinters[],
  276. IN DWORD dwLevel,
  277. IN LPCTSTR pszTemplate = NULL,
  278. IN LPCTSTR pszDescription = NULL
  279. );
  280. COUNT _cLVPorts;
  281. HWND _hwndLV;
  282. BOOL _bSelectionState;
  283. BOOL _bSingleSelection;
  284. BOOL _bTwoColumnMode;
  285. INT _iSelectedItem;
  286. UINT _uCurrentColumn;
  287. TBitArray _ColumnSortState;
  288. BOOL _bAllowSelectionChange;
  289. BOOL _bHideFaxPorts;
  290. HWND _hwnd;
  291. WPARAM _wmDoubleClickMsg;
  292. WPARAM _wmSingleClickMsg;
  293. WPARAM _wmDeleteKeyMsg;
  294. DLINK_BASE( TPortData, PortDataList, PortData );
  295. };
  296. #endif