Pasteboard.pas 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906
  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 compatiblity with Cocoa's
  176. * NSPasteboard, more accurately describe the data being
  177. * transported, provied 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 wether 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. * PasteboardGetItemCount()
  422. *
  423. * Summary:
  424. * Returns the number of items on the pasteboard.
  425. *
  426. * Mac OS X threading:
  427. * Not thread safe
  428. *
  429. * Parameters:
  430. *
  431. * inPasteboard:
  432. * A local pasteboard reference.
  433. *
  434. * outItemCount:
  435. * An ItemCount reference which receives number of pasteboard
  436. * items.
  437. *
  438. * Result:
  439. * An operating system result code.
  440. *
  441. * Availability:
  442. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  443. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  444. * Non-Carbon CFM: not available
  445. }
  446. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  447. function PasteboardGetItemCount(
  448. inPasteboard: PasteboardRef;
  449. var outItemCount: ItemCount): OSStatus; external name '_PasteboardGetItemCount';
  450. {
  451. * PasteboardGetItemIdentifier()
  452. *
  453. * Summary:
  454. * Returns the item identifier for the nth pasteboard item.
  455. *
  456. * Mac OS X threading:
  457. * Not thread safe
  458. *
  459. * Parameters:
  460. *
  461. * inPasteboard:
  462. * A local pasteboard reference.
  463. *
  464. * inIndex:
  465. * A UInt32 index requesting the nth pasteboard item reference.
  466. *
  467. * outItem:
  468. * A PasteboardItemID which receives the nth pasteboard item
  469. * reference.
  470. *
  471. * Result:
  472. * An operating system result code.
  473. *
  474. * Availability:
  475. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  476. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  477. * Non-Carbon CFM: not available
  478. }
  479. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  480. function PasteboardGetItemIdentifier(
  481. inPasteboard: PasteboardRef;
  482. inIndex: UInt32;
  483. var outItem: PasteboardItemID): OSStatus; external name '_PasteboardGetItemIdentifier';
  484. {
  485. * PasteboardCopyItemFlavors()
  486. *
  487. * Summary:
  488. * Returns the array of flavors for the provided pasteboard
  489. * reference.
  490. *
  491. * Mac OS X threading:
  492. * Not thread safe
  493. *
  494. * Parameters:
  495. *
  496. * inPasteboard:
  497. * A local pasteboard reference.
  498. *
  499. * inItem:
  500. * A pasteboard item identifier containing the flavors of interest.
  501. *
  502. * outFlavorTypes:
  503. * A CFArrayRef reference which receives the array of Uniform Type
  504. * Identifier based flavor types. It is the client's
  505. * responsibility to release the flavor array via CFRelease().
  506. *
  507. * Result:
  508. * An operating system result code.
  509. *
  510. * Availability:
  511. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  512. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  513. * Non-Carbon CFM: not available
  514. }
  515. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  516. function PasteboardCopyItemFlavors(
  517. inPasteboard: PasteboardRef;
  518. inItem: PasteboardItemID;
  519. var outFlavorTypes: CFArrayRef): OSStatus; external name '_PasteboardCopyItemFlavors';
  520. {
  521. * PasteboardGetItemFlavorFlags()
  522. *
  523. * Summary:
  524. * Returns the array of flags for the provided flavor, including
  525. * implicit translations included by the system automatically.
  526. *
  527. * Mac OS X threading:
  528. * Not thread safe
  529. *
  530. * Parameters:
  531. *
  532. * inPasteboard:
  533. * A local pasteboard reference.
  534. *
  535. * inItem:
  536. * A pasteboard item identifier containing the flavor of interest.
  537. *
  538. * inFlavorType:
  539. * A Uniform Type Identifier based flavor type whose flags are
  540. * being interrogated.
  541. *
  542. * outFlags:
  543. * A PasteboardFlavorFlags reference which receives the flavor
  544. * flags.
  545. *
  546. * Result:
  547. * An operating system result code.
  548. *
  549. * Availability:
  550. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  551. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  552. * Non-Carbon CFM: not available
  553. }
  554. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  555. function PasteboardGetItemFlavorFlags(
  556. inPasteboard: PasteboardRef;
  557. inItem: PasteboardItemID;
  558. inFlavorType: CFStringRef;
  559. var outFlags: PasteboardFlavorFlags): OSStatus; external name '_PasteboardGetItemFlavorFlags';
  560. {
  561. * PasteboardCopyItemFlavorData()
  562. *
  563. * Summary:
  564. * Returns the data for the provided flavor.
  565. *
  566. * Mac OS X threading:
  567. * Not thread safe
  568. *
  569. * Parameters:
  570. *
  571. * inPasteboard:
  572. * A local pasteboard reference.
  573. *
  574. * inItem:
  575. * A pasteboard item identifier containing the flavor of interest.
  576. *
  577. * inFlavorType:
  578. * A Uniform Type Idendtifier based flavor type whose data is
  579. * being retrieved.
  580. *
  581. * outData:
  582. * A CFDataRef reference which receives the flavor data. It is the
  583. * client's responsibility to release the data via CFRelease().
  584. *
  585. * Result:
  586. * An operating system result code.
  587. *
  588. * Availability:
  589. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  590. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  591. * Non-Carbon CFM: not available
  592. }
  593. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  594. function PasteboardCopyItemFlavorData(
  595. inPasteboard: PasteboardRef;
  596. inItem: PasteboardItemID;
  597. inFlavorType: CFStringRef;
  598. var outData: CFDataRef): OSStatus; external name '_PasteboardCopyItemFlavorData';
  599. const
  600. kPasteboardPromisedData = NIL;
  601. {
  602. * PasteboardPutItemFlavor()
  603. *
  604. * Summary:
  605. * Adds flavor data or a promise to the global pasteboard resource.
  606. *
  607. * Mac OS X threading:
  608. * Not thread safe
  609. *
  610. * Parameters:
  611. *
  612. * inPasteboard:
  613. * A local pasteboard reference.
  614. *
  615. * inItem:
  616. * A pasteboard item identifier in which to add the data or
  617. * promise. Pasteboard item identifiers are unique values created
  618. * by the owning application when adding pasteboard item flavor
  619. * information to a drag. Additional flavors may be added to an
  620. * existing item by using the same item identifier value.
  621. * Depending on the application, it might be easier to use
  622. * internal memory addresses as item identifiers (as long as each
  623. * item being added has a unique item reference number).
  624. * Pasteboard item identifiers should only be interpreted by the
  625. * owning application.
  626. *
  627. * inFlavorType:
  628. * A Uniform Type Identifier based flavor type associated with the
  629. * data. If multiple flavors are to be added to an item, the
  630. * owning application should add them in order of preference or
  631. * richness as determined by the owing application. The ordering
  632. * will be retained when viewed by the receiving application.
  633. *
  634. * inData:
  635. * A CFDataRef reference which receives the flavor data. Passing
  636. * kPasteboardPromisedData, or NULL, indicates the data is
  637. * promised. This is useful if the data is expensive to generate.
  638. * Making promises requires the sender to also implement a promise
  639. * keeper which must be set before the promise is made.
  640. *
  641. * inFlags:
  642. * A PasteboardFlavorFlags set of flags to attach to the data.
  643. *
  644. * Result:
  645. * An operating system result code.
  646. *
  647. * Availability:
  648. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  649. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  650. * Non-Carbon CFM: not available
  651. }
  652. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  653. function PasteboardPutItemFlavor(
  654. inPasteboard: PasteboardRef;
  655. inItem: PasteboardItemID;
  656. inFlavorType: CFStringRef;
  657. inData: CFDataRef; { can be NULL }
  658. inFlags: PasteboardFlavorFlags): OSStatus; external name '_PasteboardPutItemFlavor';
  659. {
  660. * PasteboardCopyPasteLocation()
  661. *
  662. * Summary:
  663. * Called by the owner of a pasteboard while providing promised data
  664. * to determine the paste location set by the pasteboard receiver.
  665. *
  666. * Mac OS X threading:
  667. * Not thread safe
  668. *
  669. * Parameters:
  670. *
  671. * inPasteboard:
  672. * A local pasteboard reference.
  673. *
  674. * outPasteLocation:
  675. * A CFURL reference describing the paste location. It is the
  676. * client's responsibility to release the data via CFRelease().
  677. *
  678. * Result:
  679. * An operating system result code.
  680. *
  681. * Availability:
  682. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  683. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  684. * Non-Carbon CFM: not available
  685. }
  686. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  687. function PasteboardCopyPasteLocation(
  688. inPasteboard: PasteboardRef;
  689. var outPasteLocation: CFURLRef): OSStatus; external name '_PasteboardCopyPasteLocation';
  690. {
  691. * PasteboardSetPasteLocation()
  692. *
  693. * Summary:
  694. * Called by the receiver of a pasteboard before requesting any item
  695. * flavor data via PasteboardCopyItemFlavorData. When a sending
  696. * application's pasteboard promise keeper is called to provide data
  697. * to the receiver, PasteboardGetDropLocation can be called to
  698. * determine the paste location while providing data.
  699. *
  700. * Mac OS X threading:
  701. * Not thread safe
  702. *
  703. * Parameters:
  704. *
  705. * inPasteboard:
  706. * A local pasteboard reference.
  707. *
  708. * inPasteLocation:
  709. * A CFURL describing the paste location.
  710. *
  711. * Result:
  712. * An operating system result code.
  713. *
  714. * Availability:
  715. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  716. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  717. * Non-Carbon CFM: not available
  718. }
  719. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  720. function PasteboardSetPasteLocation(
  721. inPasteboard: PasteboardRef;
  722. inPasteLocation: CFURLRef): OSStatus; external name '_PasteboardSetPasteLocation';
  723. {
  724. * PasteboardPromiseKeeperProcPtr
  725. *
  726. * Summary:
  727. * Callback for providing data previously promised on the pasteboard.
  728. *
  729. * Parameters:
  730. *
  731. * pasteboard:
  732. * The local pasteboard reference on which the promise was made.
  733. *
  734. * item:
  735. * The pasteboard item identifier containing the promised flavor.
  736. *
  737. * flavorType:
  738. * The Uniform Type Identifier based flavor type for which the
  739. * promised data is being requested.
  740. *
  741. * context:
  742. * The value passed as the context in PasteboardSetPromiseKeeper().
  743. *
  744. * Result:
  745. * An operating system result code.
  746. }
  747. type
  748. {$ifc TYPED_FUNCTION_POINTERS}
  749. PasteboardPromiseKeeperProcPtr = function(pasteboard: PasteboardRef; item: PasteboardItemID; flavorType: CFStringRef; context: Ptr): OSStatus;
  750. {$elsec}
  751. PasteboardPromiseKeeperProcPtr = ProcPtr;
  752. {$endc}
  753. {
  754. * PasteboardSetPromiseKeeper()
  755. *
  756. * Summary:
  757. * Associates a promise keeper callback with a local pasteboard
  758. * reference. The promise keeper must be set before a promise is
  759. * made.
  760. *
  761. * Mac OS X threading:
  762. * Not thread safe
  763. *
  764. * Parameters:
  765. *
  766. * inPasteboard:
  767. * The local pasteboard reference on which promises will be made.
  768. *
  769. * inPromiseKeeper:
  770. * A PasteboardPromiseKeeperProcPtr promise keeper proc.
  771. *
  772. * inContext:
  773. * The value passed in this parameter is passed on to your promise
  774. * keeper proc when it is called.
  775. *
  776. * Result:
  777. * An operating system result code.
  778. *
  779. * Availability:
  780. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  781. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  782. * Non-Carbon CFM: not available
  783. }
  784. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
  785. function PasteboardSetPromiseKeeper(
  786. inPasteboard: PasteboardRef;
  787. inPromiseKeeper: PasteboardPromiseKeeperProcPtr;
  788. inContext: Ptr): OSStatus; external name '_PasteboardSetPromiseKeeper';
  789. const
  790. kPasteboardResolveAllPromises = NIL;
  791. {
  792. * PasteboardResolvePromises()
  793. *
  794. * Summary:
  795. * Resolves promises on the provided local pasteboard reference. If
  796. * multiple local pasteboard references to the same global
  797. * pasteboard resource exist, only those promises made through the
  798. * provided reference are resolved.
  799. *
  800. * Mac OS X threading:
  801. * Not thread safe
  802. *
  803. * Parameters:
  804. *
  805. * inPasteboard:
  806. * The local pasteboard reference for which promises will be
  807. * resolved. Passing kPasteboardResolveAllPromises, or NULL, will
  808. * cause all promises on all global pasteboard resources currently
  809. * owned by this application to be resolved.
  810. *
  811. * Result:
  812. * An operating system result code.
  813. *
  814. * Availability:
  815. * Mac OS X: in version 10.3 and later in ApplicationServices.framework
  816. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  817. * Non-Carbon CFM: not available
  818. }
  819. // AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
  820. function PasteboardResolvePromises(inPasteboard: PasteboardRef): OSStatus; external name '_PasteboardResolvePromises';
  821. {$ALIGN MAC68K}
  822. end.