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.

425 lines
9.8 KiB

  1. /**********************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1990, 1991 **/
  4. /**********************************************************************/
  5. /*
  6. SESSIONS.hxx
  7. Class declarations for the SESSIONS_DIALOG, SESSIONS_LISTBOX, and
  8. SESSIONS_LBI classes.
  9. These classes implement the Server Manager Shared SESSIONS subproperty
  10. sheet. The SESSIONS_LISTBOX/SESSIONS_LBI classes implement the listbox
  11. which shows the available sharepoints. SESSIONS_DIALOG implements the
  12. actual dialog box.
  13. FILE HISTORY:
  14. NarenG Stole from Server Manager
  15. */
  16. #ifndef _SESSIONS_HXX
  17. #define _SESSIONS_HXX
  18. #include <strnumer.hxx>
  19. #include <strelaps.hxx>
  20. //
  21. // The number of columns in the USERS and VOLUMES listboxes
  22. //
  23. #define COLS_UC_LB_USERS 5
  24. #define COLS_UC_LB_VOLUMES 4
  25. /*************************************************************************
  26. NAME: SESSIONS_LBI
  27. SYNOPSIS: A single item to be displayed in SESSIONS_DIALOG.
  28. INTERFACE: SESSIONS_LBI - Constructor. Takes a sharepoint
  29. name, a path, and a count of the
  30. number of users using the share.
  31. ~SESSIONS_LBI - Destructor.
  32. Paint - Paints the listbox item.
  33. PARENT: RESOURCE_LBI
  34. USES: NLS_STR
  35. DMID_DTE
  36. CAVEATS:
  37. NOTES:
  38. HISTORY:
  39. NarenG Stole from Server Manager
  40. **************************************************************************/
  41. class SESSIONS_LBI : public LBI
  42. {
  43. private:
  44. //
  45. // These data members represent the various
  46. // columns to be displayed in the listbox.
  47. //
  48. DMID_DTE _dteIcon;
  49. NLS_STR _nlsUserName;
  50. NLS_STR _nlsComputerName;
  51. DEC_STR _nlsConnections;
  52. DEC_STR _nlsOpens;
  53. ELAPSED_TIME_STR _nlsTime;
  54. DWORD _cOpens;
  55. DWORD _dwSessionId;
  56. protected:
  57. virtual VOID Paint( LISTBOX * plb,
  58. HDC hdc,
  59. const RECT * prect,
  60. GUILTT_INFO * pGUILTT ) const;
  61. public:
  62. SESSIONS_LBI( DWORD dwSessionId,
  63. const TCHAR * pszUserName,
  64. const TCHAR * pszComputerName,
  65. DWORD cConnections,
  66. DWORD cOpens,
  67. DWORD dwTime,
  68. TCHAR chTimeSep );
  69. ~SESSIONS_LBI();
  70. const TCHAR * QueryUserName( VOID )
  71. { return _nlsUserName.QueryPch(); }
  72. virtual WCHAR QueryLeadingChar( VOID ) const;
  73. virtual INT Compare( const LBI * plbi ) const;
  74. DWORD QueryNumOpens( VOID ) const
  75. { return _cOpens; }
  76. DWORD QuerySessionId( VOID ) const
  77. { return _dwSessionId; }
  78. APIERR SetNumOpens( DWORD cOpens );
  79. }; // class SESSIONS_LBI
  80. /*************************************************************************
  81. NAME: SESSIONS_LISTBOX
  82. SYNOPSIS: This listbox shows the sharepoints available on a
  83. target server.
  84. INTERFACE: SESSIONS_LISTBOX - Class constructor. Takes a
  85. pointer to the "owning" window,
  86. a CID, and a pointer to a
  87. SERVER_2 object.
  88. Fill - Fills the listbox with the
  89. available sharepoints.
  90. PARENT: RESOURCE_LISTBOX
  91. USES: None.
  92. CAVEATS: <<add caveats!!>> BUGBUG!!
  93. NOTES:
  94. HISTORY:
  95. NarenG Stole from Server Manager
  96. **************************************************************************/
  97. class SESSIONS_LISTBOX : public BLT_LISTBOX
  98. {
  99. private:
  100. //
  101. // The column width table.
  102. //
  103. UINT _adx[COLS_UC_LB_USERS];
  104. TCHAR _chTimeSep;
  105. //
  106. // This represents the target server.
  107. //
  108. AFP_SERVER_HANDLE _hServer;
  109. public:
  110. SESSIONS_LISTBOX( OWNER_WINDOW * powner,
  111. CID cid,
  112. AFP_SERVER_HANDLE hServer );
  113. //
  114. // This method returns a pointer to the column width table.
  115. //
  116. const UINT * QueryColumnWidths( VOID ) const
  117. { return _adx; }
  118. BOOL AreResourcesOpen( VOID ) const;
  119. DWORD Fill( VOID );
  120. DWORD Refresh( VOID );
  121. //
  122. // The following macro will declare (& define) a new
  123. // QueryItem() method which will return a SESSIONS_LBI *.
  124. //
  125. DECLARE_LB_QUERY_ITEM( SESSIONS_LBI )
  126. }; // class SESSIONS_LISTBOX
  127. /*************************************************************************
  128. NAME: RESOURCES_LBI
  129. SYNOPSIS: A single item to be displayed in RESOURCES_DIALOG.
  130. INTERFACE: RESOURCES_LBI - Constructor. Takes a sharepoint
  131. name, a path, and a count of the
  132. number of users using the share.
  133. ~RESOURCES_LBI - Destructor.
  134. Paint - Paints the listbox item.
  135. PARENT: RESOURCE_LBI
  136. USES: NLS_STR
  137. DMID_DTE
  138. CAVEATS:
  139. NOTES:
  140. HISTORY:
  141. NarenG Stole from Server Manager
  142. **************************************************************************/
  143. class RESOURCES_LBI : public LBI
  144. {
  145. private:
  146. //
  147. // These data members represent the various
  148. // columns to be displayed in the listbox.
  149. //
  150. DMID_DTE * _pdteBitmap;
  151. NLS_STR _nlsResourceName;
  152. DEC_STR _nlsOpens;
  153. ELAPSED_TIME_STR _nlsTime;
  154. protected:
  155. virtual VOID Paint( LISTBOX * plb,
  156. HDC hdc,
  157. const RECT * prect,
  158. GUILTT_INFO * pGUILTT ) const;
  159. public:
  160. RESOURCES_LBI( const TCHAR * pszResourceName,
  161. DWORD cOpens,
  162. DWORD dwTIme,
  163. TCHAR chTimeSep );
  164. ~RESOURCES_LBI();
  165. virtual WCHAR QueryLeadingChar( VOID ) const;
  166. virtual INT Compare( const LBI * plbi ) const;
  167. }; // class RESOURCES_LBI
  168. /*************************************************************************
  169. NAME: RESOURCES_LISTBOX
  170. SYNOPSIS: This listbox shows the sharepoints available on a
  171. target server.
  172. INTERFACE: RESOURCES_LISTBOX - Class constructor. Takes a
  173. pointer to the "owning" window,
  174. a CID, and a pointer to a
  175. SERVER_2 object.
  176. Fill - Fills the listbox with the
  177. available sharepoints.
  178. PARENT: RESOURCE_LISTBOX
  179. USES: None.
  180. CAVEATS: <<add caveats!!>> BUGBUG!!
  181. NOTES:
  182. HISTORY:
  183. NarenG Stole from Server Manager
  184. **************************************************************************/
  185. class RESOURCES_LISTBOX : public BLT_LISTBOX
  186. {
  187. private:
  188. //
  189. // The column width table.
  190. //
  191. UINT _adx[COLS_UC_LB_VOLUMES];
  192. //
  193. // Total number of opens accross all resources
  194. //
  195. DWORD _cOpens;
  196. TCHAR _chTimeSep;
  197. //
  198. // Represents the target server.
  199. //
  200. AFP_SERVER_HANDLE _hServer;
  201. public:
  202. RESOURCES_LISTBOX( OWNER_WINDOW * powner,
  203. CID cid,
  204. AFP_SERVER_HANDLE hServer);
  205. //
  206. // This method returns a pointer to the column width table.
  207. //
  208. const UINT * QueryColumnWidths( VOID ) const
  209. { return _adx; }
  210. const DWORD QueryNumOpens( VOID ) const
  211. { return _cOpens; }
  212. DWORD Fill( DWORD dwSessionId );
  213. DWORD Refresh( DWORD dwSessionId );
  214. //
  215. // The following macro will declare (& define) a new
  216. // QueryItem() method which will return a RESOURCES_LBI *.
  217. //
  218. DECLARE_LB_QUERY_ITEM( RESOURCES_LBI )
  219. }; // class RESOURCES_LISTBOX
  220. /*************************************************************************
  221. NAME: SESSIONS_DIALOG
  222. SYNOPSIS: The class represents the Shared SESSIONS subproperty dialog
  223. of the Server Manager.
  224. INTERFACE: SESSIONS_DIALOG() - Class constructor.
  225. OnCommand() - Handle user commands.
  226. QueryHelpContext - Called when the user presses "F1"
  227. or the "Help" button. Used for
  228. selecting the appropriate help
  229. text for display.
  230. PARENT: SRV_BASE_DIALOG
  231. USES: SESSIONS_LISTBOX
  232. PUSH_BUTTON
  233. NLS_STR
  234. DEC_SLT
  235. CAVEATS:
  236. NOTES:
  237. HISTORY:
  238. NarenG Stole from Server Manager
  239. **************************************************************************/
  240. class SESSIONS_DIALOG : public DIALOG_WINDOW
  241. {
  242. private:
  243. DEC_SLT _sltUsersConnected;
  244. SESSIONS_LISTBOX _lbSessions;
  245. RESOURCES_LISTBOX _lbResources;
  246. PUSH_BUTTON _pbOK;
  247. PUSH_BUTTON _pbDisc;
  248. PUSH_BUTTON _pbDiscAll;
  249. PUSH_BUTTON _pbSendMessage;
  250. //
  251. // Represents the target server.
  252. //
  253. AFP_SERVER_HANDLE _hServer;
  254. const TCHAR * _pszServerName;
  255. protected:
  256. virtual BOOL OnCommand( const CONTROL_EVENT & event );
  257. //
  258. // Called during help processing to select the appropriate
  259. // help text for display.
  260. //
  261. virtual ULONG QueryHelpContext( VOID );
  262. public:
  263. SESSIONS_DIALOG( HWND hWndOwner,
  264. AFP_SERVER_HANDLE hServer,
  265. const TCHAR * pszServerName );
  266. ~SESSIONS_DIALOG();
  267. DWORD Refresh( VOID );
  268. }; // class SESSIONS_DIALOG
  269. #endif // _SESSIONS_HXX