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.

586 lines
14 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. volumes.hxx
  7. Class declarations for the VOLUMES_DIALOG, VOLUMES_LISTBOX, and
  8. VOLUMES_LBI classes.
  9. These classes implement the Server Manager Shared Volumes subproperty
  10. sheet. The VOLUMES_LISTBOX/VOLUMES_LBI classes implement the listbox
  11. which shows the available sharepoints. VOLUMES_DIALOG implements the
  12. actual dialog box.
  13. FILE HISTORY:
  14. NarenG 02-Oct-1993 Stole from Server Manager and folded
  15. BASE_RES_DIALOG and FILES_DIALOG into one.
  16. */
  17. #ifndef _VOLUMES_HXX
  18. #define _VOLUMES_HXX
  19. #include <bltnslt.hxx>
  20. #include <strnumer.hxx>
  21. #include <strelaps.hxx>
  22. //
  23. // Number of columns in USERS and volumes listboxes
  24. //
  25. #define COLS_SV_LB_USERS 4
  26. #define COLS_SV_LB_VOLUMES 4
  27. /*************************************************************************
  28. NAME: USERS_LBI
  29. SYNOPSIS: This class represents one item in the USERS_LISTBOX.
  30. INTERFACE: USERS_LBI - Class constructor.
  31. ~USERS_LBI - Class destructor.
  32. Paint - Draw an item.
  33. QueryLeadingChar - Query the first character for
  34. the keyboard interface.
  35. Compare - Compare two items.
  36. QueryUserName - Query the user name for this item.
  37. QueryComputerName - Returns the computer name
  38. associated with this item.
  39. PARENT: LBI
  40. HISTORY:
  41. NarenG 02-Oct-1993 Stole from Server Manager and folded
  42. BASE_RES_DIALOG and FILES_DIALOG into one.
  43. **************************************************************************/
  44. class USERS_LBI : public LBI
  45. {
  46. private:
  47. //
  48. // These data members represent the various
  49. // columns to be displayed in the listbox.
  50. //
  51. DMID_DTE * _pdte;
  52. NLS_STR _nlsUserName;
  53. NLS_STR _nlsInUse;
  54. ELAPSED_TIME_STR _nlsTime;
  55. DWORD _cOpens;
  56. DWORD _dwConnectionId;
  57. protected:
  58. //
  59. // This method paints a single item into the listbox.
  60. //
  61. virtual VOID Paint( LISTBOX * plb,
  62. HDC hdc,
  63. const RECT * prect,
  64. GUILTT_INFO * pGUILTT ) const;
  65. //
  66. // This method returns the first character in the
  67. // listbox item. This is used for the listbox
  68. // keyboard interface.
  69. //
  70. virtual WCHAR QueryLeadingChar( VOID ) const;
  71. //
  72. // This method compares two listbox items. This
  73. // is used for sorting the listbox.
  74. //
  75. virtual INT Compare( const LBI * plbi ) const;
  76. public:
  77. //
  78. // Usual constructor/destructor goodies.
  79. //
  80. USERS_LBI( DWORD dwConnectionId,
  81. const TCHAR * pszUserName,
  82. ULONG ulTime,
  83. DWORD cOpens,
  84. TCHAR chTimeSep,
  85. DMID_DTE * pdte );
  86. virtual ~USERS_LBI();
  87. //
  88. // Retrieve the user name associated with
  89. // this listbox item.
  90. //
  91. const TCHAR * QueryUserName( VOID ) const
  92. { return _nlsUserName.QueryPch(); }
  93. //
  94. // Retrieve the Id of this connection.
  95. //
  96. DWORD QueryConnectionId( VOID ) const
  97. { return _dwConnectionId; }
  98. DWORD QueryNumOpens( VOID ) const
  99. { return _cOpens; }
  100. }; // class USERS_LBI
  101. /*************************************************************************
  102. NAME: USERS_LISTBOX
  103. SYNOPSIS: This listbox displays the users connected to a
  104. particular sharepoint.
  105. INTERFACE: USERS_LISTBOX - Class constructor.
  106. ~USERS_LISTBOX - Class destructor.
  107. Fill - Fill the user list.
  108. Refresh - Refresh the user list.
  109. QueryColumnWidths - Called by USERS_LBI::Paint(),
  110. this is the column width table
  111. used for painting the listbox
  112. items.
  113. PARENT: BLT_LISTBOX
  114. USES: SERVER_2
  115. HISTORY:
  116. NarenG 02-Oct-1993 Stole from Server Manager and folded
  117. BASE_RES_DIALOG and FILES_DIALOG into one.
  118. **************************************************************************/
  119. class USERS_LISTBOX : public BLT_LISTBOX
  120. {
  121. private:
  122. //
  123. // This array contains the column widths used
  124. // while painting the listbox item. This array
  125. // is generated by the BuildColumnWidthTable()
  126. // function.
  127. //
  128. UINT _adx[COLS_SV_LB_USERS];
  129. //
  130. // This represents the target server.
  131. //
  132. AFP_SERVER_HANDLE _hServer;
  133. //
  134. // This is the cute little icon which is displayed
  135. // in each of the USERS_LBI listbox items.
  136. //
  137. DMID_DTE _dteIcon;
  138. //
  139. // This is the time separator. It is retrieved from
  140. // WIN.INI (section=intl, key=sTime). If this
  141. // cannot be retrieved from WIN.INI, then ':' is
  142. // used by default.
  143. //
  144. TCHAR _chTimeSep; // BUGBUG: Unicode?
  145. public:
  146. //
  147. // Usual constructor/destructor goodies.
  148. //
  149. USERS_LISTBOX( OWNER_WINDOW * powOwner,
  150. CID cid,
  151. AFP_SERVER_HANDLE hServer );
  152. ~USERS_LISTBOX();
  153. //
  154. // This method fills the listbox with the connected
  155. // users.
  156. //
  157. DWORD Fill( DWORD dwVolumeId );
  158. //
  159. // This method refreshes the listbox. It is responsible
  160. // for maintaining the selection & appearance of the
  161. // listbox.
  162. //
  163. DWORD Refresh( DWORD dwVolumeId );
  164. //
  165. // This method is called by the USERS_LBI::Paint()
  166. // method for retrieving the column width table.
  167. //
  168. const UINT * QueryColumnWidths( VOID ) const
  169. { return _adx; }
  170. //
  171. // This method will return TRUE if any user in the
  172. // listbox has any resource open.
  173. //
  174. BOOL AreResourcesOpen( VOID ) const;
  175. //
  176. // The following macro will declare (& define) a new
  177. // QueryItem() method which will return an USERS_LBI *.
  178. //
  179. DECLARE_LB_QUERY_ITEM( USERS_LBI )
  180. }; // class USERS_LISTBOX
  181. /*************************************************************************
  182. NAME: VOLUMES_LBI
  183. SYNOPSIS: A single item to be displayed in VOLUMES_LISTBOX.
  184. INTERFACE: VOLUMES_LBI - Constructor. Takes a sharepoint
  185. name, a path, and a count of the
  186. number of users using the share.
  187. ~VOLUMES_LBI - Destructor.
  188. Paint - Paints the listbox item.
  189. QueryResourceName - Query the resource name from
  190. the listbox.
  191. SetResourceName - Sets the resource name for this
  192. listbox item.
  193. QueryLeadingChar - Query the item's first character
  194. (for the keyboard interface).
  195. Compare - Compare two items.
  196. PARENT: LBI
  197. USES: NLS_STR
  198. HISTORY:
  199. NarenG 02-Oct-1993 Stole from Server Manager and folded
  200. BASE_RES_DIALOG and FILES_DIALOG into one.
  201. **************************************************************************/
  202. class VOLUMES_LBI : public LBI
  203. {
  204. private:
  205. //
  206. // The target resource id.
  207. //
  208. DWORD _dwVolumeId;
  209. //
  210. // The following data members represent the
  211. // various columns of the listbox.
  212. //
  213. DMID_DTE * _pdte;
  214. NLS_STR _nlsVolumeName;
  215. DEC_STR _nlsUses;
  216. NLS_STR _nlsPath;
  217. protected:
  218. //
  219. // This method paints a single item into the listbox.
  220. //
  221. virtual VOID Paint( LISTBOX * plb,
  222. HDC hdc,
  223. const RECT * prect,
  224. GUILTT_INFO * pGUILTT ) const;
  225. public:
  226. DWORD QueryVolumeId( VOID ) const
  227. { return _dwVolumeId; }
  228. const TCHAR * QueryVolumeName( VOID ) const
  229. { return _nlsVolumeName.QueryPch(); }
  230. const TCHAR * QueryPath( VOID ) const
  231. { return _nlsPath.QueryPch(); }
  232. //
  233. // The next two methods are used for listbox management.
  234. //
  235. virtual WCHAR QueryLeadingChar( VOID ) const;
  236. virtual INT Compare( const LBI * plbi ) const;
  237. //
  238. // This method is used to notify the LBI of a new "use" count.
  239. //
  240. virtual APIERR NotifyNewUseCount( DWORD cUses );
  241. //
  242. // Usual constructor/destructor goodies.
  243. //
  244. VOLUMES_LBI( DWORD dwVolumeId,
  245. const TCHAR * pszVolName,
  246. const TCHAR * pszPath,
  247. DWORD cUses,
  248. DMID_DTE * pdte );
  249. virtual ~VOLUMES_LBI();
  250. }; // class VOLUMES_LBI
  251. /*************************************************************************
  252. NAME: VOLUMES_LISTBOX
  253. SYNOPSIS: This listbox shows the sharepoints available on a
  254. target server.
  255. INTERFACE: VOLUMES_LISTBOX - Class constructor. Takes a
  256. pointer to the "owning" window,
  257. a CID, and a handle to the server
  258. being admiunistered.
  259. ~VOLUMES_LISTBOX - Class destructor.
  260. Fill - Fills the listbox with the
  261. available sharepoints.
  262. Refresh - Refresh listbox contents.
  263. QueryColumnWidths - Returns pointer to col width table.
  264. QueryServer - Query the target server name.
  265. PARENT: BLT_LISTBOX
  266. USES: DMID_DTE
  267. HISTORY:
  268. NarenG 02-Oct-1993 Stole from Server Manager and folded
  269. BASE_RES_DIALOG and FILES_DIALOG into one.
  270. **************************************************************************/
  271. class VOLUMES_LISTBOX : public BLT_LISTBOX
  272. {
  273. private:
  274. //
  275. // This s the cute little icon displayed in the VOLUMES
  276. // listbox.
  277. //
  278. DMID_DTE _dteDisk;
  279. //
  280. // This data member represents the target server.
  281. //
  282. const AFP_SERVER_HANDLE _hServer;
  283. //
  284. // The column width table.
  285. //
  286. UINT _adx[COLS_SV_LB_VOLUMES];
  287. public:
  288. //
  289. // The following method is called whenever the listbox needs
  290. // to be refreshed (i.e. while the dialog is active). This
  291. // method is responsible for maintaining (as much as possible)
  292. // the current state of any selected item.
  293. //
  294. DWORD Refresh( VOID );
  295. //
  296. // This method returns a pointer to the column width table.
  297. //
  298. const UINT * QueryColumnWidths( VOID ) const
  299. { return _adx; }
  300. //
  301. // Usual constructor\destructor goodies.
  302. //
  303. //
  304. VOLUMES_LISTBOX( OWNER_WINDOW * powner,
  305. CID cid,
  306. AFP_SERVER_HANDLE hServer );
  307. ~VOLUMES_LISTBOX();
  308. //
  309. // This method fills the listbox with the available sharepoints.
  310. //
  311. virtual DWORD Fill( VOID );
  312. //
  313. // The following macro will declare (& define) a new
  314. // QueryItem() method which will return a VOLUMES_LBI *.
  315. //
  316. DECLARE_LB_QUERY_ITEM( VOLUMES_LBI )
  317. }; // class VOLUMES_LISTBOX
  318. /*************************************************************************
  319. NAME: VOLUMES_DIALOG
  320. SYNOPSIS: The class represents the Shared Volumes subproperty dialog
  321. of the Server Manager.
  322. INTERFACE: VOLUMES_DIALOG - Class constructor.
  323. ~VOLUMES_DIALOG - Class destructor.
  324. QueryHelpContext - Called when the user presses "F1"
  325. or the "Help" button. Used for
  326. selecting the appropriate help
  327. text for display.
  328. OnCommand - Called during command processing.
  329. Refresh - Refreshes the dialog window,
  330. including all contained listboxes.
  331. PARENT: SRV_BASE_DIALOG
  332. USES: VOLUMES_LISTBOX
  333. USERS_LISTBOX
  334. PUSH_BUTTON
  335. DEC_SLT
  336. HISTORY:
  337. NarenG 02-Oct-1993 Stole from Server Manager and folded
  338. BASE_RES_DIALOG and FILES_DIALOG into one.
  339. **************************************************************************/
  340. class VOLUMES_DIALOG : public DIALOG_WINDOW
  341. {
  342. private:
  343. //
  344. // This listbox contains the available sharepoints.
  345. //
  346. VOLUMES_LISTBOX _lbVolumes;
  347. //
  348. // This listbox contains the users connected to the
  349. // resource selected.
  350. //
  351. USERS_LISTBOX _lbUsers;
  352. //
  353. // The "Disconnect" and "Disconnect All" push buttons.
  354. //
  355. PUSH_BUTTON _pbDisconnect;
  356. PUSH_BUTTON _pbDisconnectAll;
  357. PUSH_BUTTON _pbOK;
  358. //
  359. // This member represents the display of the number of
  360. // connected users.
  361. //
  362. DEC_SLT _sltUsersCount;
  363. //
  364. // This represents the target server.
  365. //
  366. AFP_SERVER_HANDLE _hServer;
  367. protected:
  368. //
  369. // Called during help processing to select the appropriate
  370. // help text for display.
  371. //
  372. virtual ULONG QueryHelpContext( VOID );
  373. // Called during command processing, mainly to handle
  374. // commands from the graphical button bar.
  375. //
  376. virtual BOOL OnCommand( const CONTROL_EVENT & event );
  377. //
  378. // The following method is called to refresh the
  379. // dialog. It is responsible for refreshing all
  380. // of the associated listboxes and text fields.
  381. //
  382. virtual DWORD Refresh( VOID );
  383. public:
  384. //
  385. // Usual constructor\destructor goodies.
  386. //
  387. VOLUMES_DIALOG( HWND hWndOwner,
  388. AFP_SERVER_HANDLE hServer,
  389. const TCHAR * pszServerName );
  390. ~VOLUMES_DIALOG();
  391. }; // class VOLUMES_DIALOG
  392. #endif // _VOLUMES_HXX