Scrap.pas 27 KB

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