Pasteboard.pas 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938
  1. { File: Pasteboard.p(.pas) }
  2. { }
  3. { Contains: CodeWarrior Pascal(GPC) translation of Apple's Mac OS X 10.3 introduced Pasteboard.h }
  4. { Translation compatible with make-gpc-interfaces.pl generated MWPInterfaces }
  5. { (GPCPInterfaces) and Mac OS X 10.3.x or higher. The CodeWarrior Pascal translation }
  6. { is linkable with Mac OS X 10.3.x or higher CFM CarbonLib. The GPC translation is }
  7. { linkable with Mac OS X 10.3.x or higher Mach-O Carbon.framework. }
  8. { }
  9. { Version: 1.0 }
  10. { }
  11. { Pascal Translation: Gale Paeper, <[email protected]>, 2004 }
  12. { }
  13. { Copyright: Subject to the constraints of Apple's original rights, you're free to use this }
  14. { translation as you deem fit. }
  15. { }
  16. { Bugs?: This is an AS IS translation with no express guarentees of any kind. }
  17. { If you do find a bug, please help out the Macintosh Pascal programming community by }
  18. { reporting your bug finding and possible fix to either personal e-mail to Gale Paeper }
  19. { or a posting to the MacPascal mailing list. }
  20. { }
  21. {
  22. Change History (most recent first) (DD/MM/YY):
  23. <1> 05/12/04 GRP First Pascal translation of Pasteboard.h, version HIServices-125.6~1.
  24. }
  25. { Translation assisted by: }
  26. {This file was processed by Dan's Source Converter}
  27. {version 1.3 (this version modified by Ingemar Ragnemalm)}
  28. {The original source on which this file is based: }
  29. {
  30. File: HIServices/Pasteboard.h
  31. Contains: Pasteboard Manager Interfaces.
  32. Version: HIServices-125.6~1
  33. Copyright: © 2003 by Apple Computer, Inc., all rights reserved.
  34. Bugs?: For bug reports, consult the following page on
  35. the World Wide Web:
  36. http://www.freepascal.org/bugs.html
  37. }
  38. {
  39. Modified for use with Free Pascal
  40. Version 200
  41. Please report any bugs to <[email protected]>
  42. }
  43. {$mode macpas}
  44. {$packenum 1}
  45. {$macro on}
  46. {$inline on}
  47. {$CALLING MWPASCAL}
  48. unit Pasteboard;
  49. interface
  50. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  51. {$setc GAP_INTERFACES_VERSION := $0200}
  52. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  53. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  54. {$endc}
  55. {$ifc defined CPUPOWERPC and defined CPUI386}
  56. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  57. {$endc}
  58. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  59. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  60. {$endc}
  61. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  62. {$setc __ppc__ := 1}
  63. {$elsec}
  64. {$setc __ppc__ := 0}
  65. {$endc}
  66. {$ifc not defined __i386__ and defined CPUI386}
  67. {$setc __i386__ := 1}
  68. {$elsec}
  69. {$setc __i386__ := 0}
  70. {$endc}
  71. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  72. {$error Conflicting definitions for __ppc__ and __i386__}
  73. {$endc}
  74. {$ifc defined __ppc__ and __ppc__}
  75. {$setc TARGET_CPU_PPC := TRUE}
  76. {$setc TARGET_CPU_X86 := FALSE}
  77. {$elifc defined __i386__ and __i386__}
  78. {$setc TARGET_CPU_PPC := FALSE}
  79. {$setc TARGET_CPU_X86 := TRUE}
  80. {$elsec}
  81. {$error Neither __ppc__ nor __i386__ is defined.}
  82. {$endc}
  83. {$setc TARGET_CPU_PPC_64 := FALSE}
  84. {$ifc defined FPC_BIG_ENDIAN}
  85. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  86. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  87. {$elifc defined FPC_LITTLE_ENDIAN}
  88. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  89. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  90. {$elsec}
  91. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  92. {$endc}
  93. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  94. {$setc CALL_NOT_IN_CARBON := FALSE}
  95. {$setc OLDROUTINENAMES := FALSE}
  96. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  97. {$setc OPAQUE_UPP_TYPES := TRUE}
  98. {$setc OTCARBONAPPLICATION := TRUE}
  99. {$setc OTKERNEL := FALSE}
  100. {$setc PM_USE_SESSION_APIS := TRUE}
  101. {$setc TARGET_API_MAC_CARBON := TRUE}
  102. {$setc TARGET_API_MAC_OS8 := FALSE}
  103. {$setc TARGET_API_MAC_OSX := TRUE}
  104. {$setc TARGET_CARBON := TRUE}
  105. {$setc TARGET_CPU_68K := FALSE}
  106. {$setc TARGET_CPU_MIPS := FALSE}
  107. {$setc TARGET_CPU_SPARC := FALSE}
  108. {$setc TARGET_OS_MAC := TRUE}
  109. {$setc TARGET_OS_UNIX := FALSE}
  110. {$setc TARGET_OS_WIN32 := FALSE}
  111. {$setc TARGET_RT_MAC_68881 := FALSE}
  112. {$setc TARGET_RT_MAC_CFM := FALSE}
  113. {$setc TARGET_RT_MAC_MACHO := TRUE}
  114. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  115. {$setc TYPE_BOOL := FALSE}
  116. {$setc TYPE_EXTENDED := FALSE}
  117. {$setc TYPE_LONGLONG := TRUE}
  118. uses MacTypes,CFBase,CFArray,CFData,CFURL;
  119. {$ALIGN POWER}
  120. {
  121. * Pasteboard Manager
  122. *
  123. * Discussion:
  124. * Pasteboard Manager is the replacement of the Scrap and Drag
  125. * flavor APIs. Like the Scrap Manager, it is a cross process data
  126. * transport mechanism. Unlike the Drag Manager, it is not bound to
  127. * particular high level user actions to initiate and resolve the
  128. * data transport. This allows the Pasteboard Manager to be used as
  129. * the data transport mechanism for copy and paste, drag and drop,
  130. * services, as well as generic cross process communication.
  131. *
  132. *
  133. * Like scraps, pasteboards are local references to global, cross
  134. * process, resources. Although, where scraps exist forever,
  135. * pasteboard are CFTypes and should be released at the end of their
  136. * usefulness. Multiple pasteboard references in a single
  137. * application may point to the same global pasteboard resource.
  138. * Once the global pasteboard resource has been cleared, all
  139. * pasteboard references to that global resource in the application
  140. * share ownership allowing any of them to add data to the
  141. * pasteboard. Of course, this is not a free for all. Once a flavor
  142. * has been added it can not be overwritten by another local
  143. * reference. Calling CFRelease() on any one of these references
  144. * will implicitly call in promises, but only those made through the
  145. * particular pasteboard reference being released. In this way,
  146. * local pasteboard references in various components of the
  147. * application can add data, make promises, keep those promises, and
  148. * release their local pasteboard reference independently of the
  149. * other components.
  150. *
  151. * For long lived pasteboards, like the clipboard or find
  152. * pasteboards, the suggested usage model is for a component to
  153. * create a local reference to a pasteboard at the beginning of its
  154. * life cycle, hold on to it, and release it at the end of its life
  155. * cycle. As long as a pasteboard reference in any application still
  156. * points to the global pasteboard resource, the global resource
  157. * will not be released. When the final reference is released,
  158. * promises will not be called in as the global pasteboard resource
  159. * will be released. Only if you want to guarantee a global
  160. * pasteboard resource continues to exist beyond the life of your
  161. * application should you refrain from calling CFRelease(). In this
  162. * case, be sure to call PasteboardResolvePromises() to make sure
  163. * any promises are called in. This is not necessary for the
  164. * clipboard and find pasteboards as they are retained by the system
  165. * and never released.
  166. *
  167. * Like the Drag Manager, the Pasteboard Manager allows the use of
  168. * multiple items each with its own set of flavors. When using the
  169. * clipboard or find pasteboards, it's traditionally been common to
  170. * only use the first item, but now multiple items can be copied as
  171. * is the case in the Finder. This also opens up the ability for
  172. * services to act on multiple items. Another difference from both
  173. * the Scrap and Drag Managers is the use of Uniform Type Identifier
  174. * based flavor types rather than four character code OSTypes. These
  175. * have several advantages. They allow compatibility with Cocoa's
  176. * NSPasteboard, more accurately describe the data being
  177. * transported, provide a type inheritance mechanism and allow
  178. * namespacing with a reverse DNS scheme.
  179. }
  180. type
  181. PasteboardRef = ^SInt32; { an opaque 32-bit type }
  182. PasteboardItemID = Ptr;
  183. { Pasteboard Manager error codes }
  184. const
  185. badPasteboardSyncErr = -25130; { pasteboard has been modified and must be synchronized }
  186. badPasteboardIndexErr = -25131; { item index does not exist }
  187. badPasteboardItemErr = -25132; { item reference does not exist }
  188. badPasteboardFlavorErr = -25133; { item flavor does not exist }
  189. duplicatePasteboardFlavorErr = -25134; { item flavor already exists }
  190. notPasteboardOwnerErr = -25135; { client did not clear the pasteboard }
  191. noPasteboardPromiseKeeperErr = -25136; { a promise is being added without a promise keeper }
  192. {
  193. * PasteboardSyncFlags
  194. *
  195. * Summary:
  196. * The following constants are used by the PasteboardSynchronize()
  197. * routine to indicate the status of the local pasteboard reference
  198. * in relation to the global, cross process pasteboard resource.
  199. }
  200. type
  201. PasteboardSyncFlags = UInt32;
  202. const
  203. {
  204. * Indicates that the global pasteboard resource has been modified
  205. * since the last time it was accessed via the local pasteboard
  206. * reference. The call to PasteboardSynchronize() has updated the
  207. * local pasteboard reference to sync it up with the global resource.
  208. * This is a good time to see what new information has been placed on
  209. * the pasteboard to determine whether any tasty flavors have been
  210. * added and possibly enable pasting.
  211. }
  212. kPasteboardModified = $00000001; {(1 << 0)}
  213. {
  214. * Indicates that the global pasteboard resource was most recently
  215. * cleared by the this application. Any local pasteboard reference in
  216. * the client application may add data to the global pasteboard
  217. * resource.
  218. }
  219. kPasteboardClientIsOwner = $00000002; {(1 << 1)}
  220. {
  221. * PasteboardFlavorFlags
  222. *
  223. * Summary:
  224. * Pasteboard Flavor Flags
  225. *
  226. * Discussion:
  227. * The following constants are used to tag pasteboard item flavors
  228. * with bits of useful information. The first five are settable by
  229. * the client via PasteboardPutItemFlavor(). They may all be
  230. * received via PasteboardGetItemFlavorFlags().
  231. }
  232. type
  233. PasteboardFlavorFlags = UInt32;
  234. const
  235. {
  236. * No additional information exists for this flavor.
  237. }
  238. kPasteboardFlavorNoFlags = $00000000;
  239. {
  240. * Only the process which has added this flavor can see it. If the
  241. * process that owns the pasteboard places this flag on a flavor
  242. * you'll never see it as the receiver so there's no reason to test
  243. * for it.
  244. }
  245. kPasteboardFlavorSenderOnly = $00000001; {(1 << 0)}
  246. {
  247. * The data for this flavor was translated in some manner by the
  248. * sender before adding it to the pasteboard. Flavors marked with
  249. * this flag are not stored by the Finder in clipping files.
  250. }
  251. kPasteboardFlavorSenderTranslated = $00000002; {(1 << 1)}
  252. {
  253. * Set by the sender if the flavor data should not be saved by the
  254. * receiver. The data contained may become stale after the end of the
  255. * drag. Flavors marked with this flag are not stored by the Finder
  256. * in clipping files.
  257. }
  258. kPasteboardFlavorNotSaved = $00000004; {(1 << 2)}
  259. {
  260. * Like kPasteboardFlavorSenderOnly, when the sender adds this flag,
  261. * the presence of this flavor will not be made known when
  262. * PasteboardCopyItemFlavors() is called by the receiver. However,
  263. * the flavor flags and data can be accessed when explicitly
  264. * requested via PasteboardGetItemFlavorFlags() or
  265. * PasteboardCopyItemFlavorData(). This allows a suite of
  266. * applications to communicate without exporting their method of
  267. * communication.
  268. }
  269. kPasteboardFlavorRequestOnly = $00000008; {(1 << 3)}
  270. {
  271. * The data for this flavor is provided by the Translation Manager as
  272. * a convenience to receivers. Flavors marked with this flag are not
  273. * stored by the Finder in clipping files. This flag can not be added
  274. * by clients. It is automatically added by the Pasteboard Manager
  275. * when appropriate.
  276. }
  277. kPasteboardFlavorSystemTranslated = $00000100; {(1 << 8)}
  278. {
  279. * The data for this flavor has not yet been added to the pasteboard
  280. * by the sender. This may have been done as a performance measure if
  281. * the data is expensive to generate. A request by the receiver to
  282. * obtain the data will cause the promise to be kept by the sender.
  283. * This flag can not be added by clients. It is automatically added
  284. * by the Pasteboard Manager when appropriate.
  285. }
  286. kPasteboardFlavorPromised = $00000200; {(1 << 9)}
  287. {
  288. * PasteboardGetTypeID()
  289. *
  290. * Summary:
  291. * Returns the CFType identifier for a pasteboard object.
  292. *
  293. * Mac OS X threading:
  294. * Not thread safe
  295. *
  296. * Result:
  297. * A CFTypeID unique to pasteboard instances.
  298. *
  299. * Availability:
  300. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  301. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  302. * Non-Carbon CFM: not available
  303. }
  304. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  305. function PasteboardGetTypeID: CFTypeID; external name '_PasteboardGetTypeID';
  306. {$ifc USE_CFSTR_CONSTANT_MACROS}
  307. {$definec kPasteboardClipboard CFSTRP('com.apple.pasteboard.clipboard')}
  308. {$endc}
  309. {$ifc USE_CFSTR_CONSTANT_MACROS}
  310. {$definec kPasteboardFind CFSTRP('com.apple.pasteboard.find')}
  311. {$endc}
  312. const
  313. kPasteboardUniqueName = NIL;
  314. {
  315. * PasteboardCreate()
  316. *
  317. * Summary:
  318. * Creates a local pasteboard reference to the global pasteboard
  319. * resource of the same name.
  320. *
  321. * Discussion:
  322. * If the the global pasteboard resource doesn't yet exist,
  323. * PasteboardCreate creates a new one with the provided name.
  324. * Pasteboard names are typically represented in a reverse DNS
  325. * scheme (i.e., com.apple.pasteboard.clipboard). Multiple local
  326. * pasteboard references may point to the same global pasteboard
  327. * resource within an application. An application, window, plug-in,
  328. * or object may each hold separate references. These should be held
  329. * and used for the life time of the objects. Pasteboard references
  330. * are CFTypes. Their memory should be released by calling
  331. * CFRelease(). CFRelease() automatically resolves all promises made
  332. * to the global pasteboard resource through the reference being
  333. * released.
  334. *
  335. * Mac OS X threading:
  336. * Not thread safe
  337. *
  338. * Parameters:
  339. *
  340. * inName:
  341. * The name of the pasteboard to reference or create. Passing
  342. * kPasteboardUniqueName, or NULL, will guarantee that a new
  343. * global pasteboard resource is created. kPasteboardClipboard is
  344. * the traditional copy and paste pasteboard. kPasteboardFind is
  345. * compatible with Cocoa's global find pasteboard.
  346. *
  347. * outPasteboard:
  348. * The created pasteboard reference.
  349. *
  350. * Result:
  351. * An operating system result code.
  352. *
  353. * Availability:
  354. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  355. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  356. * Non-Carbon CFM: not available
  357. }
  358. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  359. function PasteboardCreate(
  360. inName: CFStringRef; { can be NULL }
  361. var outPasteboard: PasteboardRef): OSStatus; external name '_PasteboardCreate';
  362. {
  363. * PasteboardSynchronize()
  364. *
  365. * Summary:
  366. * Compares a local pasteboard reference with the global pasteboard
  367. * resource to which it refers, determining whether the global
  368. * pasteboard resource has been modified. If so, it updates the
  369. * local pasteboard reference to reflect the change. The pasteboard
  370. * reference provided is always brought up to date. This routine is
  371. * lightweight whether a synchronization is required or not.
  372. *
  373. * Mac OS X threading:
  374. * Not thread safe
  375. *
  376. * Parameters:
  377. *
  378. * inPasteboard:
  379. * A local pasteboard reference.
  380. *
  381. * Result:
  382. * A set of pasteboard synchronization flags.
  383. *
  384. * Availability:
  385. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  386. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  387. * Non-Carbon CFM: not available
  388. }
  389. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  390. function PasteboardSynchronize(inPasteboard: PasteboardRef): PasteboardSyncFlags; external name '_PasteboardSynchronize';
  391. {
  392. * PasteboardClear()
  393. *
  394. * Summary:
  395. * Clears all data from the global pasteboard resource associated
  396. * with the pasteboard reference provided. The application now owns
  397. * the pasteboard and data may be placed onto the global pasteboard
  398. * resource from all local pasteboards in the client application
  399. * which reference it. PasteboardClear must be called before the
  400. * pasteboard can be modified.
  401. *
  402. * Mac OS X threading:
  403. * Not thread safe
  404. *
  405. * Parameters:
  406. *
  407. * inPasteboard:
  408. * A local pasteboard reference.
  409. *
  410. * Result:
  411. * An operating system result code.
  412. *
  413. * Availability:
  414. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  415. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  416. * Non-Carbon CFM: not available
  417. }
  418. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  419. function PasteboardClear(inPasteboard: PasteboardRef): OSStatus; external name '_PasteboardClear';
  420. {
  421. * PasteboardCopyName()
  422. *
  423. * Summary:
  424. * Copies the name of the given pasteboard. Useful for discovering
  425. * the name of a uniquely named pasteboard so other processes may
  426. * access it.
  427. *
  428. * Mac OS X threading:
  429. * Not thread safe
  430. *
  431. * Parameters:
  432. *
  433. * inPasteboard:
  434. * A local pasteboard reference.
  435. *
  436. * outName:
  437. * On return, a CFString reference to the pasteboard's name. This
  438. * string must be released by the client.
  439. *
  440. * Result:
  441. * An operating system result code.
  442. *
  443. * Availability:
  444. * Mac OS X: in version 10.4 and later in ApplicationServices.framework
  445. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  446. * Non-Carbon CFM: not available
  447. }
  448. function PasteboardCopyName( inPasteboard: PasteboardRef; var outName: CFStringRef ): OSStatus; external name '_PasteboardCopyName';
  449. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  450. {
  451. * PasteboardGetItemCount()
  452. *
  453. * Summary:
  454. * Returns the number of items on the pasteboard.
  455. *
  456. * Mac OS X threading:
  457. * Not thread safe
  458. *
  459. * Parameters:
  460. *
  461. * inPasteboard:
  462. * A local pasteboard reference.
  463. *
  464. * outItemCount:
  465. * An ItemCount reference which receives number of pasteboard
  466. * items.
  467. *
  468. * Result:
  469. * An operating system result code.
  470. *
  471. * Availability:
  472. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  473. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  474. * Non-Carbon CFM: not available
  475. }
  476. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  477. function PasteboardGetItemCount(
  478. inPasteboard: PasteboardRef;
  479. var outItemCount: ItemCount): OSStatus; external name '_PasteboardGetItemCount';
  480. {
  481. * PasteboardGetItemIdentifier()
  482. *
  483. * Summary:
  484. * Returns the item identifier for the nth pasteboard item.
  485. *
  486. * Mac OS X threading:
  487. * Not thread safe
  488. *
  489. * Parameters:
  490. *
  491. * inPasteboard:
  492. * A local pasteboard reference.
  493. *
  494. * inIndex:
  495. * A 1-based UInt32 index requesting the nth pasteboard item reference.
  496. *
  497. * outItem:
  498. * A PasteboardItemID which receives the nth pasteboard item
  499. * reference.
  500. *
  501. * Result:
  502. * An operating system result code.
  503. *
  504. * Availability:
  505. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  506. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  507. * Non-Carbon CFM: not available
  508. }
  509. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  510. function PasteboardGetItemIdentifier(
  511. inPasteboard: PasteboardRef;
  512. inIndex: UInt32;
  513. var outItem: PasteboardItemID): OSStatus; external name '_PasteboardGetItemIdentifier';
  514. {
  515. * PasteboardCopyItemFlavors()
  516. *
  517. * Summary:
  518. * Returns the array of flavors for the provided pasteboard
  519. * reference.
  520. *
  521. * Mac OS X threading:
  522. * Not thread safe
  523. *
  524. * Parameters:
  525. *
  526. * inPasteboard:
  527. * A local pasteboard reference.
  528. *
  529. * inItem:
  530. * A pasteboard item identifier containing the flavors of interest.
  531. *
  532. * outFlavorTypes:
  533. * A CFArrayRef reference which receives the array of Uniform Type
  534. * Identifier based flavor types. It is the client's
  535. * responsibility to release the flavor array via CFRelease().
  536. *
  537. * Result:
  538. * An operating system result code.
  539. *
  540. * Availability:
  541. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  542. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  543. * Non-Carbon CFM: not available
  544. }
  545. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  546. function PasteboardCopyItemFlavors(
  547. inPasteboard: PasteboardRef;
  548. inItem: PasteboardItemID;
  549. var outFlavorTypes: CFArrayRef): OSStatus; external name '_PasteboardCopyItemFlavors';
  550. {
  551. * PasteboardGetItemFlavorFlags()
  552. *
  553. * Summary:
  554. * Returns the array of flags for the provided flavor, including
  555. * implicit translations included by the system automatically.
  556. *
  557. * Mac OS X threading:
  558. * Not thread safe
  559. *
  560. * Parameters:
  561. *
  562. * inPasteboard:
  563. * A local pasteboard reference.
  564. *
  565. * inItem:
  566. * A pasteboard item identifier containing the flavor of interest.
  567. *
  568. * inFlavorType:
  569. * A Uniform Type Identifier based flavor type whose flags are
  570. * being interrogated.
  571. *
  572. * outFlags:
  573. * A PasteboardFlavorFlags reference which receives the flavor
  574. * flags.
  575. *
  576. * Result:
  577. * An operating system result code.
  578. *
  579. * Availability:
  580. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  581. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  582. * Non-Carbon CFM: not available
  583. }
  584. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  585. function PasteboardGetItemFlavorFlags(
  586. inPasteboard: PasteboardRef;
  587. inItem: PasteboardItemID;
  588. inFlavorType: CFStringRef;
  589. var outFlags: PasteboardFlavorFlags): OSStatus; external name '_PasteboardGetItemFlavorFlags';
  590. {
  591. * PasteboardCopyItemFlavorData()
  592. *
  593. * Summary:
  594. * Returns the data for the provided flavor.
  595. *
  596. * Mac OS X threading:
  597. * Not thread safe
  598. *
  599. * Parameters:
  600. *
  601. * inPasteboard:
  602. * A local pasteboard reference.
  603. *
  604. * inItem:
  605. * A pasteboard item identifier containing the flavor of interest.
  606. *
  607. * inFlavorType:
  608. * A Uniform Type Idendtifier based flavor type whose data is
  609. * being retrieved.
  610. *
  611. * outData:
  612. * A CFDataRef reference which receives the flavor data. It is the
  613. * client's responsibility to release the data via CFRelease().
  614. *
  615. * Result:
  616. * An operating system result code.
  617. *
  618. * Availability:
  619. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  620. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  621. * Non-Carbon CFM: not available
  622. }
  623. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  624. function PasteboardCopyItemFlavorData(
  625. inPasteboard: PasteboardRef;
  626. inItem: PasteboardItemID;
  627. inFlavorType: CFStringRef;
  628. var outData: CFDataRef): OSStatus; external name '_PasteboardCopyItemFlavorData';
  629. const
  630. kPasteboardPromisedData = NIL;
  631. {
  632. * PasteboardPutItemFlavor()
  633. *
  634. * Summary:
  635. * Adds flavor data or a promise to the global pasteboard resource.
  636. *
  637. * Mac OS X threading:
  638. * Not thread safe
  639. *
  640. * Parameters:
  641. *
  642. * inPasteboard:
  643. * A local pasteboard reference.
  644. *
  645. * inItem:
  646. * A pasteboard item identifier in which to add the data or
  647. * promise. Pasteboard item identifiers are unique values created
  648. * by the owning application when adding pasteboard item flavor
  649. * information to a drag. Additional flavors may be added to an
  650. * existing item by using the same item identifier value.
  651. * Depending on the application, it might be easier to use
  652. * internal memory addresses as item identifiers (as long as each
  653. * item being added has a unique item reference number).
  654. * Pasteboard item identifiers should only be interpreted by the
  655. * owning application.
  656. *
  657. * inFlavorType:
  658. * A Uniform Type Identifier based flavor type associated with the
  659. * data. If multiple flavors are to be added to an item, the
  660. * owning application should add them in order of preference or
  661. * richness as determined by the owing application. The ordering
  662. * will be retained when viewed by the receiving application.
  663. *
  664. * inData:
  665. * A CFDataRef reference which receives the flavor data. Passing
  666. * kPasteboardPromisedData, or NULL, indicates the data is
  667. * promised. This is useful if the data is expensive to generate.
  668. * Making promises requires the sender to also implement a promise
  669. * keeper which must be set before the promise is made.
  670. *
  671. * inFlags:
  672. * A PasteboardFlavorFlags set of flags to attach to the data.
  673. *
  674. * Result:
  675. * An operating system result code.
  676. *
  677. * Availability:
  678. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  679. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  680. * Non-Carbon CFM: not available
  681. }
  682. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  683. function PasteboardPutItemFlavor(
  684. inPasteboard: PasteboardRef;
  685. inItem: PasteboardItemID;
  686. inFlavorType: CFStringRef;
  687. inData: CFDataRef; { can be NULL }
  688. inFlags: PasteboardFlavorFlags): OSStatus; external name '_PasteboardPutItemFlavor';
  689. {
  690. * PasteboardCopyPasteLocation()
  691. *
  692. * Summary:
  693. * Called by the owner of a pasteboard while providing promised data
  694. * to determine the paste location set by the pasteboard receiver.
  695. *
  696. * Mac OS X threading:
  697. * Not thread safe
  698. *
  699. * Parameters:
  700. *
  701. * inPasteboard:
  702. * A local pasteboard reference.
  703. *
  704. * outPasteLocation:
  705. * A CFURL reference describing the paste location. It is the
  706. * client's responsibility to release the data via CFRelease().
  707. *
  708. * Result:
  709. * An operating system result code.
  710. *
  711. * Availability:
  712. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  713. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  714. * Non-Carbon CFM: not available
  715. }
  716. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  717. function PasteboardCopyPasteLocation(
  718. inPasteboard: PasteboardRef;
  719. var outPasteLocation: CFURLRef): OSStatus; external name '_PasteboardCopyPasteLocation';
  720. {
  721. * PasteboardSetPasteLocation()
  722. *
  723. * Summary:
  724. * Called by the receiver of a pasteboard before requesting any item
  725. * flavor data via PasteboardCopyItemFlavorData. When a sending
  726. * application's pasteboard promise keeper is called to provide data
  727. * to the receiver, PasteboardGetDropLocation can be called to
  728. * determine the paste location while providing data.
  729. *
  730. * Mac OS X threading:
  731. * Not thread safe
  732. *
  733. * Parameters:
  734. *
  735. * inPasteboard:
  736. * A local pasteboard reference.
  737. *
  738. * inPasteLocation:
  739. * A CFURL describing the paste location.
  740. *
  741. * Result:
  742. * An operating system result code.
  743. *
  744. * Availability:
  745. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  746. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  747. * Non-Carbon CFM: not available
  748. }
  749. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  750. function PasteboardSetPasteLocation(
  751. inPasteboard: PasteboardRef;
  752. inPasteLocation: CFURLRef): OSStatus; external name '_PasteboardSetPasteLocation';
  753. {
  754. * PasteboardPromiseKeeperProcPtr
  755. *
  756. * Summary:
  757. * Callback for providing data previously promised on the pasteboard.
  758. *
  759. * Parameters:
  760. *
  761. * pasteboard:
  762. * The local pasteboard reference on which the promise was made.
  763. *
  764. * item:
  765. * The pasteboard item identifier containing the promised flavor.
  766. *
  767. * flavorType:
  768. * The Uniform Type Identifier based flavor type for which the
  769. * promised data is being requested.
  770. *
  771. * context:
  772. * The value passed as the context in PasteboardSetPromiseKeeper().
  773. *
  774. * Result:
  775. * An operating system result code.
  776. }
  777. type
  778. {$ifc TYPED_FUNCTION_POINTERS}
  779. PasteboardPromiseKeeperProcPtr = function(pasteboard: PasteboardRef; item: PasteboardItemID; flavorType: CFStringRef; context: Ptr): OSStatus;
  780. {$elsec}
  781. PasteboardPromiseKeeperProcPtr = ProcPtr;
  782. {$endc}
  783. {
  784. * PasteboardSetPromiseKeeper()
  785. *
  786. * Summary:
  787. * Associates a promise keeper callback with a local pasteboard
  788. * reference. The promise keeper must be set before a promise is
  789. * made.
  790. *
  791. * Mac OS X threading:
  792. * Not thread safe
  793. *
  794. * Parameters:
  795. *
  796. * inPasteboard:
  797. * The local pasteboard reference on which promises will be made.
  798. *
  799. * inPromiseKeeper:
  800. * A PasteboardPromiseKeeperProcPtr promise keeper proc.
  801. *
  802. * inContext:
  803. * The value passed in this parameter is passed on to your promise
  804. * keeper proc when it is called.
  805. *
  806. * Result:
  807. * An operating system result code.
  808. *
  809. * Availability:
  810. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  811. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  812. * Non-Carbon CFM: not available
  813. }
  814. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  815. function PasteboardSetPromiseKeeper(
  816. inPasteboard: PasteboardRef;
  817. inPromiseKeeper: PasteboardPromiseKeeperProcPtr;
  818. inContext: Ptr): OSStatus; external name '_PasteboardSetPromiseKeeper';
  819. const
  820. kPasteboardResolveAllPromises = NIL;
  821. {
  822. * PasteboardResolvePromises()
  823. *
  824. * Summary:
  825. * Resolves promises on the provided local pasteboard reference. If
  826. * multiple local pasteboard references to the same global
  827. * pasteboard resource exist, only those promises made through the
  828. * provided reference are resolved.
  829. *
  830. * Mac OS X threading:
  831. * Not thread safe
  832. *
  833. * Parameters:
  834. *
  835. * inPasteboard:
  836. * The local pasteboard reference for which promises will be
  837. * resolved. Passing kPasteboardResolveAllPromises, or NULL, will
  838. * cause all promises on all global pasteboard resources currently
  839. * owned by this application to be resolved.
  840. *
  841. * Result:
  842. * An operating system result code.
  843. *
  844. * Availability:
  845. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  846. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  847. * Non-Carbon CFM: not available
  848. }
  849. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
  850. function PasteboardResolvePromises(inPasteboard: PasteboardRef): OSStatus; external name '_PasteboardResolvePromises';
  851. {$ALIGN MAC68K}
  852. end.