Scrap.pas 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. {
  2. File: HIToolbox/Scrap.h
  3. Contains: Scrap Manager Interfaces.
  4. Version: HIToolbox-219.4.81~2
  5. Copyright: © 1985-2005 by Apple Computer, Inc., all rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://www.freepascal.org/bugs.html
  9. }
  10. { Pascal Translation Updated: Peter N Lewis, <[email protected]>, August 2005 }
  11. {
  12. Modified for use with Free Pascal
  13. Version 200
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$CALLING MWPASCAL}
  21. unit Scrap;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0200}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  45. {$error Conflicting definitions for __ppc__ and __i386__}
  46. {$endc}
  47. {$ifc defined __ppc__ and __ppc__}
  48. {$setc TARGET_CPU_PPC := TRUE}
  49. {$setc TARGET_CPU_X86 := FALSE}
  50. {$elifc defined __i386__ and __i386__}
  51. {$setc TARGET_CPU_PPC := FALSE}
  52. {$setc TARGET_CPU_X86 := TRUE}
  53. {$elsec}
  54. {$error Neither __ppc__ nor __i386__ is defined.}
  55. {$endc}
  56. {$setc TARGET_CPU_PPC_64 := FALSE}
  57. {$ifc defined FPC_BIG_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  60. {$elifc defined FPC_LITTLE_ENDIAN}
  61. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  62. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  63. {$elsec}
  64. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  65. {$endc}
  66. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  67. {$setc CALL_NOT_IN_CARBON := FALSE}
  68. {$setc OLDROUTINENAMES := FALSE}
  69. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  70. {$setc OPAQUE_UPP_TYPES := TRUE}
  71. {$setc OTCARBONAPPLICATION := TRUE}
  72. {$setc OTKERNEL := FALSE}
  73. {$setc PM_USE_SESSION_APIS := TRUE}
  74. {$setc TARGET_API_MAC_CARBON := TRUE}
  75. {$setc TARGET_API_MAC_OS8 := FALSE}
  76. {$setc TARGET_API_MAC_OSX := TRUE}
  77. {$setc TARGET_CARBON := TRUE}
  78. {$setc TARGET_CPU_68K := FALSE}
  79. {$setc TARGET_CPU_MIPS := FALSE}
  80. {$setc TARGET_CPU_SPARC := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_UNIX := FALSE}
  83. {$setc TARGET_OS_WIN32 := FALSE}
  84. {$setc TARGET_RT_MAC_68881 := FALSE}
  85. {$setc TARGET_RT_MAC_CFM := FALSE}
  86. {$setc TARGET_RT_MAC_MACHO := TRUE}
  87. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  88. {$setc TYPE_BOOL := FALSE}
  89. {$setc TYPE_EXTENDED := FALSE}
  90. {$setc TYPE_LONGLONG := TRUE}
  91. uses MacTypes,CFBase,MixedMode,MacErrors,CFString;
  92. {$ALIGN MAC68K}
  93. {
  94. ________________________________________________________________
  95. UNIVERSAL SCRAP MANAGER INTERFACES
  96. ________________________________________________________________
  97. The following interfaces are available when compiling for BOTH
  98. Carbon AND Mac OS 8.
  99. ________________________________________________________________
  100. }
  101. {
  102. While we're in here mucking about, we defined a new type to
  103. to put some confusion to rest. The old calls, as well as the
  104. new calls, use the new type. Existing clients should be
  105. blissfully ignorant.
  106. }
  107. type
  108. ScrapFlavorType = FourCharCode;
  109. {
  110. Newsflash! After 15 years of arduous toil, it's finally possible
  111. for specially trained typists wielding advanced text editing
  112. technology to define symbolic names for commonly used scrap
  113. flavor type constants! Apple triumphs again!
  114. }
  115. const
  116. kScrapFlavorTypePicture = $50494354 (* 'PICT' *); { contents of a PicHandle}
  117. kScrapFlavorTypeText = $54455854 (* 'TEXT' *); { stream of characters}
  118. kScrapFlavorTypeTextStyle = $7374796C (* 'styl' *); { see TEGetStyleScrapHandle}
  119. kScrapFlavorTypeMovie = $6D6F6F76 (* 'moov' *); { reference to a movie}
  120. kScrapFlavorTypeSound = $736E6420 (* 'snd ' *); { see SndRecord and SndPlay}
  121. kScrapFlavorTypeUnicode = $75747874 (* 'utxt' *); { stream of UTF16 characters (internal representation)}
  122. kScrapFlavorTypeUTF16External = $75743136 (* 'ut16' *); { stream of UTF16 characters (external representation)}
  123. kScrapFlavorTypeUnicodeStyle = $7573746C (* 'ustl' *); { ATSUI defines; Textension uses}
  124. {
  125. If you are a Carbon client and you need to run on Mac OS 8,
  126. you may still need to load and unload the scrap. Under Mac OS
  127. X, the scrap is held by the pasteboard server instead of in a
  128. handle in your app's heap, so LoadScrap and UnloadScrap do
  129. nothing when called under Mac OS X.
  130. }
  131. {
  132. * LoadScrap()
  133. *
  134. * Mac OS X threading:
  135. * Not thread safe
  136. *
  137. * Availability:
  138. * Mac OS X: in version 10.0 and later in Carbon.framework
  139. * CarbonLib: in CarbonLib 1.0 and later
  140. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  141. }
  142. function LoadScrap: OSStatus; external name '_LoadScrap';
  143. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  144. {
  145. * UnloadScrap()
  146. *
  147. * Mac OS X threading:
  148. * Not thread safe
  149. *
  150. * Availability:
  151. * Mac OS X: in version 10.0 and later in Carbon.framework
  152. * CarbonLib: in CarbonLib 1.0 and later
  153. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  154. }
  155. function UnloadScrap: OSStatus; external name '_UnloadScrap';
  156. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  157. {
  158. * InfoScrap()
  159. *
  160. * Availability:
  161. * Mac OS X: not available
  162. * CarbonLib: not available
  163. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  164. }
  165. {
  166. * GetScrap()
  167. *
  168. * Availability:
  169. * Mac OS X: not available
  170. * CarbonLib: not available
  171. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  172. }
  173. {
  174. * ZeroScrap()
  175. *
  176. * Availability:
  177. * Mac OS X: not available
  178. * CarbonLib: not available
  179. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  180. }
  181. {
  182. * PutScrap()
  183. *
  184. * Availability:
  185. * Mac OS X: not available
  186. * CarbonLib: not available
  187. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  188. }
  189. {
  190. ________________________________________________________________
  191. CARBON SCRAP MANAGER INTERFACES
  192. ________________________________________________________________
  193. The following interfaces are available only when compiling for
  194. Carbon.
  195. ________________________________________________________________
  196. }
  197. {
  198. When promising a scrap flavor, it's OK if you
  199. don't yet know how big the flavor data will be.
  200. In this case, just pass kScrapFlavorSizeUnknown
  201. for the flavor data size.
  202. }
  203. const
  204. kScrapFlavorSizeUnknown = -1;
  205. {
  206. kScrapReservedFlavorType is a flavor type which is reserved
  207. for use by Scrap Manager. If you pass it to Scrap Manager,
  208. it will be rejected.
  209. }
  210. const
  211. kScrapReservedFlavorType = $73726674 (* 'srft' *);
  212. {
  213. We've added scrap flavor flags ala Drag Manager.
  214. kScrapFlavorMaskNone means you want none of the flags.
  215. kScrapFlavorSenderOnlyMask means only the process which
  216. put the flavor on the scrap can see it. If some other
  217. process put a flavor with this flag on the scrap,
  218. your process will never see the flavor, so there's
  219. no point in testing for this flag.
  220. kScrapFlavorTranslated means the flavor was translated
  221. from some other flavor in the scrap by Translation Manager.
  222. Most callers should not care about this bit.
  223. }
  224. const
  225. kScrapFlavorMaskNone = $00000000;
  226. kScrapFlavorMaskSenderOnly = $00000001;
  227. kScrapFlavorMaskTranslated = $00000002;
  228. type
  229. ScrapFlavorFlags = UInt32;
  230. {
  231. ScrapFlavorInfo describes a single flavor within
  232. a scrap.
  233. }
  234. type
  235. ScrapFlavorInfoPtr = ^ScrapFlavorInfo;
  236. ScrapFlavorInfo = record
  237. flavorType: ScrapFlavorType;
  238. flavorFlags: ScrapFlavorFlags;
  239. end;
  240. type
  241. ScrapRef = ^SInt32; { an opaque 32-bit type }
  242. {
  243. kScrapRefNone is guaranteed to be an invalid ScrapRef. This
  244. is convenient when initializing application variables.
  245. }
  246. const
  247. kScrapRefNone = nil;
  248. {
  249. Defined Apple scrap names for GetScrapByName
  250. kScrapClipboardScrap traditional clipboard scrap
  251. kScrapFindScrap compatible with Cocoa's global find scrap
  252. }
  253. {$ifc USE_CFSTR_CONSTANT_MACROS}
  254. {$definec kScrapClipboardScrap CFSTRP('com.apple.scrap.clipboard')}
  255. {$endc}
  256. {$ifc USE_CFSTR_CONSTANT_MACROS}
  257. {$definec kScrapFindScrap CFSTRP('com.apple.scrap.find')}
  258. {$endc}
  259. { Enumerated options to be passed to GetScrapByName}
  260. const
  261. kScrapGetNamedScrap = 0; { get current named scrap without bumping}
  262. kScrapClearNamedScrap = 1 shl 0; { acquire the named scrap, bumping and clearing}
  263. {
  264. GetScrapByName allows access to an indefinite number of public or private
  265. scraps. The constant kScrapClipboardScrap refers to the "current" scrap
  266. we've all come to know and love. kScrapFindScrap allows Carbon apps to
  267. interact seamlessly with Cocoa's global find scrap. Note that calling:
  268. GetScrapByName( kScrapClipboardScrap, kScrapGetNamedScrap, &scrap );
  269. is an exact match to the call:
  270. GetCurrentScrap( &scrap );
  271. Additionally, a call to:
  272. GetScrapByName( kScrapClipboardScrap, kScrapClearNamedScrap, &scrap );
  273. is a replacement for the sequence:
  274. ClearCurrentScrap();
  275. GetCurrentScrap( &scrap );
  276. You can use this API to generate your own private scraps to use as a high
  277. level interprocess communication between your main and helper apps. The Java
  278. naming convention is suggested for your scraps ( ie. com.joeco.scrap.secret ).
  279. CarbonLib does not support arbitrary named scraps; when calling this API on
  280. CarbonLib, kScrapClipboardScrap is the only supported value for the name parameter.
  281. }
  282. {
  283. * GetScrapByName()
  284. *
  285. * Mac OS X threading:
  286. * Not thread safe
  287. *
  288. * Availability:
  289. * Mac OS X: in version 10.1 and later in Carbon.framework
  290. * CarbonLib: in CarbonLib 1.5 and later
  291. * Non-Carbon CFM: not available
  292. }
  293. function GetScrapByName( name: CFStringRef; options: OptionBits; var scrap: ScrapRef ): OSStatus; external name '_GetScrapByName';
  294. (* AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER *)
  295. {
  296. GetCurrentScrap obtains a reference to the current scrap.
  297. The ScrapRef obtained via GetCurrentScrap will become
  298. invalid and unusable after the scrap is cleared.
  299. }
  300. {
  301. * GetCurrentScrap()
  302. *
  303. * Mac OS X threading:
  304. * Not thread safe
  305. *
  306. * Availability:
  307. * Mac OS X: in version 10.0 and later in Carbon.framework
  308. * CarbonLib: in CarbonLib 1.0 and later
  309. * Non-Carbon CFM: not available
  310. }
  311. function GetCurrentScrap( var scrap: ScrapRef ): OSStatus; external name '_GetCurrentScrap';
  312. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  313. {
  314. GetScrapFlavorFlags tells you [a] whether the scrap contains
  315. data for a particular flavor and [b] some things about that
  316. flavor if it exists. This call never blocks, and is useful
  317. for deciding whether to enable the Paste item in your Edit
  318. menu, among other things.
  319. }
  320. {
  321. * GetScrapFlavorFlags()
  322. *
  323. * Mac OS X threading:
  324. * Not thread safe
  325. *
  326. * Availability:
  327. * Mac OS X: in version 10.0 and later in Carbon.framework
  328. * CarbonLib: in CarbonLib 1.0 and later
  329. * Non-Carbon CFM: not available
  330. }
  331. function GetScrapFlavorFlags( scrap: ScrapRef; flavorType: ScrapFlavorType; var flavorFlags: ScrapFlavorFlags ): OSStatus; external name '_GetScrapFlavorFlags';
  332. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  333. {
  334. GetScrapFlavorSize gets the size of the data of the specified
  335. flavor. This function blocks until the specified flavor
  336. data is available. GetScrapFlavorSize is intended as a prelude
  337. to allocating memory and calling GetScrapFlavorData.
  338. }
  339. {
  340. * GetScrapFlavorSize()
  341. *
  342. * Mac OS X threading:
  343. * Not thread safe
  344. *
  345. * Availability:
  346. * Mac OS X: in version 10.0 and later in Carbon.framework
  347. * CarbonLib: in CarbonLib 1.0 and later
  348. * Non-Carbon CFM: not available
  349. }
  350. function GetScrapFlavorSize( scrap: ScrapRef; flavorType: ScrapFlavorType; var byteCount: Size ): OSStatus; external name '_GetScrapFlavorSize';
  351. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  352. {
  353. GetScrapFlavorData gets the data from the specified flavor in the
  354. specified scrap. This function blocks until the specified flavor
  355. data is available. Specify the maximum size your buffer can contain;
  356. on output, this function produces the number of bytes that were
  357. available (even if this is more than you requested).
  358. }
  359. {
  360. * GetScrapFlavorData()
  361. *
  362. * Mac OS X threading:
  363. * Not thread safe
  364. *
  365. * Availability:
  366. * Mac OS X: in version 10.0 and later in Carbon.framework
  367. * CarbonLib: in CarbonLib 1.0 and later
  368. * Non-Carbon CFM: not available
  369. }
  370. function GetScrapFlavorData( scrap: ScrapRef; flavorType: ScrapFlavorType; var byteCount: Size; destination: UnivPtr ): OSStatus; external name '_GetScrapFlavorData';
  371. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  372. {
  373. ClearCurrentScrap clears the current scrap. Call this
  374. first when the user requests a Copy or Cut operation --
  375. even if you maintain a private scrap! You should not wait
  376. until receiving a suspend event to call ClearCurrentScrap. Call
  377. it immediately after the user requests a Copy or Cut operation.
  378. You don't need to put any data on the scrap immediately (although
  379. it's perfectly fine to do so). You DO need to call GetCurrentScrap
  380. after ClearCurrentScrap so you'll have a valid ScrapRef to pass
  381. to other functions.
  382. }
  383. {
  384. * ClearCurrentScrap()
  385. *
  386. * Mac OS X threading:
  387. * Not thread safe
  388. *
  389. * Availability:
  390. * Mac OS X: in version 10.0 and later in Carbon.framework
  391. * CarbonLib: in CarbonLib 1.0 and later
  392. * Non-Carbon CFM: not available
  393. }
  394. function ClearCurrentScrap: OSStatus; external name '_ClearCurrentScrap';
  395. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  396. {
  397. ClearScrap will clear the scrap passed in and return the bumped
  398. ScrapRef value. ClearScrap behaves similarly to GetScrapByName
  399. when called with the kScrapClearNamedScrap option with the
  400. benefit of not requiring a name in the event one is not available.
  401. CarbonLib does not support arbitrary named scraps; when calling this
  402. API on CarbonLib, only clearing the current scrap is supported.
  403. }
  404. {
  405. * ClearScrap()
  406. *
  407. * Mac OS X threading:
  408. * Not thread safe
  409. *
  410. * Availability:
  411. * Mac OS X: in version 10.1 and later in Carbon.framework
  412. * CarbonLib: in CarbonLib 1.5 and later
  413. * Non-Carbon CFM: not available
  414. }
  415. function ClearScrap( var inOutScrap: ScrapRef ): OSStatus; external name '_ClearScrap';
  416. (* AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER *)
  417. {
  418. PutScrapFlavor is a lot like PutScrap, with two differences:
  419. we added a ScrapRef parameter at the beginning and you can
  420. "promise" various aspects of a flavor. If you pass a NIL
  421. data pointer, this is a promise that in the future you
  422. will provide data for this flavor. Provide the data
  423. through a subsequent call to PutScrapFlavor, either later
  424. in the same code flow or during a scrap promise keeper proc.
  425. If you know how big the data is, you can pass the size as
  426. well, and this may allow subsequent callers of GetScrapFlavorInfo
  427. to avoid blocking. If you don't know the size, pass -1.
  428. If you pass a 0 size, you are telling Scrap Manager not to
  429. expect any data for this flavor. In this case, the flavor
  430. data pointer is ignored. NOTE: the last time you can provide
  431. scrap flavor data is when your scrap promise keeper gets
  432. called. It is NOT possible to call PutScrapFlavor while
  433. handling a suspend event; suspend events under Carbon
  434. simply don't work the way they do under Mac OS 8.
  435. The method for setting Scrap Manager promises differs from that for Drag Manger promises.
  436. This chart describes the method for setting scrap promises via PutScrapFlavor().
  437. dataPtr dataSize result
  438. pointer value actual data size The data of size dataSize pointed to by dataPtr is added to the scrap.
  439. 0 actual data size A promise for data of size dataSize is placed on the scrap.
  440. 0 -1 A promise for data of an undetermined size is placed on the scrap.
  441. ignored 0 A flavor with no data expected is placed on the scrap. This is not a promise.
  442. }
  443. {
  444. * PutScrapFlavor()
  445. *
  446. * Mac OS X threading:
  447. * Not thread safe
  448. *
  449. * Availability:
  450. * Mac OS X: in version 10.0 and later in Carbon.framework
  451. * CarbonLib: in CarbonLib 1.0 and later
  452. * Non-Carbon CFM: not available
  453. }
  454. function PutScrapFlavor( scrap: ScrapRef; flavorType: ScrapFlavorType; flavorFlags: ScrapFlavorFlags; flavorSize: Size; flavorData: {const} UnivPtr { can be NULL } ): OSStatus; external name '_PutScrapFlavor';
  455. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  456. {
  457. ScrapPromiseKeeper is a function you write which is called by
  458. Scrap Manager as needed to keep your earlier promise of a
  459. particular scrap flavor. When your function is called, deliver
  460. the requested data by calling PutScrapFlavor.
  461. }
  462. type
  463. ScrapPromiseKeeperProcPtr = function( scrap: ScrapRef; flavorType: ScrapFlavorType; userData: UnivPtr ): OSStatus;
  464. type
  465. ScrapPromiseKeeperUPP = ScrapPromiseKeeperProcPtr;
  466. {
  467. * NewScrapPromiseKeeperUPP()
  468. *
  469. * Availability:
  470. * Mac OS X: in version 10.0 and later in Carbon.framework
  471. * CarbonLib: in CarbonLib 1.0 and later
  472. * Non-Carbon CFM: available as macro/inline
  473. }
  474. function NewScrapPromiseKeeperUPP( userRoutine: ScrapPromiseKeeperProcPtr ): ScrapPromiseKeeperUPP; external name '_NewScrapPromiseKeeperUPP';
  475. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  476. {
  477. * DisposeScrapPromiseKeeperUPP()
  478. *
  479. * Availability:
  480. * Mac OS X: in version 10.0 and later in Carbon.framework
  481. * CarbonLib: in CarbonLib 1.0 and later
  482. * Non-Carbon CFM: available as macro/inline
  483. }
  484. procedure DisposeScrapPromiseKeeperUPP( userUPP: ScrapPromiseKeeperUPP ); external name '_DisposeScrapPromiseKeeperUPP';
  485. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  486. {
  487. * InvokeScrapPromiseKeeperUPP()
  488. *
  489. * Availability:
  490. * Mac OS X: in version 10.0 and later in Carbon.framework
  491. * CarbonLib: in CarbonLib 1.0 and later
  492. * Non-Carbon CFM: available as macro/inline
  493. }
  494. function InvokeScrapPromiseKeeperUPP( scrap: ScrapRef; flavorType: ScrapFlavorType; userData: UnivPtr; userUPP: ScrapPromiseKeeperUPP ): OSStatus; external name '_InvokeScrapPromiseKeeperUPP';
  495. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  496. {
  497. SetScrapPromiseKeeper associates a ScrapPromiseKeeper with a
  498. scrap. You can remove a ScrapPromiseKeeper from a scrap by
  499. passing a NIL ScrapPromiseKeeper to SetScrapPromiseKeeper.
  500. Pass whatever you like in the last parameter; its value will
  501. be passed to your ScrapPromiseKeeper, which can do whatever
  502. it likes with the value. You might choose to pass a pointer
  503. or handle to some private scrap data which the
  504. ScrapPromiseKeeper could use in fabricating one or more
  505. promised flavors.
  506. }
  507. {
  508. * SetScrapPromiseKeeper()
  509. *
  510. * Mac OS X threading:
  511. * Not thread safe
  512. *
  513. * Availability:
  514. * Mac OS X: in version 10.0 and later in Carbon.framework
  515. * CarbonLib: in CarbonLib 1.0 and later
  516. * Non-Carbon CFM: not available
  517. }
  518. function SetScrapPromiseKeeper( scrap: ScrapRef; upp: ScrapPromiseKeeperUPP; userData: {const} UnivPtr ): OSStatus; external name '_SetScrapPromiseKeeper';
  519. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  520. {
  521. GetScrapFlavorCount produces the number of
  522. items which can be obtained by GetScrapFlavorInfoList.
  523. }
  524. {
  525. * GetScrapFlavorCount()
  526. *
  527. * Mac OS X threading:
  528. * Not thread safe
  529. *
  530. * Availability:
  531. * Mac OS X: in version 10.0 and later in Carbon.framework
  532. * CarbonLib: in CarbonLib 1.0 and later
  533. * Non-Carbon CFM: not available
  534. }
  535. function GetScrapFlavorCount( scrap: ScrapRef; var infoCount: UInt32 ): OSStatus; external name '_GetScrapFlavorCount';
  536. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  537. {
  538. GetScrapFlavorInfoList fills a list (array)
  539. of items which each describe the corresponding
  540. flavor in the scrap. It fills no more array
  541. elements as are specified. On exit, it produces
  542. the count of elements it filled (which may be
  543. smaller than the count requested). Yes, YOU
  544. must provide the memory for the array.
  545. }
  546. {
  547. * GetScrapFlavorInfoList()
  548. *
  549. * Mac OS X threading:
  550. * Not thread safe
  551. *
  552. * Availability:
  553. * Mac OS X: in version 10.0 and later in Carbon.framework
  554. * CarbonLib: in CarbonLib 1.0 and later
  555. * Non-Carbon CFM: not available
  556. }
  557. function GetScrapFlavorInfoList( scrap: ScrapRef; var infoCount: UInt32; info: {variable-size-array} ScrapFlavorInfoPtr ): OSStatus; external name '_GetScrapFlavorInfoList';
  558. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  559. {
  560. CallInScrapPromises forces all promises to be kept.
  561. If your application promises at least one flavor
  562. AND it does NOT adopt the new event model, you
  563. should call this function when your application
  564. is about to quit. If your app promises no flavors,
  565. there is no need to call this function, and if
  566. your app adopts the new event model, this function
  567. will be called automagically for you. It doesn't
  568. hurt to call this function more than once, though
  569. promise keepers may be asked to keep promises
  570. they already tried and failed.
  571. }
  572. {
  573. * CallInScrapPromises()
  574. *
  575. * Mac OS X threading:
  576. * Not thread safe
  577. *
  578. * Availability:
  579. * Mac OS X: in version 10.0 and later in Carbon.framework
  580. * CarbonLib: in CarbonLib 1.0 and later
  581. * Non-Carbon CFM: not available
  582. }
  583. function CallInScrapPromises: OSStatus; external name '_CallInScrapPromises';
  584. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  585. end.