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.

1090 lines
32 KiB

  1. /*
  2. File: LaunchServices.h
  3. Contains: Public interfaces for LaunchServices.framework
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 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 __LAUNCHSERVICES__
  11. #define __LAUNCHSERVICES__
  12. #ifndef __MACTYPES__
  13. #include <MacTypes.h>
  14. #endif
  15. #ifndef __CFSTRING__
  16. #include <CFString.h>
  17. #endif
  18. #ifndef __FILES__
  19. #include <Files.h>
  20. #endif
  21. #ifndef __CFURL__
  22. #include <CFURL.h>
  23. #endif
  24. #ifndef __AEDATAMODEL__
  25. #include <AEDataModel.h>
  26. #endif
  27. #if PRAGMA_ONCE
  28. #pragma once
  29. #endif
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #if PRAGMA_IMPORT
  34. #pragma import on
  35. #endif
  36. #if PRAGMA_STRUCT_ALIGN
  37. #pragma options align=mac68k
  38. #elif PRAGMA_STRUCT_PACKPUSH
  39. #pragma pack(push, 2)
  40. #elif PRAGMA_STRUCT_PACK
  41. #pragma pack(2)
  42. #endif
  43. /* ======================================================================================================== */
  44. /* LaunchServices Structures and Enums */
  45. /* ======================================================================================================== */
  46. enum {
  47. kLSUnknownErr = -10810,
  48. kLSNotAnApplicationErr = -10811,
  49. kLSNotInitializedErr = -10812,
  50. kLSDataUnavailableErr = -10813, /* e.g. no kind string*/
  51. kLSApplicationNotFoundErr = -10814, /* e.g. no application claims the file*/
  52. kLSUnknownTypeErr = -10815,
  53. kLSDataTooOldErr = -10816,
  54. kLSDataErr = -10817,
  55. kLSLaunchInProgressErr = -10818, /* e.g. opening an alreay opening application*/
  56. kLSNotRegisteredErr = -10819,
  57. kLSAppDoesNotClaimTypeErr = -10820,
  58. kLSAppDoesNotSupportSchemeWarning = -10821, /* not an error, just a warning*/
  59. kLSServerCommunicationErr = -10822, /* cannot set recent items*/
  60. kLSCannotSetInfoErr = -10823 /* you may not set item info for this item*/
  61. };
  62. typedef OptionBits LSInitializeFlags;
  63. enum {
  64. kLSInitializeDefaults = 0x00000001
  65. };
  66. enum {
  67. kLSMinCatInfoBitmap = (kFSCatInfoNodeFlags | kFSCatInfoParentDirID | kFSCatInfoFinderInfo | kFSCatInfoFinderXInfo) /* minimum info needed to avoid a FSGetCatalogInfo call when fetching item information */
  68. };
  69. enum {
  70. kLSInvalidExtensionIndex = (unsigned long)0xFFFFFFFF /* Index returned from LSGetExtensionInfo when name has no extension*/
  71. };
  72. typedef OptionBits LSRequestedInfo;
  73. enum {
  74. kLSRequestExtension = 0x00000001, /* safe to use from threads*/
  75. kLSRequestTypeCreator = 0x00000002, /* safe to use from threads*/
  76. kLSRequestBasicFlagsOnly = 0x00000004, /* all but type of application and extension flags - safe to use from threads*/
  77. kLSRequestAppTypeFlags = 0x00000008, /* NOT SAFE to use from threads*/
  78. kLSRequestAllFlags = 0x00000010, /* NOT SAFE to use from threads*/
  79. kLSRequestIconAndKind = 0x00000020, /* NOT SAFE to use from threads*/
  80. kLSRequestExtensionFlagsOnly = 0x00000040, /* safe to use from threads*/
  81. kLSRequestAllInfo = (unsigned long)0xFFFFFFFF /* NOT SAFE to use from threads*/
  82. };
  83. typedef OptionBits LSItemInfoFlags;
  84. enum {
  85. kLSItemInfoIsPlainFile = 0x00000001, /* none of the following applies*/
  86. kLSItemInfoIsPackage = 0x00000002, /* app, doc, or bundle package*/
  87. kLSItemInfoIsApplication = 0x00000004, /* single-file or packaged*/
  88. kLSItemInfoIsContainer = 0x00000008, /* folder or volume*/
  89. kLSItemInfoIsAliasFile = 0x00000010, /* Alias file (includes sym links)*/
  90. kLSItemInfoIsSymlink = 0x00000020, /* UNIX sym link*/
  91. kLSItemInfoIsInvisible = 0x00000040, /* does not include '.' files or '.hidden' entries*/
  92. kLSItemInfoIsNativeApp = 0x00000080, /* Carbon or Cocoa native app*/
  93. kLSItemInfoIsClassicApp = 0x00000100, /* CFM Classic app*/
  94. kLSItemInfoAppPrefersNative = 0x00000200, /* Carbon app that prefers to be launched natively*/
  95. kLSItemInfoAppPrefersClassic = 0x00000400, /* Carbon app that prefers to be launched in Classic*/
  96. kLSItemInfoAppIsScriptable = 0x00000800, /* App can be scripted*/
  97. kLSItemInfoIsVolume = 0x00001000, /* item is a volume*/
  98. kLSItemInfoExtensionIsHidden = 0x00100000 /* item has a hidden extension*/
  99. };
  100. typedef OptionBits LSRolesMask;
  101. enum {
  102. kLSRolesNone = 0x00000001, /* no claim is made about support for this type/scheme*/
  103. kLSRolesViewer = 0x00000002, /* claim to be able to view this type/scheme*/
  104. kLSRolesEditor = 0x00000004, /* claim to be able to edit this type/scheme*/
  105. kLSRolesAll = (unsigned long)0xFFFFFFFF /* claim to do it all*/
  106. };
  107. typedef UInt32 LSKindID;
  108. enum {
  109. kLSUnknownKindID = 0
  110. };
  111. enum {
  112. kLSUnknownType = 0,
  113. kLSUnknownCreator = 0
  114. };
  115. struct LSItemInfoRecord {
  116. LSItemInfoFlags flags;
  117. OSType filetype;
  118. OSType creator; /* release when finished*/
  119. CFStringRef extension; /* release when finished*/
  120. CFStringRef iconFileName; /* not for general use*/
  121. LSKindID kindID; /* not for general use*/
  122. };
  123. typedef struct LSItemInfoRecord LSItemInfoRecord;
  124. typedef OptionBits LSAcceptanceFlags;
  125. enum {
  126. kLSAcceptDefault = 0x00000001,
  127. kLSAcceptAllowLoginUI = 0x00000002 /* show UI to log in if necessary*/
  128. };
  129. typedef OptionBits LSLaunchFlags;
  130. enum {
  131. kLSLaunchDefaults = 0x00000001, /* default = open, async, use Info.plist, start Classic*/
  132. kLSLaunchAndPrint = 0x00000002, /* print items instead of open them*/
  133. kLSLaunchReserved2 = 0x00000004,
  134. kLSLaunchReserved3 = 0x00000008,
  135. kLSLaunchReserved4 = 0x00000010,
  136. kLSLaunchReserved5 = 0x00000020,
  137. kLSLaunchReserved6 = 0x00000040,
  138. kLSLaunchInhibitBGOnly = 0x00000080, /* causes launch to fail if target is background-only.*/
  139. kLSLaunchDontAddToRecents = 0x00000100, /* do not add app or documents to recents menus.*/
  140. kLSLaunchDontSwitch = 0x00000200, /* don't bring new app to the foreground.*/
  141. kLSLaunchNoParams = 0x00000800, /* Use Info.plist to determine launch parameters*/
  142. kLSLaunchAsync = 0x00010000, /* launch async; obtain results from kCPSNotifyLaunch.*/
  143. kLSLaunchStartClassic = 0x00020000, /* start up Classic environment if required for app.*/
  144. kLSLaunchInClassic = 0x00040000, /* force app to launch in Classic environment.*/
  145. kLSLaunchNewInstance = 0x00080000, /* Instantiate app even if it is already running.*/
  146. kLSLaunchAndHide = 0x00100000, /* Send child a "hide" request as soon as it checks in.*/
  147. kLSLaunchAndHideOthers = 0x00200000 /* Hide all other apps when child checks in.*/
  148. };
  149. struct LSLaunchFSRefSpec {
  150. const FSRef * appRef; /* app to use, can be NULL*/
  151. UInt32 numDocs; /* items to open/print, can be NULL*/
  152. const FSRef * itemRefs; /* array of FSRefs*/
  153. const AEDesc * passThruParams; /* passed untouched to application as optional parameter*/
  154. LSLaunchFlags launchFlags;
  155. void * asyncRefCon; /* used if you register for app birth/death notification*/
  156. };
  157. typedef struct LSLaunchFSRefSpec LSLaunchFSRefSpec;
  158. struct LSLaunchURLSpec {
  159. CFURLRef appURL; /* app to use, can be NULL*/
  160. CFArrayRef itemURLs; /* items to open/print, can be NULL*/
  161. const AEDesc * passThruParams; /* passed untouched to application as optional parameter*/
  162. LSLaunchFlags launchFlags;
  163. void * asyncRefCon; /* used if you register for app birth/death notification*/
  164. };
  165. typedef struct LSLaunchURLSpec LSLaunchURLSpec;
  166. /* ======================================================================================================== */
  167. /* LaunchServices Public Entry Points */
  168. /* ======================================================================================================== */
  169. /*
  170. * LSInit()
  171. *
  172. * Summary:
  173. * Initialize LaunchServices for use.
  174. *
  175. * Discussion:
  176. * LSInit is deprecated. Launch Services is initialized implicitly
  177. * when first called.
  178. *
  179. * Parameters:
  180. *
  181. * inFlags:
  182. * Use kLSInitializeDefaults.
  183. *
  184. * Availability:
  185. * Non-Carbon CFM: not available
  186. * CarbonLib: not available in CarbonLib 1.x
  187. * Mac OS X: in version 10.0 and later
  188. */
  189. EXTERN_API( OSStatus )
  190. LSInit(LSInitializeFlags inFlags);
  191. /*
  192. * LSTerm()
  193. *
  194. * Summary:
  195. * Terminate LaunchServices use.
  196. *
  197. * Discussion:
  198. * LSTerm is deprecated. It does not need to be called.
  199. *
  200. * Availability:
  201. * Non-Carbon CFM: not available
  202. * CarbonLib: not available in CarbonLib 1.x
  203. * Mac OS X: in version 10.0 and later
  204. */
  205. EXTERN_API( OSStatus )
  206. LSTerm(void);
  207. /*
  208. * LSCopyItemInfoForRef()
  209. *
  210. * Summary:
  211. * Return information about an item.
  212. *
  213. * Discussion:
  214. * Returns as much or as little information as requested about
  215. * inItemRef. Some information is available in a thread-safe manner,
  216. * some is not. All CFStrings must be released after use.
  217. *
  218. * Parameters:
  219. *
  220. * inItemRef:
  221. * The FSRef of the item about which information is requested.
  222. *
  223. * inWhichInfo:
  224. * Flags indicating which information to return
  225. *
  226. * outItemInfo:
  227. * Information is returned in this structure. Must not be NULL
  228. *
  229. * Availability:
  230. * Non-Carbon CFM: not available
  231. * CarbonLib: not available in CarbonLib 1.x
  232. * Mac OS X: in version 10.0 and later
  233. */
  234. EXTERN_API( OSStatus )
  235. LSCopyItemInfoForRef(
  236. const FSRef * inItemRef,
  237. LSRequestedInfo inWhichInfo,
  238. LSItemInfoRecord * outItemInfo);
  239. /*
  240. * LSCopyItemInfoForURL()
  241. *
  242. * Summary:
  243. * Return information about an item.
  244. *
  245. * Discussion:
  246. * Returns as much or as little information as requested about
  247. * inURL. Some information is available in a thread-safe manner,
  248. * some is not. All CFStrings must be released after use.
  249. *
  250. * Parameters:
  251. *
  252. * inURL:
  253. * The CFURLRef of the item about which information is requested.
  254. *
  255. * inWhichInfo:
  256. * Flags indicating which information to return
  257. *
  258. * outItemInfo:
  259. * Information is returned in this structure. Must not be NULL
  260. *
  261. * Availability:
  262. * Non-Carbon CFM: not available
  263. * CarbonLib: not available in CarbonLib 1.x
  264. * Mac OS X: in version 10.0 and later
  265. */
  266. EXTERN_API( OSStatus )
  267. LSCopyItemInfoForURL(
  268. CFURLRef inURL,
  269. LSRequestedInfo inWhichInfo,
  270. LSItemInfoRecord * outItemInfo);
  271. /*
  272. * LSGetExtensionInfo()
  273. *
  274. * Summary:
  275. * Get information about the extension for a file system name.
  276. *
  277. * Discussion:
  278. * Returns the starting index of the extension (not including the
  279. * period) or kLSInvalidExtensionIndex if the input name has no
  280. * extension.
  281. *
  282. * Parameters:
  283. *
  284. * inNameLen:
  285. * The number of the UniChars in inNameBuffer.
  286. *
  287. * inNameBuffer:
  288. * The buffer containing the name's Unicode characters.
  289. *
  290. * outExtStartIndex:
  291. * On success, the starting index of the extension if there is one
  292. * (not including the period). Set to kLSInvalidExtensionIndex if
  293. * inNameBuffer does not contain a valid extension.
  294. *
  295. * Availability:
  296. * Non-Carbon CFM: not available
  297. * CarbonLib: not available in CarbonLib 1.x
  298. * Mac OS X: in version 10.1 and later
  299. */
  300. EXTERN_API( OSStatus )
  301. LSGetExtensionInfo(
  302. UniCharCount inNameLen,
  303. const UniChar inNameBuffer[],
  304. UniCharCount * outExtStartIndex);
  305. /*
  306. * LSCopyDisplayNameForRef()
  307. *
  308. * Summary:
  309. * Get the display name for an FSRef.
  310. *
  311. * Discussion:
  312. * Return a copy of the display name for an FSRef. Takes into
  313. * consideration whether this item has a hidden extension or not.
  314. *
  315. * Parameters:
  316. *
  317. * inRef:
  318. * The FSRef for which the display name is desired.
  319. *
  320. * outDisplayName:
  321. * Pointer to the CFString into which the display name should be
  322. * copied. Callers must dispose of the resulting CFString.
  323. *
  324. * Availability:
  325. * Non-Carbon CFM: not available
  326. * CarbonLib: not available in CarbonLib 1.x
  327. * Mac OS X: in version 10.1 and later
  328. */
  329. EXTERN_API( OSStatus )
  330. LSCopyDisplayNameForRef(
  331. const FSRef * inRef,
  332. CFStringRef * outDisplayName);
  333. /*
  334. * LSCopyDisplayNameForURL()
  335. *
  336. * Summary:
  337. * Get the display name for a CFURLRef.
  338. *
  339. * Discussion:
  340. * Return a copy of the display name for a CFURLRef. Takes into
  341. * consideration whether this item has a hidden extension or not.
  342. *
  343. * Parameters:
  344. *
  345. * inURL:
  346. * The URL for which the display name is desired.
  347. *
  348. * outDisplayName:
  349. * Pointer to the CFString into which the display name should be
  350. * copied. Callers must dispose of the resulting CFString.
  351. *
  352. * Availability:
  353. * Non-Carbon CFM: not available
  354. * CarbonLib: not available in CarbonLib 1.x
  355. * Mac OS X: in version 10.1 and later
  356. */
  357. EXTERN_API( OSStatus )
  358. LSCopyDisplayNameForURL(
  359. CFURLRef inURL,
  360. CFStringRef * outDisplayName);
  361. /*
  362. * LSSetExtensionHiddenForRef()
  363. *
  364. * Summary:
  365. * Sets whether the extension for an FSRef is hidden or not.
  366. *
  367. * Discussion:
  368. * Sets the necessary file system state to indicate that the
  369. * extension for inRef is hidden, as in the Finder. You can
  370. * determine if an FSRef's extension is hidden using
  371. * LSCopyItemInfoForRef.
  372. *
  373. * Parameters:
  374. *
  375. * inRef:
  376. * The FSRef for which the extension is to be hidden or shown.
  377. *
  378. * inHide:
  379. * True to hide inRef's extension, false to show it.
  380. *
  381. * Availability:
  382. * Non-Carbon CFM: not available
  383. * CarbonLib: not available in CarbonLib 1.x
  384. * Mac OS X: in version 10.1 and later
  385. */
  386. EXTERN_API( OSStatus )
  387. LSSetExtensionHiddenForRef(
  388. const FSRef * inRef,
  389. Boolean inHide);
  390. /*
  391. * LSSetExtensionHiddenForURL()
  392. *
  393. * Summary:
  394. * Sets whether the extension for a CFURLRef is hidden or not.
  395. *
  396. * Discussion:
  397. * Sets the necessary file system state to indicate that the
  398. * extension for inURL is hidden, as in the Finder. You can
  399. * determine if a CFURLRef's extension is hidden using
  400. * LSCopyItemInfoForURL.
  401. *
  402. * Parameters:
  403. *
  404. * inURL:
  405. * The CFURLRef for which the extension is to be hidden or shown.
  406. *
  407. * inHide:
  408. * True to hide inURL's extension, false to show it.
  409. *
  410. * Availability:
  411. * Non-Carbon CFM: not available
  412. * CarbonLib: not available in CarbonLib 1.x
  413. * Mac OS X: in version 10.1 and later
  414. */
  415. EXTERN_API( OSStatus )
  416. LSSetExtensionHiddenForURL(
  417. CFURLRef inURL,
  418. Boolean inHide);
  419. /*
  420. * LSCopyKindStringForRef()
  421. *
  422. * Summary:
  423. * Get the kind string for an item.
  424. *
  425. * Discussion:
  426. * Returns the kind string as used in the Finder and elsewhere for
  427. * inFSRef. The CFStringRef must be released after use.
  428. *
  429. * Parameters:
  430. *
  431. * inFSRef:
  432. * The item for which the kind string is requested.
  433. *
  434. * outKindString:
  435. * A CFStringRef* to receive the copied kind string object. This
  436. * CFStringRef must be released eventually.
  437. *
  438. * Availability:
  439. * Non-Carbon CFM: not available
  440. * CarbonLib: not available in CarbonLib 1.x
  441. * Mac OS X: in version 10.0 and later
  442. */
  443. EXTERN_API( OSStatus )
  444. LSCopyKindStringForRef(
  445. const FSRef * inFSRef,
  446. CFStringRef * outKindString);
  447. /*
  448. * LSCopyKindStringForURL()
  449. *
  450. * Summary:
  451. * Get the kind string for an item.
  452. *
  453. * Discussion:
  454. * Returns the kind string as used in the Finder and elsewhere for
  455. * inURL. The CFStringRef must be released after use.
  456. *
  457. * Parameters:
  458. *
  459. * inURL:
  460. * The item for which the kind string is requested.
  461. *
  462. * outKindString:
  463. * A CFStringRef* to receive the copied kind string object. This
  464. * CFStringRef must be released eventually.
  465. *
  466. * Availability:
  467. * Non-Carbon CFM: not available
  468. * CarbonLib: not available in CarbonLib 1.x
  469. * Mac OS X: in version 10.0 and later
  470. */
  471. EXTERN_API( OSStatus )
  472. LSCopyKindStringForURL(
  473. CFURLRef inURL,
  474. CFStringRef * outKindString);
  475. /*
  476. * LSCopyKindStringForTypeInfo()
  477. *
  478. * Summary:
  479. * Return the kind string for items like the provided info
  480. *
  481. * Discussion:
  482. * Returns the kind string as shown in the Finder for the those
  483. * items whose type, creator, and/or extension match the provided
  484. * information. The kind string returned will be the one that most
  485. * closely describes all the information provided. The kind string
  486. * is subject to the document binding preferences that have been
  487. * specified by the user. For example, if a creator is specified but
  488. * the user has asked for files with the given
  489. * creator/type/extension combination to open in an application with
  490. * a different creator, the kind string will be loaded from the
  491. * user's preferred application.
  492. *
  493. * Parameters:
  494. *
  495. * inType:
  496. * The OSType file type for which you want a kind string. Specify
  497. * kLSUnknownType if no file type information is available.
  498. *
  499. * inCreator:
  500. * The OSType creator for which you want a kind string. Specify
  501. * kLSUnknownCreator if no creator information is available.
  502. *
  503. * inExtension:
  504. * The extension for which you want a kind string. Specify NULL if
  505. * no extension information is available.
  506. *
  507. * outKindString:
  508. * A CFStringRef* to receive the copied kind string object. This
  509. * CFStringRef must be released eventually.
  510. *
  511. * Availability:
  512. * Non-Carbon CFM: not available
  513. * CarbonLib: not available in CarbonLib 1.x
  514. * Mac OS X: in version 10.2 and later
  515. */
  516. EXTERN_API( OSStatus )
  517. LSCopyKindStringForTypeInfo(
  518. OSType inType,
  519. OSType inCreator,
  520. CFStringRef inExtension, /* can be NULL */
  521. CFStringRef * outKindString);
  522. /*
  523. * LSCopyKindStringForMIMEType()
  524. *
  525. * Summary:
  526. * Get the kind string for the specified MIME type.
  527. *
  528. * Discussion:
  529. * Returns the localized kind string describing the specified MIME
  530. * type.
  531. *
  532. * Parameters:
  533. *
  534. * inMIMEType:
  535. * The string specifying the MIME type.
  536. *
  537. * outKindString:
  538. * A CFStringRef* to receive the copied kind string object. This
  539. * CFStringRef must be released eventually.
  540. *
  541. * Availability:
  542. * Non-Carbon CFM: not available
  543. * CarbonLib: not available in CarbonLib 1.x
  544. * Mac OS X: in version 10.2 and later
  545. */
  546. EXTERN_API( OSStatus )
  547. LSCopyKindStringForMIMEType(
  548. CFStringRef inMIMEType,
  549. CFStringRef * outKindString);
  550. /*
  551. * LSGetApplicationForItem()
  552. *
  553. * Summary:
  554. * Return the application used to open an item.
  555. *
  556. * Discussion:
  557. * Consults the binding tables to return the application that would
  558. * be used to open inItemRef if it were double-clicked in the
  559. * Finder. This application will be the user-specified override if
  560. * appropriate or the default otherwise. If no application is known
  561. * to LaunchServices suitable for opening this item,
  562. * kLSApplicationNotFoundErr will be returned.
  563. *
  564. * Parameters:
  565. *
  566. * inItemRef:
  567. * The FSRef of the item for which the application is requested.
  568. *
  569. * inRoleMask:
  570. * Whether to return the editor or viewer for inItemRef. If you
  571. * don't care which, use kLSRolesAll.
  572. *
  573. * outAppRef:
  574. * Filled in with the FSRef of the application if not NULL.
  575. *
  576. * outAppURL:
  577. * Filled in with the CFURLRef of the application if not NULL.
  578. *
  579. * Availability:
  580. * Non-Carbon CFM: not available
  581. * CarbonLib: not available in CarbonLib 1.x
  582. * Mac OS X: in version 10.0 and later
  583. */
  584. EXTERN_API( OSStatus )
  585. LSGetApplicationForItem(
  586. const FSRef * inItemRef,
  587. LSRolesMask inRoleMask,
  588. FSRef * outAppRef, /* can be NULL */
  589. CFURLRef * outAppURL); /* can be NULL */
  590. /*
  591. * LSGetApplicationForInfo()
  592. *
  593. * Summary:
  594. * Return the application used to open items with particular data.
  595. *
  596. * Discussion:
  597. * Consults the binding tables to return the application that would
  598. * be used to open items with type, creator, and/or extension as
  599. * provided if they were double-clicked in the Finder. This
  600. * application will be the default for items like this if one has
  601. * been set. If no application is known to LaunchServices suitable
  602. * for opening such items, kLSApplicationNotFoundErr will be
  603. * returned. Not all three input parameters can be NULL at the same
  604. * time nor can both output parameters be NULL at the same time.
  605. *
  606. * Parameters:
  607. *
  608. * inType:
  609. * The file type to consider. Can be kLSUnknownType.
  610. *
  611. * inCreator:
  612. * The file creator to consider. Can be kLSUnknownCreator.
  613. *
  614. * inExtension:
  615. * The file name extension to consider. Can be NULL.
  616. *
  617. * inRoleMask:
  618. * Whether to return the editor or viewer for inItemRef. If you
  619. * don't care which, use kLSRolesAll.
  620. *
  621. * outAppRef:
  622. * Filled in with the FSRef of the application if not NULL.
  623. *
  624. * outAppURL:
  625. * Filled in with the CFURLRef of the application if not NULL.
  626. *
  627. * Availability:
  628. * Non-Carbon CFM: not available
  629. * CarbonLib: not available in CarbonLib 1.x
  630. * Mac OS X: in version 10.0 and later
  631. */
  632. EXTERN_API( OSStatus )
  633. LSGetApplicationForInfo(
  634. OSType inType,
  635. OSType inCreator,
  636. CFStringRef inExtension, /* can be NULL */
  637. LSRolesMask inRoleMask,
  638. FSRef * outAppRef, /* can be NULL */
  639. CFURLRef * outAppURL); /* can be NULL */
  640. /*
  641. * LSCopyApplicationForMIMEType()
  642. *
  643. * Summary:
  644. * Return the application used to handle data with the specified
  645. * MIME type.
  646. *
  647. * Discussion:
  648. * The returned application URL will be the user's preferred handler
  649. * for the MIME type if one has been set. If no user preferred
  650. * application has been set, Launch Services will select a default
  651. * handler for the MIME type. If no application is known to handle
  652. * the MIME type, kLSApplicationNotFoundErr will be returned.
  653. *
  654. * Parameters:
  655. *
  656. * inMIMEType:
  657. * The string specifying the MIME type.
  658. *
  659. * inRoleMask:
  660. * A role mask that the chosen application must satisfy. Use
  661. * kLSRolesAll if the role is not important.
  662. *
  663. * outAppURL:
  664. * Receives the copied CFURLRef, which must be released by the
  665. * caller.
  666. *
  667. * Availability:
  668. * Non-Carbon CFM: not available
  669. * CarbonLib: not available in CarbonLib 1.x
  670. * Mac OS X: in version 10.2 and later
  671. */
  672. EXTERN_API( OSStatus )
  673. LSCopyApplicationForMIMEType(
  674. CFStringRef inMIMEType,
  675. LSRolesMask inRoleMask,
  676. CFURLRef * outAppURL);
  677. /*
  678. * LSGetApplicationForURL()
  679. *
  680. * Summary:
  681. * Return the application used to open an item.
  682. *
  683. * Discussion:
  684. * Consults the binding tables to return the application that would
  685. * be used to open inURL if it were double-clicked in the Finder.
  686. * This application will be the user-specified override if
  687. * appropriate or the default otherwise. If no application is known
  688. * to LaunchServices suitable for opening this item,
  689. * kLSApplicationNotFoundErr will be returned.
  690. *
  691. * Parameters:
  692. *
  693. * inURL:
  694. * The CFURLRef of the item for which the application is requested.
  695. *
  696. * inRoleMask:
  697. * Whether to return the editor or viewer for inItemRef. If you
  698. * don't care which, use kLSRolesAll.
  699. *
  700. * outAppRef:
  701. * Filled in with the FSRef of the application if not NULL.
  702. *
  703. * outAppURL:
  704. * Filled in with the CFURLRef of the application if not NULL.
  705. *
  706. * Availability:
  707. * Non-Carbon CFM: not available
  708. * CarbonLib: not available in CarbonLib 1.x
  709. * Mac OS X: in version 10.0 and later
  710. */
  711. EXTERN_API( OSStatus )
  712. LSGetApplicationForURL(
  713. CFURLRef inURL,
  714. LSRolesMask inRoleMask,
  715. FSRef * outAppRef, /* can be NULL */
  716. CFURLRef * outAppURL); /* can be NULL */
  717. /*
  718. * LSFindApplicationForInfo()
  719. *
  720. * Summary:
  721. * Locate a specific application.
  722. *
  723. * Discussion:
  724. * Returns the application with the corresponding input information.
  725. * The registry of applications is consulted first in order of
  726. * bundleID, then creator, then name. All comparisons are case
  727. * insensitive and 'ties' are decided first by version, then by
  728. * native vs. Classic.
  729. *
  730. * Parameters:
  731. *
  732. * inCreator:
  733. * The file creator to consider. Can be kLSUnknownCreator.
  734. *
  735. * inBundleID:
  736. * The bundle ID to consider. Can be NULL.
  737. *
  738. * inName:
  739. * The name to consider. Can be NULL. Must include any extensions
  740. * that are part of the file system name, e.g. '.app'.
  741. *
  742. * outAppRef:
  743. * Filled in with the FSRef of the application if not NULL.
  744. *
  745. * outAppURL:
  746. * Filled in with the CFURLRef of the application if not NULL.
  747. *
  748. * Availability:
  749. * Non-Carbon CFM: not available
  750. * CarbonLib: not available in CarbonLib 1.x
  751. * Mac OS X: in version 10.0 and later
  752. */
  753. EXTERN_API( OSStatus )
  754. LSFindApplicationForInfo(
  755. OSType inCreator,
  756. CFStringRef inBundleID, /* can be NULL */
  757. CFStringRef inName, /* can be NULL */
  758. FSRef * outAppRef, /* can be NULL */
  759. CFURLRef * outAppURL); /* can be NULL */
  760. /*
  761. * LSCanRefAcceptItem()
  762. *
  763. * Summary:
  764. * Determine whether an item can accept another item.
  765. *
  766. * Discussion:
  767. * Returns in outAcceptsItem whether inTargetRef can accept
  768. * inItemFSRef as in a drag and drop operation. If inRoleMask is
  769. * other than kLSRolesAll then make sure inTargetRef claims to
  770. * fulfill the requested role.
  771. *
  772. * Parameters:
  773. *
  774. * inItemFSRef:
  775. * FSRef of the item about which acceptance is requested.
  776. *
  777. * inTargetRef:
  778. * FSRef of the potential target.
  779. *
  780. * inRoleMask:
  781. * The role(s) the target must claim in order to consider
  782. * acceptance.
  783. *
  784. * inFlags:
  785. * Use kLSAcceptDefault.
  786. *
  787. * outAcceptsItem:
  788. * Filled in with result. Must not be NULL.
  789. *
  790. * Availability:
  791. * Non-Carbon CFM: not available
  792. * CarbonLib: not available in CarbonLib 1.x
  793. * Mac OS X: in version 10.0 and later
  794. */
  795. EXTERN_API( OSStatus )
  796. LSCanRefAcceptItem(
  797. const FSRef * inItemFSRef,
  798. const FSRef * inTargetRef,
  799. LSRolesMask inRoleMask,
  800. LSAcceptanceFlags inFlags,
  801. Boolean * outAcceptsItem);
  802. /*
  803. * LSCanURLAcceptURL()
  804. *
  805. * Summary:
  806. * Determine whether an item can accept another item.
  807. *
  808. * Discussion:
  809. * Returns in outAcceptsItem whether inTargetURL can accept
  810. * inItemURL as in a drag and drop operation. If inRoleMask is other
  811. * than kLSRolesAll then make sure inTargetRef claims to fulfill the
  812. * requested role.
  813. *
  814. * Parameters:
  815. *
  816. * inItemURL:
  817. * CFURLRef of the item about which acceptance is requested.
  818. *
  819. * inTargetURL:
  820. * CFURLRef of the potential target.
  821. *
  822. * inRoleMask:
  823. * The role(s) the target must claim in order to consider
  824. * acceptance.
  825. *
  826. * inFlags:
  827. * Use kLSAcceptDefault.
  828. *
  829. * outAcceptsItem:
  830. * Filled in with result. Must not be NULL.
  831. *
  832. * Availability:
  833. * Non-Carbon CFM: not available
  834. * CarbonLib: not available in CarbonLib 1.x
  835. * Mac OS X: in version 10.0 and later
  836. */
  837. EXTERN_API( OSStatus )
  838. LSCanURLAcceptURL(
  839. CFURLRef inItemURL,
  840. CFURLRef inTargetURL,
  841. LSRolesMask inRoleMask,
  842. LSAcceptanceFlags inFlags,
  843. Boolean * outAcceptsItem);
  844. /*
  845. * LSOpenFSRef()
  846. *
  847. * Summary:
  848. * Open an application, document, or folder.
  849. *
  850. * Discussion:
  851. * Opens applications, documents, and folders. Applications are
  852. * opened via an 'oapp' or 'rapp' event. Documents are opened in
  853. * their user-overridden or default applications as appropriate.
  854. * Folders are opened in the Finder. Use the more specific
  855. * LSOpenFromRefSpec for more control over launching.
  856. *
  857. * Parameters:
  858. *
  859. * inRef:
  860. * The FSRef of the item to launch.
  861. *
  862. * outLaunchedRef:
  863. * The FSRef of the item actually launched. For inRefs that are
  864. * documents, outLaunchedRef will be the application used to
  865. * launch the document. Can be NULL.
  866. *
  867. * Availability:
  868. * Non-Carbon CFM: not available
  869. * CarbonLib: not available in CarbonLib 1.x
  870. * Mac OS X: in version 10.0 and later
  871. */
  872. EXTERN_API( OSStatus )
  873. LSOpenFSRef(
  874. const FSRef * inRef,
  875. FSRef * outLaunchedRef); /* can be NULL */
  876. /*
  877. * LSOpenCFURLRef()
  878. *
  879. * Summary:
  880. * Open an application, document, or folder.
  881. *
  882. * Discussion:
  883. * Opens applications, documents, and folders. Applications are
  884. * opened via an 'oapp' or 'rapp' event. Documents are opened in
  885. * their user-overridden or default applications as appropriate.
  886. * Folders are opened in the Finder. Use the more specific
  887. * LSOpenFromURLSpec for more control over launching.
  888. *
  889. * Parameters:
  890. *
  891. * inURL:
  892. * The CFURLRef of the item to launch.
  893. *
  894. * outLaunchedURL:
  895. * The CFURLRef of the item actually launched. For inURLs that are
  896. * documents, outLaunchedURL will be the application used to
  897. * launch the document. Can be NULL.
  898. *
  899. * Availability:
  900. * Non-Carbon CFM: not available
  901. * CarbonLib: not available in CarbonLib 1.x
  902. * Mac OS X: in version 10.0 and later
  903. */
  904. EXTERN_API( OSStatus )
  905. LSOpenCFURLRef(
  906. CFURLRef inURL,
  907. CFURLRef * outLaunchedURL); /* can be NULL */
  908. /*
  909. * LSOpenFromRefSpec()
  910. *
  911. * Summary:
  912. * Opens an application or one or more documents or folders.
  913. *
  914. * Discussion:
  915. * Opens applications, documents, and folders.
  916. *
  917. * Parameters:
  918. *
  919. * inLaunchSpec:
  920. * The specification of what to launch and how to launch it.
  921. *
  922. * outLaunchedRef:
  923. * The FSRef of the item actually launched. For inRefs that are
  924. * documents, outLaunchedRef will be the application used to
  925. * launch the document. Can be NULL.
  926. *
  927. * Availability:
  928. * Non-Carbon CFM: not available
  929. * CarbonLib: not available in CarbonLib 1.x
  930. * Mac OS X: in version 10.0 and later
  931. */
  932. EXTERN_API( OSStatus )
  933. LSOpenFromRefSpec(
  934. const LSLaunchFSRefSpec * inLaunchSpec,
  935. FSRef * outLaunchedRef); /* can be NULL */
  936. /*
  937. * LSOpenFromURLSpec()
  938. *
  939. * Summary:
  940. * Opens an application or one or more documents or folders.
  941. *
  942. * Discussion:
  943. * Opens applications, documents, and folders.
  944. *
  945. * Parameters:
  946. *
  947. * inLaunchSpec:
  948. * The specification of what to launch and how to launch it.
  949. *
  950. * outLaunchedURL:
  951. * The CFURLRef of the item actually launched. For inURLs that are
  952. * documents, outLaunchedURL will be the application used to
  953. * launch the document. Can be NULL.
  954. *
  955. * Availability:
  956. * Non-Carbon CFM: not available
  957. * CarbonLib: not available in CarbonLib 1.x
  958. * Mac OS X: in version 10.0 and later
  959. */
  960. EXTERN_API( OSStatus )
  961. LSOpenFromURLSpec(
  962. const LSLaunchURLSpec * inLaunchSpec,
  963. CFURLRef * outLaunchedURL); /* can be NULL */
  964. #if PRAGMA_STRUCT_ALIGN
  965. #pragma options align=reset
  966. #elif PRAGMA_STRUCT_PACKPUSH
  967. #pragma pack(pop)
  968. #elif PRAGMA_STRUCT_PACK
  969. #pragma pack()
  970. #endif
  971. #ifdef PRAGMA_IMPORT_OFF
  972. #pragma import off
  973. #elif PRAGMA_IMPORT
  974. #pragma import reset
  975. #endif
  976. #ifdef __cplusplus
  977. }
  978. #endif
  979. #endif /* __LAUNCHSERVICES__ */