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.

345 lines
9.6 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1992 **/
  4. /**********************************************************************/
  5. /*
  6. openfile.hxx
  7. Class declarations for the OPEN_DIALOG_BASE, OPEN_LBOX_BASE, and
  8. OPEN_LBI_BASE classes.
  9. The OPEN_DIALOG_BASE 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. KeithMo 01-Aug-1991 Created for the Server Manager.
  14. KeithMo 26-Aug-1991 Changes from code review attended by
  15. RustanL and EricCh.
  16. ChuckC 06-Oct-1991 Moved to applib.
  17. beng 05-Mar-1992 Use strnumer.hxx
  18. */
  19. #ifndef _OPENFILE_HXX
  20. #define _OPENFILE_HXX
  21. #include "strnumer.hxx"
  22. /*************************************************************************
  23. NAME: OPEN_LBI_BASE
  24. SYNOPSIS: This class represents one item in the OPEN_LBOX_BASE.
  25. INTERFACE: OPEN_LBI_BASE - Class constructor.
  26. ~OPEN_LBI_BASE - Class destructor.
  27. Paint - Draw an item.
  28. QueryLeadingChar - Query the first character for
  29. the keyboard interface.
  30. Compare - Compare two items.
  31. QueryUserName - Query the user name for this item.
  32. QueryFileID - Returns the file ID for this
  33. item.
  34. PARENT: LBI
  35. USES: NLS_STR, DEC_STR
  36. HISTORY:
  37. ChuckC 10/6/91 Created
  38. beng 05-Mar-1992 use DEC_STR
  39. **************************************************************************/
  40. DLL_CLASS OPEN_LBI_BASE : public LBI
  41. {
  42. protected:
  43. /*
  44. * These data members represent the various
  45. * columns to be displayed in the listbox.
  46. */
  47. NLS_STR _nlsUserName;
  48. NLS_STR _nlsAccess;
  49. DEC_STR _nlsLocks;
  50. NLS_STR _nlsPath;
  51. /*
  52. * This is the file ID of the remote
  53. * file which this LBI represents.
  54. */
  55. ULONG _ulFileID;
  56. /*
  57. * The permissions bitmask.
  58. */
  59. ULONG _uPermissions;
  60. /*
  61. * This method returns the first character in the
  62. * listbox item. This is used for the listbox
  63. * keyboard interface.
  64. */
  65. virtual WCHAR QueryLeadingChar() const;
  66. public:
  67. OPEN_LBI_BASE( const TCHAR *pszUserName,
  68. const TCHAR *pszPath,
  69. ULONG uPermissions,
  70. ULONG cLocks,
  71. ULONG ulFileID) ;
  72. virtual ~OPEN_LBI_BASE() ;
  73. const TCHAR * QueryUserName() const
  74. { return _nlsUserName.QueryPch(); }
  75. const TCHAR * QueryPath() const
  76. { return _nlsPath.QueryPch(); }
  77. ULONG QueryFileID() const
  78. { return _ulFileID; }
  79. const TCHAR * QueryAccessName( VOID ) const
  80. { return _nlsAccess; }
  81. ULONG QueryPermissions( VOID ) const
  82. { return _uPermissions; }
  83. };
  84. /*************************************************************************
  85. NAME: OPEN_LBOX_BASE
  86. SYNOPSIS: This listbox displays the files open on a server.
  87. INTERFACE: OPEN_LBOX_BASE - Class constructor.
  88. ~OPEN_LBOX_BASE - Class destructor.
  89. Refresh - Refresh the list of open files.
  90. Fill - Fills the listbox with the
  91. files open on the target server.
  92. QueryColumnWidths - Called by OPEN_LBI_BASE::Paint(),
  93. this is the column width table
  94. used for painting the listbox
  95. items.
  96. PARENT: BLT_LISTBOX
  97. USES: NLS_STR
  98. HISTORY:
  99. ChuckC 10/6/91 Created
  100. **************************************************************************/
  101. DLL_CLASS OPEN_LBOX_BASE : public BLT_LISTBOX
  102. {
  103. private:
  104. //
  105. // Server and qualifying path
  106. //
  107. NLS_STR _nlsServer ;
  108. NLS_STR _nlsBasePath ;
  109. protected:
  110. /*
  111. APIERR BuildColumnWidthTable( HWND hwndDialog,
  112. CID cidListbox,
  113. UINT cColumns,
  114. UINT *adx,
  115. BOOL bHaveIcon = FALSE) ;
  116. */
  117. virtual OPEN_LBI_BASE *CreateFileEntry(const FILE3_ENUM_OBJ *pfi3) = 0 ;
  118. //
  119. // This array contains the column widths used
  120. // while painting the listbox item. This array
  121. // is generated by the BuildColumnWidthTable()
  122. // function.
  123. //
  124. UINT _adx[5];
  125. public:
  126. OPEN_LBOX_BASE( OWNER_WINDOW *powOwner,
  127. CID cid,
  128. const NLS_STR &nlsServer,
  129. const NLS_STR &nlsBasePath );
  130. ~OPEN_LBOX_BASE();
  131. /*
  132. * Methods that fill and refresh the listbox.
  133. */
  134. APIERR Fill();
  135. APIERR Refresh();
  136. //
  137. // This method is called by the OPEN_LBI_BASE::Paint()
  138. // method for retrieving the column width table.
  139. //
  140. const UINT * QueryColumnWidths() const
  141. { return _adx; }
  142. //
  143. // The following macro will declare (& define) a new
  144. // QueryItem() method which will return an OPEN_LBI_BASE *.
  145. //
  146. DECLARE_LB_QUERY_ITEM( OPEN_LBI_BASE )
  147. };
  148. /*************************************************************************
  149. NAME: OPEN_DIALOG_BASE
  150. SYNOPSIS: This class represents the Open Resources dialog which is
  151. invoked from the Shared Files subproperty dialog.
  152. INTERFACE: OPEN_DIALOG_BASE - Class constructor.
  153. ~OPEN_DIALOG_BASE - Class destructor.
  154. OnCommand - Called when the user presses one
  155. of the Close buttons.
  156. QueryHelpContext - Called when the user presses "F1"
  157. or the "Help" button. Used for
  158. selecting the appropriate help
  159. text for display.
  160. Refresh - Refreshes the dialog.
  161. CloseFile - Worker function to close a single
  162. file.
  163. PARENT: DIALOG_WINDOW
  164. USES: OPEN_LBOX_BASE
  165. NLS_STR
  166. SLT
  167. PUSH_BUTTON
  168. HISTORY:
  169. KeithMo 01-Aug-1991 Created for the Server Manager.
  170. KeithMo 20-Aug-1991 Now inherits from PSEUDOSERVICE_DIALOG.
  171. KeithMo 20-Aug-1991 Now inherits from SRVPROP_OTHER_DIALOG.
  172. ChuckC 06-Oct-1991 Moved to applib as common dialog
  173. KeithMo 20-May-1992 Removed _nlsNotAvailable, uses "??" instead.
  174. beng 04-Aug-1992 Load dialogs by ordinal
  175. **************************************************************************/
  176. DLL_CLASS OPEN_DIALOG_BASE : public DIALOG_WINDOW
  177. {
  178. private:
  179. //
  180. // These two methods warn the user before closing resource(s).
  181. //
  182. BOOL WarnCloseSingle( OPEN_LBI_BASE * plbi );
  183. BOOL WarnCloseMulti( VOID );
  184. protected:
  185. //
  186. // These two data members are used to display the
  187. // open resources & file locks statistics.
  188. //
  189. SLT _sltOpenCount; // CODEWORK - NUMSLT
  190. SLT _sltLockCount; // CODEWORK - NUMSLT
  191. //
  192. // These push buttons are used to close selected/all
  193. // open resources. The IDs are also kept so the base class
  194. // knows how to deal with them duriong OnCommand().
  195. //
  196. PUSH_BUTTON _pbClose;
  197. PUSH_BUTTON _pbCloseAll;
  198. CID _idClose;
  199. CID _idCloseAll;
  200. //
  201. // We need an explicit OK button member so we can set the focus when
  202. // the close buttons are disabled.
  203. //
  204. PUSH_BUTTON _pbOK ;
  205. //
  206. // This method refreshes the dialog.
  207. //
  208. VOID Refresh();
  209. //
  210. // This method closes a specific remote file.
  211. // It is called once when the Close button is pressed,
  212. // and multiple times when the Close All button
  213. // is pressed.
  214. //
  215. VOID CloseFile( OPEN_LBI_BASE * polbi );
  216. //
  217. // This method is called whenever a control
  218. // is sending us a command. This is where
  219. // we handle the Close & Close All buttons.
  220. //
  221. virtual BOOL OnCommand( const CONTROL_EVENT & event );
  222. //
  223. // Called during help processing to select the appropriate
  224. // help text for display.
  225. //
  226. virtual ULONG QueryHelpContext();
  227. /*
  228. * remember the server and base path
  229. */
  230. NLS_STR _nlsServer ;
  231. NLS_STR _nlsBasePath ;
  232. /*
  233. * pointer to access the files listbox
  234. */
  235. OPEN_LBOX_BASE *_plbFiles ;
  236. public:
  237. //
  238. // Usual constructor/destructor goodies.
  239. //
  240. OPEN_DIALOG_BASE( HWND hwndOwner,
  241. UINT idDialog,
  242. CID sltOpenCount,
  243. CID sltLockCount,
  244. CID pbClose,
  245. CID pbCloseAll,
  246. const TCHAR *pszServer,
  247. const TCHAR *pszBasePath,
  248. OPEN_LBOX_BASE *plbFiles) ;
  249. ~OPEN_DIALOG_BASE();
  250. const TCHAR * QueryServer() const
  251. { return _nlsServer.QueryPch() ; }
  252. };
  253. #endif // _OPENFILE_HXX