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.

378 lines
9.2 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. openfile.hxx
  7. Class declarations for the OPENS_DIALOG, OPENS_LISTBOX, and
  8. OPENS_LBI classes.
  9. The OPENS_DIALOG is used to show the remotely open files on a
  10. particular server. This listbox contains a [Close] button to
  11. allow the admin to close selected files.
  12. FILE HISTORY:
  13. NarenG 2-Oct-1992 Stole from server manager.
  14. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  15. */
  16. #ifndef _OPENFILE_HXX
  17. #define _OPENFILE_HXX
  18. #include <lmobj.hxx>
  19. #include <lmofile.hxx>
  20. #include <lmoersm.hxx>
  21. #include <lmoefile.hxx>
  22. #include <bltnslt.hxx>
  23. #include <strnumer.hxx>
  24. //
  25. // Number of columns in the OPEN FILES listbox
  26. //
  27. #define COLS_OF_LB_FILES 5
  28. /*************************************************************************
  29. NAME: OPENS_LBI
  30. SYNOPSIS: This class represents one item in the OPENS_LISTBOX.
  31. INTERFACE: OPENS_LBI - Class constructor.
  32. ~OPENS_LBI - Class destructor.
  33. Paint - Draw an item.
  34. QueryLeadingChar - Query the first character for
  35. the keyboard interface.
  36. Compare - Compare two items.
  37. QueryUserName - Query the user name for this item.
  38. QueryPath - Returns the pathname for this
  39. item.
  40. QueryFileID - Returns the file ID for this
  41. item.
  42. PARENT: LBI
  43. USES: DEC_STR
  44. NLS_STR
  45. DMID_DTE
  46. HISTORY:
  47. NarenG 2-Oct-1992 Stole from server manager.
  48. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  49. **************************************************************************/
  50. class OPENS_LBI : public LBI
  51. {
  52. private:
  53. //
  54. // These data members represent the various
  55. // columns to be displayed in the listbox.
  56. //
  57. NLS_STR _nlsUserName;
  58. NLS_STR _nlsOpenMode;
  59. DEC_STR _nlsNumLocks;
  60. NLS_STR _nlsPath;
  61. DWORD _dwForkType;
  62. //
  63. // This is the file ID of the remote
  64. // file which this LBI represents.
  65. //
  66. DWORD _dwFileID;
  67. //
  68. // The Open Mode bitmask.
  69. //
  70. DWORD _dwOpenMode;
  71. protected:
  72. //
  73. // This method paints a single item into the listbox.
  74. //
  75. virtual VOID Paint( LISTBOX * plb,
  76. HDC hdc,
  77. const RECT * prect,
  78. GUILTT_INFO * pGUILTT ) const;
  79. //
  80. // This method compares two listbox items. This
  81. // is used for sorting the listbox.
  82. //
  83. virtual INT Compare( const LBI * plbi ) const;
  84. //
  85. // This method returns the first character in the
  86. // listbox item. This is used for the listbox
  87. // keyboard interface.
  88. //
  89. virtual WCHAR QueryLeadingChar() const;
  90. public:
  91. //
  92. // Usual constructor/destructor goodies.
  93. //
  94. OPENS_LBI( DWORD dwFileId,
  95. const TCHAR * pszUserName,
  96. DWORD dwOpenMode,
  97. DWORD dwForkType,
  98. DWORD dwNumLocks,
  99. const TCHAR * pszPath );
  100. virtual ~OPENS_LBI();
  101. const TCHAR * QueryUserName() const
  102. { return _nlsUserName.QueryPch(); }
  103. const TCHAR * QueryPath() const
  104. { return _nlsPath.QueryPch(); }
  105. BOOL IsOpenForWrite() const;
  106. ULONG QueryFileID() const
  107. { return _dwFileID; }
  108. }; //OPENS_LBI
  109. /*************************************************************************
  110. NAME: OPENS_LISTBOX
  111. SYNOPSIS: This listbox displays the files open on a server.
  112. INTERFACE: OPENS_LISTBOX - Class constructor.
  113. ~OPENS_LISTBOX - Class destructor.
  114. Refresh - Refresh the list of open files.
  115. Fill - Fills the listbox with the
  116. files open on the target server.
  117. QueryColumnWidths - Called by OPENS_LBI::Paint(),
  118. this is the column width table
  119. used for painting the listbox
  120. items.
  121. PARENT: BLT_LISTBOX
  122. USES: NLS_STR
  123. DMID_DTE
  124. HISTORY:
  125. NarenG 2-Oct-1992 Stole from server manager.
  126. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  127. **************************************************************************/
  128. class OPENS_LISTBOX : public BLT_LISTBOX
  129. {
  130. private:
  131. //
  132. // Represents the target server
  133. //
  134. AFP_SERVER_HANDLE _hServer;
  135. //
  136. // Cumulative number of locks
  137. //
  138. DWORD _dwNumLocks;
  139. //
  140. // Fork type bitmaps
  141. //
  142. DMID_DTE _dmdteDataFork;
  143. DMID_DTE _dmdteResourceFork;
  144. protected:
  145. //
  146. // This array contains the column widths used
  147. // while painting the listbox item.
  148. //
  149. UINT _adx[COLS_OF_LB_FILES];
  150. public:
  151. //
  152. // Usual constructor/destructor goodies.
  153. //
  154. OPENS_LISTBOX( OWNER_WINDOW * powOwner,
  155. CID cid,
  156. AFP_SERVER_HANDLE hServer );
  157. ~OPENS_LISTBOX();
  158. //
  159. // The following macro will declare (& define) a new
  160. // QueryItem() method which will return an OPENS_LBI *.
  161. //
  162. DECLARE_LB_QUERY_ITEM( OPENS_LBI )
  163. //
  164. // Methods that fill and refresh the listbox.
  165. //
  166. DWORD Fill( VOID );
  167. DWORD Refresh( VOID );
  168. //
  169. // This method is called by the OPENS_LBI::Paint()
  170. // method for retrieving the column width table.
  171. //
  172. const UINT * QueryColumnWidths() const
  173. { return _adx; }
  174. DWORD QueryLockCount() const
  175. { return _dwNumLocks; }
  176. DMID_DTE *QueryDataForkBitmap( VOID ) { return &_dmdteDataFork; }
  177. DMID_DTE *QueryResourceForkBitmap( VOID ) { return &_dmdteResourceFork; }
  178. }; // class OPENS_LISTBOX
  179. /*************************************************************************
  180. NAME: OPENS_DIALOG
  181. SYNOPSIS: This class represents the Open Resources dialog which is
  182. invoked from the Shared Files subproperty dialog.
  183. INTERFACE: OPENS_DIALOG - Class constructor.
  184. ~OPENS_DIALOG - Class destructor.
  185. OnCommand - Called when the user presses one
  186. of the Close buttons.
  187. QueryHelpContext - Called when the user presses "F1"
  188. or the "Help" button. Used for
  189. selecting the appropriate help
  190. text for display.
  191. Refresh - Refreshes the dialog.
  192. CloseFile - Worker function to close a single
  193. file.
  194. PARENT: DIALOG_WINDOW
  195. USES: OPENS_LISTBOX
  196. NLS_STR
  197. SLT
  198. PUSH_BUTTON
  199. HISTORY:
  200. NarenG 2-Oct-1992 Stole from server manager.
  201. Merged OPEN_DIALOG_BASE with OPENS_DIALIG
  202. **************************************************************************/
  203. class OPENS_DIALOG : public DIALOG_WINDOW
  204. {
  205. private:
  206. //
  207. // This listbox contains the open resource from the
  208. // target server.
  209. //
  210. OPENS_LISTBOX _lbFiles;
  211. //
  212. // remember the server and base path
  213. //
  214. NLS_STR _nlsServer;
  215. //
  216. // These two data members are used to display the
  217. // open resources & file locks statistics.
  218. //
  219. DEC_SLT _sltOpenCount;
  220. DEC_SLT _sltLockCount;
  221. PUSH_BUTTON _pbOk;
  222. //
  223. // These push buttons are used to close selected/all
  224. // open resources. The IDs are also kept so the base class
  225. // knows how to deal with them duriong OnCommand().
  226. //
  227. PUSH_BUTTON _pbClose;
  228. PUSH_BUTTON _pbCloseAll;
  229. //
  230. // This push button is used to refresh the dialog.
  231. //
  232. PUSH_BUTTON _pbRefresh;
  233. AFP_SERVER_HANDLE _hServer;
  234. //
  235. // This method is to warn the user before closing resources.
  236. //
  237. BOOL WarnCloseMulti( VOID );
  238. protected:
  239. //
  240. // This method is called whenever a control
  241. // is sending us a command. This is where
  242. // we handle the Close & Close All buttons.
  243. //
  244. virtual BOOL OnCommand( const CONTROL_EVENT & event );
  245. //
  246. // Called during help processing to select the appropriate
  247. // help text for display.
  248. //
  249. virtual ULONG QueryHelpContext( VOID );
  250. //
  251. // This method refreshes the dialog.
  252. //
  253. DWORD Refresh( VOID );
  254. public:
  255. //
  256. // Usual constructor/destructor goodies.
  257. //
  258. OPENS_DIALOG( HWND hwndOwner,
  259. AFP_SERVER_HANDLE hServer,
  260. const TCHAR * pszServerName );
  261. ~OPENS_DIALOG();
  262. const TCHAR * QuerySeverName() const
  263. { return _nlsServer.QueryPch(); }
  264. }; // class OPENS_DIALOG
  265. #endif // _OPENFILE_HXX