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.

438 lines
9.6 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. assoc.hxx
  7. This file contains the FILE_ASSOCIATION class definition
  8. FILE HISTORY:
  9. NarenG 12/4/92 Created
  10. */
  11. #ifndef _ASSOC_HXX_
  12. #define _ASSOC_HXX_
  13. #define COLS_FA_LB_TYPE_CREATORS 3
  14. /*************************************************************************
  15. NAME: TYPE_CREATOR_LBI
  16. SYNOPSIS: This class represents one item in the TYPE_CREATOR_LISTBOX.
  17. INTERFACE: TYPE_CREATOR_LBI - Class constructor.
  18. ~TYPE_CREATOR_LBI - Class destructor.
  19. Paint - Draw an item.
  20. QueryLeadingChar - Query the first character for
  21. the keyboard interface.
  22. Compare - Compare two items.
  23. PARENT: LBI
  24. HISTORY:
  25. NarenG 04-Dec-1992 Created.
  26. **************************************************************************/
  27. class TYPE_CREATOR_LBI : public LBI
  28. {
  29. private:
  30. NLS_STR _nlsType;
  31. NLS_STR _nlsCreator;
  32. NLS_STR _nlsComment;
  33. DWORD _dwId;
  34. protected:
  35. //
  36. // This method paints a single item into the listbox.
  37. //
  38. virtual VOID Paint( LISTBOX * plb,
  39. HDC hdc,
  40. const RECT * prect,
  41. GUILTT_INFO * pGUILTT ) const;
  42. //
  43. // This method returns the first character in the
  44. // listbox item. This is used for the listbox
  45. // keyboard interface.
  46. //
  47. virtual WCHAR QueryLeadingChar( VOID ) const;
  48. //
  49. // This method compares two listbox items. This
  50. // is used for sorting the listbox.
  51. //
  52. virtual INT Compare( const LBI * plbi ) const;
  53. public:
  54. //
  55. // Usual constructor/destructor goodies.
  56. //
  57. TYPE_CREATOR_LBI( PAFP_TYPE_CREATOR pAfpTypeCreator );
  58. ~TYPE_CREATOR_LBI();
  59. const TCHAR * QueryType( VOID ) const
  60. { return _nlsType.QueryPch(); }
  61. const TCHAR * QueryCreator( VOID ) const
  62. { return _nlsCreator.QueryPch(); }
  63. const TCHAR * QueryComment( VOID ) const
  64. { return _nlsComment.QueryPch(); }
  65. DWORD QueryId( VOID ) const
  66. { return _dwId; }
  67. }; // class TYPE_CREATOR_LBI
  68. /*************************************************************************
  69. NAME: EXTENSION_COMBOBOX
  70. SYNOPSIS: This combobox shows all the currently associated extensions
  71. INTERFACE: EXTENSION_COMBOBOX - Class constructor. Takes a
  72. pointer to the "owning" window,
  73. a CID, and the max. length of the
  74. SLE.
  75. ~EXTENSION_COMBOBOX - Class destructor.
  76. Fill - Fills the listbox with the
  77. currently added type/creators.
  78. Refresh - Refresh listbox contents.
  79. QueryColumnWidths - Returns pointer to col width table.
  80. PARENT: COMBOBOX
  81. HISTORY:
  82. NarenG 04-Dec-1992 Created
  83. **************************************************************************/
  84. class EXTENSION_COMBOBOX : public COMBOBOX
  85. {
  86. private:
  87. PAFP_EXTENSION _pExtensions;
  88. public:
  89. //
  90. // Updates the combobox
  91. //
  92. DWORD Update( DWORD nExtensions, PAFP_EXTENSION pAfpExtensions );
  93. DWORD QueryCurrentItemId( VOID ) const;
  94. DWORD QueryItemId( INT Index ) const;
  95. //
  96. // Usual constructor\destructor goodies.
  97. //
  98. //
  99. EXTENSION_COMBOBOX( OWNER_WINDOW * powner,
  100. CID cid,
  101. INT sleSize );
  102. ~EXTENSION_COMBOBOX();
  103. }; // class EXTENSION_COMBOBOX
  104. /*************************************************************************
  105. NAME: TYPE_CREATOR_LISTBOX
  106. SYNOPSIS: This listbox shows all the currently added type/creators.
  107. INTERFACE: TYPE_CREATOR_LISTBOX - Class constructor. Takes a
  108. pointer to the "owning" window,
  109. a CID, and a handle to the server
  110. being admiunistered.
  111. ~TYPE_CREATOR_LISTBOX - Class destructor.
  112. Fill - Fills the listbox with the
  113. currently added type/creators.
  114. Refresh - Refresh listbox contents.
  115. QueryColumnWidths - Returns pointer to col width table.
  116. PARENT: BLT_LISTBOX
  117. HISTORY:
  118. NarenG 04-Dec-1992 Created
  119. **************************************************************************/
  120. class TYPE_CREATOR_LISTBOX : public BLT_LISTBOX
  121. {
  122. private:
  123. //
  124. // This data member represents the target server.
  125. //
  126. const AFP_SERVER_HANDLE _hServer;
  127. //
  128. // The column width table.
  129. //
  130. UINT _adx[COLS_FA_LB_TYPE_CREATORS];
  131. public:
  132. DWORD SelectTypeCreator( DWORD dwId );
  133. DWORD SelectTypeCreator( NLS_STR * pnlsType, NLS_STR * pnlsCreator );
  134. //
  135. // The following method is called whenever the listbox needs
  136. // to be refreshed (i.e. while the dialog is active). This
  137. // method is responsible for maintaining (as much as possible)
  138. // the current state of any selected item.
  139. //
  140. DWORD Update( DWORD nTypeCreators, PAFP_TYPE_CREATOR pAfpTypeCreators );
  141. //
  142. // This method returns a pointer to the column width table.
  143. //
  144. const UINT * QueryColumnWidths( VOID ) const
  145. { return _adx; }
  146. //
  147. // Usual constructor\destructor goodies.
  148. //
  149. //
  150. TYPE_CREATOR_LISTBOX( OWNER_WINDOW * powner,
  151. CID cid,
  152. AFP_SERVER_HANDLE hServer );
  153. ~TYPE_CREATOR_LISTBOX();
  154. //
  155. // The following macro will declare (& define) a new
  156. // QueryItem() method which will return a TYPE_CREATOR_LBI *.
  157. //
  158. DECLARE_LB_QUERY_ITEM( TYPE_CREATOR_LBI )
  159. }; // class TYPE_CREATOR_LISTBOX
  160. /*************************************************************************
  161. NAME: FILE_ASSOCIATION_DIALOG
  162. SYNOPSIS: The class for associatiating NTFS file extensions with
  163. Macintosh type/creator pairs. This is ivoked from the
  164. file manager extension UI.
  165. INTERFACE: FILE_ASSOCIATION_DIALOG() - Constructor
  166. PARENT: DIALOG_WINDOW
  167. USES: PUSH_BUTTON, TYPE_CREATOR_LISTBOX, COMBOBOX
  168. CAVEATS:
  169. NOTES:
  170. HISTORY:
  171. NarenG 12/4/92 Created
  172. **************************************************************************/
  173. class FILE_ASSOCIATION_DIALOG : public DIALOG_WINDOW
  174. {
  175. private:
  176. EXTENSION_COMBOBOX _cbExtensions;
  177. TYPE_CREATOR_LISTBOX _lbTypeCreators;
  178. PUSH_BUTTON _pbAssociate;
  179. PUSH_BUTTON _pbAdd;
  180. PUSH_BUTTON _pbEdit;
  181. PUSH_BUTTON _pbDelete;
  182. //
  183. // Represents the target server
  184. //
  185. AFP_SERVER_HANDLE _hServer;
  186. //
  187. // Sorted array of extension/id pairs. This array is sorted by
  188. // alphabetically by extension.
  189. //
  190. //
  191. PAFP_EXTENSION _pExtensions;
  192. protected:
  193. virtual BOOL OnCommand( const CONTROL_EVENT & event );
  194. virtual ULONG QueryHelpContext( VOID );
  195. DWORD Update( VOID );
  196. DWORD Refresh( VOID );
  197. DWORD RefreshAndSelectTC( VOID );
  198. BOOL TypeCreatorAddDialog( VOID );
  199. BOOL TypeCreatorEditDialog( VOID );
  200. VOID SelectTypeCreator( DWORD dwId );
  201. VOID SelectTypeCreator( NLS_STR * pnlsType, NLS_STR * pnlsCreator );
  202. VOID EnableControls( BOOL fEnable );
  203. public:
  204. FILE_ASSOCIATION_DIALOG :: FILE_ASSOCIATION_DIALOG(
  205. HWND hWndOwner,
  206. AFP_SERVER_HANDLE hServer,
  207. const TCHAR * pszPath,
  208. BOOL fIsFile );
  209. ~FILE_ASSOCIATION_DIALOG();
  210. }; // class FILE_ASSOCIATION_DIALOG
  211. /*******************************************************************
  212. NAME: TYPE_CREATOR_ADD
  213. SYNOPSIS: This class defines the TYPE_CREATOR_ADD dialog
  214. PARENT: DIALOG_WINDOW
  215. USES: COMBOBOX, SLE
  216. CAVEATS:
  217. NOTES:
  218. HISTORY:
  219. NarenG 12/4/92 Created
  220. ********************************************************************/
  221. class TYPE_CREATOR_ADD : public DIALOG_WINDOW
  222. {
  223. private:
  224. AFP_SERVER_HANDLE _hServer;
  225. SLE _sleComment;
  226. COMBOBOX _cbTypes;
  227. COMBOBOX _cbCreators;
  228. NLS_STR * _pnlsType;
  229. NLS_STR * _pnlsCreator;
  230. protected:
  231. virtual BOOL OnOK( VOID );
  232. virtual ULONG QueryHelpContext( VOID );
  233. public:
  234. TYPE_CREATOR_ADD :: TYPE_CREATOR_ADD(
  235. HWND hWnd,
  236. AFP_SERVER_HANDLE hServer,
  237. TYPE_CREATOR_LISTBOX * ptclb,
  238. NLS_STR * pnlsType,
  239. NLS_STR * pnlsCreator );
  240. };
  241. /*******************************************************************
  242. NAME: TYPE_CREATOR_EDIT
  243. SYNOPSIS: This class defines the TYPE_CREATOR_EDIT dialog
  244. PARENT: DIALOG_WINDOW
  245. USES: SLT, SLE
  246. CAVEATS:
  247. NOTES:
  248. HISTORY:
  249. NarenG 12/4/92 Created
  250. ********************************************************************/
  251. class TYPE_CREATOR_EDIT : public DIALOG_WINDOW
  252. {
  253. private:
  254. AFP_SERVER_HANDLE _hServer;
  255. SLE _sleComment;
  256. SLT _sltType;
  257. SLT _sltCreator;
  258. protected:
  259. virtual BOOL OnOK( VOID );
  260. virtual ULONG QueryHelpContext( VOID );
  261. public:
  262. TYPE_CREATOR_EDIT :: TYPE_CREATOR_EDIT(
  263. HWND hWnd,
  264. AFP_SERVER_HANDLE hServer,
  265. TYPE_CREATOR_LBI * ptclbi );
  266. };
  267. #endif