Scrap.pas 28 KB

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