Scrap.pas 28 KB

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