Team Fortress 2 Source Code as on 22/4/2020
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.

366 lines
16 KiB

  1. /*
  2. File: Finder.h
  3. Contains: Finder flags and container types.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1990-2001 by Apple Computer, Inc., all rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __FINDER__
  11. #define __FINDER__
  12. #ifndef __MACTYPES__
  13. #include <MacTypes.h>
  14. #endif
  15. #if PRAGMA_ONCE
  16. #pragma once
  17. #endif
  18. #if PRAGMA_IMPORT
  19. #pragma import on
  20. #endif
  21. #if PRAGMA_STRUCT_ALIGN
  22. #pragma options align=mac68k
  23. #elif PRAGMA_STRUCT_PACKPUSH
  24. #pragma pack(push, 2)
  25. #elif PRAGMA_STRUCT_PACK
  26. #pragma pack(2)
  27. #endif
  28. /* Creator and type of clipping files */
  29. enum {
  30. kClippingCreator = FOUR_CHAR_CODE('drag'),
  31. kClippingPictureType = FOUR_CHAR_CODE('clpp'),
  32. kClippingTextType = FOUR_CHAR_CODE('clpt'),
  33. kClippingSoundType = FOUR_CHAR_CODE('clps'),
  34. kClippingUnknownType = FOUR_CHAR_CODE('clpu')
  35. };
  36. /* Creator and type of Internet Location files */
  37. enum {
  38. kInternetLocationCreator = FOUR_CHAR_CODE('drag'),
  39. kInternetLocationHTTP = FOUR_CHAR_CODE('ilht'),
  40. kInternetLocationFTP = FOUR_CHAR_CODE('ilft'),
  41. kInternetLocationFile = FOUR_CHAR_CODE('ilfi'),
  42. kInternetLocationMail = FOUR_CHAR_CODE('ilma'),
  43. kInternetLocationNNTP = FOUR_CHAR_CODE('ilnw'),
  44. kInternetLocationAFP = FOUR_CHAR_CODE('ilaf'),
  45. kInternetLocationAppleTalk = FOUR_CHAR_CODE('ilat'),
  46. kInternetLocationNSL = FOUR_CHAR_CODE('ilns'),
  47. kInternetLocationGeneric = FOUR_CHAR_CODE('ilge')
  48. };
  49. enum {
  50. kCustomIconResource = -16455 /* Custom icon family resource ID */
  51. };
  52. /* In order to specify any of the information described in the */
  53. /* CustomBadgeResource data structure you must clear the kExtendedFlagsAreInvalid */
  54. /* and set kExtendedFlagHasCustomBadge of the FXInfo.fdXFlags or DXInfo.frXFlags field, */
  55. /* and add a resource of type kCustomBadgeResourceType and ID kCustomBadgeResourceID to */
  56. /* the file or to the "Icon/n" file for a folder */
  57. enum {
  58. kCustomBadgeResourceType = FOUR_CHAR_CODE('badg'),
  59. kCustomBadgeResourceID = kCustomIconResource,
  60. kCustomBadgeResourceVersion = 0
  61. };
  62. struct CustomBadgeResource {
  63. SInt16 version; /* This is version kCustomBadgeResourceVersion*/
  64. SInt16 customBadgeResourceID; /* If not 0, the ID of a resource to use on top*/
  65. /* of the icon for this file or folder*/
  66. OSType customBadgeType; /* If not 0, the type and creator of an icon*/
  67. OSType customBadgeCreator; /* to use on top of the icon*/
  68. OSType windowBadgeType; /* If not 0, the type and creator of an icon*/
  69. OSType windowBadgeCreator; /* to display in the header of the window for this */
  70. /* file or folder*/
  71. OSType overrideType; /* If not 0, the type and creator of an icon to*/
  72. OSType overrideCreator; /* use INSTEAD of the icon for this file or folder*/
  73. };
  74. typedef struct CustomBadgeResource CustomBadgeResource;
  75. typedef CustomBadgeResource * CustomBadgeResourcePtr;
  76. typedef CustomBadgeResourcePtr * CustomBadgeResourceHandle;
  77. /* You can specify routing information for a file by including a 'rout' 0
  78. resource in it and setting the kExtendedFlagHasRoutingInfo bit in the extended
  79. Finder flags.
  80. The 'rout' resource is an array of RoutingResourceEntry. Each entry is considered
  81. in turn. The first matching entry is used.
  82. If the creator and fileType match the file being dropped and targetFolder match
  83. the folder ID of the folder being dropped onto, then the file is rerouted
  84. into the specified destination folder.
  85. The only target folder currently supported is the system folder,
  86. kSystemFolderType = 'macs'.
  87. */
  88. enum {
  89. kRoutingResourceType = FOUR_CHAR_CODE('rout'),
  90. kRoutingResourceID = 0
  91. };
  92. struct RoutingResourceEntry {
  93. OSType creator; /* Use '****' or 0 to match any creator */
  94. OSType fileType; /* Use '****' or 0 to match any file type */
  95. OSType targetFolder; /* Folder ID of the folder this file was dropped onto */
  96. OSType destinationFolder; /* Folder that the source will be routed to */
  97. OSType reservedField; /* Set to 0 */
  98. };
  99. typedef struct RoutingResourceEntry RoutingResourceEntry;
  100. typedef RoutingResourceEntry * RoutingResourcePtr;
  101. typedef RoutingResourcePtr * RoutingResourceHandle;
  102. /* Types for special container aliases */
  103. enum {
  104. kContainerFolderAliasType = FOUR_CHAR_CODE('fdrp'), /* type for folder aliases */
  105. kContainerTrashAliasType = FOUR_CHAR_CODE('trsh'), /* type for trash folder aliases */
  106. kContainerHardDiskAliasType = FOUR_CHAR_CODE('hdsk'), /* type for hard disk aliases */
  107. kContainerFloppyAliasType = FOUR_CHAR_CODE('flpy'), /* type for floppy aliases */
  108. kContainerServerAliasType = FOUR_CHAR_CODE('srvr'), /* type for server aliases */
  109. kApplicationAliasType = FOUR_CHAR_CODE('adrp'), /* type for application aliases */
  110. kContainerAliasType = FOUR_CHAR_CODE('drop'), /* type for all other containers */
  111. kDesktopPrinterAliasType = FOUR_CHAR_CODE('dtpa'), /* type for Desktop Printer alias */
  112. kContainerCDROMAliasType = FOUR_CHAR_CODE('cddr'), /* type for CD-ROM alias */
  113. kApplicationCPAliasType = FOUR_CHAR_CODE('acdp'), /* type for application control panel alias */
  114. kApplicationDAAliasType = FOUR_CHAR_CODE('addp'), /* type for application DA alias */
  115. kPackageAliasType = FOUR_CHAR_CODE('fpka'), /* type for plain package alias */
  116. kAppPackageAliasType = FOUR_CHAR_CODE('fapa') /* type for application package alias */
  117. };
  118. /* Types for Special folder aliases */
  119. enum {
  120. kSystemFolderAliasType = FOUR_CHAR_CODE('fasy'),
  121. kAppleMenuFolderAliasType = FOUR_CHAR_CODE('faam'),
  122. kStartupFolderAliasType = FOUR_CHAR_CODE('fast'),
  123. kPrintMonitorDocsFolderAliasType = FOUR_CHAR_CODE('fapn'),
  124. kPreferencesFolderAliasType = FOUR_CHAR_CODE('fapf'),
  125. kControlPanelFolderAliasType = FOUR_CHAR_CODE('fact'),
  126. kExtensionFolderAliasType = FOUR_CHAR_CODE('faex')
  127. };
  128. /* Types for AppleShare folder aliases */
  129. enum {
  130. kExportedFolderAliasType = FOUR_CHAR_CODE('faet'),
  131. kDropFolderAliasType = FOUR_CHAR_CODE('fadr'),
  132. kSharedFolderAliasType = FOUR_CHAR_CODE('fash'),
  133. kMountedFolderAliasType = FOUR_CHAR_CODE('famn')
  134. };
  135. /* Finder flags (finderFlags, fdFlags and frFlags) */
  136. /* Any flag reserved or not specified should be set to 0. */
  137. /* If a flag applies to a file, but not to a folder, make sure to check */
  138. /* that the item is not a folder by checking ((ParamBlockRec.ioFlAttrib & ioDirMask) == 0) */
  139. enum {
  140. kIsOnDesk = 0x0001, /* Files and folders (System 6) */
  141. kColor = 0x000E, /* Files and folders */
  142. /* bit 0x0020 was kRequireSwitchLaunch, but is now reserved for future use*/
  143. kIsShared = 0x0040, /* Files only (Applications only) */
  144. /* If clear, the application needs to write to */
  145. /* its resource fork, and therefore cannot be */
  146. /* shared on a server */
  147. kHasNoINITs = 0x0080, /* Files only (Extensions/Control Panels only) */
  148. /* This file contains no INIT resource */
  149. kHasBeenInited = 0x0100, /* Files only */
  150. /* Clear if the file contains desktop database */
  151. /* resources ('BNDL', 'FREF', 'open', 'kind'...) */
  152. /* that have not been added yet. Set only by the Finder */
  153. /* Reserved for folders - make sure this bit is cleared for folders */
  154. /* bit 0x0200 was the letter bit for AOCE, but is now reserved for future use */
  155. kHasCustomIcon = 0x0400, /* Files and folders */
  156. kIsStationery = 0x0800, /* Files only */
  157. kNameLocked = 0x1000, /* Files and folders */
  158. kHasBundle = 0x2000, /* Files only */
  159. kIsInvisible = 0x4000, /* Files and folders */
  160. kIsAlias = 0x8000 /* Files only */
  161. };
  162. /* Obsolete. Use names defined above. */
  163. enum {
  164. fOnDesk = kIsOnDesk,
  165. fHasBundle = kHasBundle,
  166. fInvisible = kIsInvisible
  167. };
  168. /* Obsolete */
  169. enum {
  170. fTrash = -3,
  171. fDesktop = -2,
  172. fDisk = 0
  173. };
  174. #if OLDROUTINENAMES
  175. enum {
  176. kIsStationary = kIsStationery
  177. };
  178. #endif /* OLDROUTINENAMES */
  179. /* Extended flags (extendedFinderFlags, fdXFlags and frXFlags) */
  180. /* Any flag not specified should be set to 0. */
  181. enum {
  182. kExtendedFlagsAreInvalid = 0x8000, /* If set the other extended flags are ignored */
  183. kExtendedFlagHasCustomBadge = 0x0100, /* Set if the file or folder has a badge resource */
  184. kExtendedFlagHasRoutingInfo = 0x0004 /* Set if the file contains routing info resource */
  185. };
  186. /* Use a filetype in this range to indicate that a file is temporarily busy */
  187. /* (while it is being downloaded or installed, for example). This prevents */
  188. /* Finder 8.5 and later from trying to change the item's attributes before it */
  189. /* is fully created. -- If you provide a series of 'BNDL' icons for your creator */
  190. /* and some of these filetypes, you can achieve limited icon animation while */
  191. /* the file creation progresses. */
  192. enum {
  193. kFirstMagicBusyFiletype = FOUR_CHAR_CODE('bzy '),
  194. kLastMagicBusyFiletype = FOUR_CHAR_CODE('bzy?')
  195. };
  196. /* Use this date as a file's or folder's creation date to indicate that it is */
  197. /* temporarily busy (while it is being downloaded or installed, for example). */
  198. /* This prevents Finder from trying to change the item's attributes before it */
  199. /* is fully created (Finder 8.5 and 8.6 check file creation dates; later Finders */
  200. /* may check folder creation dates as well). */
  201. enum {
  202. kMagicBusyCreationDate = 0x4F3AFDB0
  203. };
  204. /*------------------------------------------------------------------------*/
  205. /*
  206. The following data structures are binary compatible with FInfo, DInfo,
  207. FXInfo and DXInfo but represent the Mac OS 8 semantic of the fields.
  208. Use these data structures preferably to FInfo, etc...
  209. */
  210. /*------------------------------------------------------------------------*/
  211. struct FileInfo {
  212. OSType fileType; /* The type of the file */
  213. OSType fileCreator; /* The file's creator */
  214. UInt16 finderFlags; /* ex: kHasBundle, kIsInvisible... */
  215. Point location; /* File's location in the folder */
  216. /* If set to {0, 0}, the Finder will place the item automatically */
  217. UInt16 reservedField; /* (set to 0) */
  218. };
  219. typedef struct FileInfo FileInfo;
  220. struct FolderInfo {
  221. Rect windowBounds; /* The position and dimension of the folder's window */
  222. UInt16 finderFlags; /* ex. kIsInvisible, kNameLocked, etc.*/
  223. Point location; /* Folder's location in the parent folder */
  224. /* If set to {0, 0}, the Finder will place the item automatically */
  225. UInt16 reservedField; /* (set to 0) */
  226. };
  227. typedef struct FolderInfo FolderInfo;
  228. struct ExtendedFileInfo {
  229. SInt16 reserved1[4]; /* Reserved (set to 0) */
  230. UInt16 extendedFinderFlags; /* Extended flags (custom badge, routing info...) */
  231. SInt16 reserved2; /* Reserved (set to 0). Comment ID if high-bit is clear */
  232. SInt32 putAwayFolderID; /* Put away folder ID */
  233. };
  234. typedef struct ExtendedFileInfo ExtendedFileInfo;
  235. struct ExtendedFolderInfo {
  236. Point scrollPosition; /* Scroll position (for icon views) */
  237. SInt32 reserved1; /* Reserved (set to 0) */
  238. UInt16 extendedFinderFlags; /* Extended flags (custom badge, routing info...) */
  239. SInt16 reserved2; /* Reserved (set to 0). Comment ID if high-bit is clear */
  240. SInt32 putAwayFolderID; /* Put away folder ID */
  241. };
  242. typedef struct ExtendedFolderInfo ExtendedFolderInfo;
  243. /*------------------------------------------------------------------------*/
  244. /*
  245. The following data structures are here for compatibility.
  246. Use the new data structures replacing them if possible (i.e. FileInfo
  247. instead of FInfo, etc...)
  248. */
  249. /*------------------------------------------------------------------------*/
  250. /* File info */
  251. /*
  252. IMPORTANT:
  253. In MacOS 8, the fdFldr field has become reserved for the Finder.
  254. */
  255. struct FInfo {
  256. OSType fdType; /* The type of the file */
  257. OSType fdCreator; /* The file's creator */
  258. UInt16 fdFlags; /* Flags ex. kHasBundle, kIsInvisible, etc. */
  259. Point fdLocation; /* File's location in folder. */
  260. /* If set to {0, 0}, the Finder will place the item automatically */
  261. SInt16 fdFldr; /* Reserved (set to 0) */
  262. };
  263. typedef struct FInfo FInfo;
  264. /* Extended file info */
  265. /*
  266. IMPORTANT:
  267. In MacOS 8, the fdIconID and fdComment fields were changed
  268. to become reserved fields for the Finder.
  269. The fdScript has become an extended flag.
  270. */
  271. struct FXInfo {
  272. SInt16 fdIconID; /* Reserved (set to 0) */
  273. SInt16 fdReserved[3]; /* Reserved (set to 0) */
  274. SInt8 fdScript; /* Extended flags. Script code if high-bit is set */
  275. SInt8 fdXFlags; /* Extended flags */
  276. SInt16 fdComment; /* Reserved (set to 0). Comment ID if high-bit is clear */
  277. SInt32 fdPutAway; /* Put away folder ID */
  278. };
  279. typedef struct FXInfo FXInfo;
  280. /* Folder info */
  281. /*
  282. IMPORTANT:
  283. In MacOS 8, the frView field was changed to become reserved
  284. field for the Finder.
  285. */
  286. struct DInfo {
  287. Rect frRect; /* Folder's window bounds */
  288. UInt16 frFlags; /* Flags ex. kIsInvisible, kNameLocked, etc.*/
  289. Point frLocation; /* Folder's location in parent folder */
  290. /* If set to {0, 0}, the Finder will place the item automatically */
  291. SInt16 frView; /* Reserved (set to 0) */
  292. };
  293. typedef struct DInfo DInfo;
  294. /* Extended folder info */
  295. /*
  296. IMPORTANT:
  297. In MacOS 8, the frOpenChain and frComment fields were changed
  298. to become reserved fields for the Finder.
  299. The frScript has become an extended flag.
  300. */
  301. struct DXInfo {
  302. Point frScroll; /* Scroll position */
  303. SInt32 frOpenChain; /* Reserved (set to 0) */
  304. SInt8 frScript; /* Extended flags. Script code if high-bit is set */
  305. SInt8 frXFlags; /* Extended flags */
  306. SInt16 frComment; /* Reserved (set to 0). Comment ID if high-bit is clear */
  307. SInt32 frPutAway; /* Put away folder ID */
  308. };
  309. typedef struct DXInfo DXInfo;
  310. /* ControlPanelDefProcPtr and cdev constants have all been moved to Processes.i*/
  311. #if PRAGMA_STRUCT_ALIGN
  312. #pragma options align=reset
  313. #elif PRAGMA_STRUCT_PACKPUSH
  314. #pragma pack(pop)
  315. #elif PRAGMA_STRUCT_PACK
  316. #pragma pack()
  317. #endif
  318. #ifdef PRAGMA_IMPORT_OFF
  319. #pragma import off
  320. #elif PRAGMA_IMPORT
  321. #pragma import reset
  322. #endif
  323. #endif /* __FINDER__ */