PMApplication.pas 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. {
  2. File: Print/PMApplication.h
  3. Contains: Carbon Printing Manager Interfaces.
  4. Copyright (c) 1998-2008 Apple Inc. All Rights Reserved.
  5. Bugs?: For bug reports, consult the following page on
  6. the World Wide Web:
  7. http://www.freepascal.org/bugs.html
  8. }
  9. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2009 }
  10. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2012 }
  11. {
  12. Modified for use with Free Pascal
  13. Version 308
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  17. {$mode macpas}
  18. {$packenum 1}
  19. {$macro on}
  20. {$inline on}
  21. {$calling mwpascal}
  22. unit PMApplication;
  23. interface
  24. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  25. {$setc GAP_INTERFACES_VERSION := $0308}
  26. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  27. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  28. {$endc}
  29. {$ifc defined CPUPOWERPC and defined CPUI386}
  30. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  31. {$endc}
  32. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  33. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  34. {$endc}
  35. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  36. {$setc __ppc__ := 1}
  37. {$elsec}
  38. {$setc __ppc__ := 0}
  39. {$endc}
  40. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  41. {$setc __ppc64__ := 1}
  42. {$elsec}
  43. {$setc __ppc64__ := 0}
  44. {$endc}
  45. {$ifc not defined __i386__ and defined CPUI386}
  46. {$setc __i386__ := 1}
  47. {$elsec}
  48. {$setc __i386__ := 0}
  49. {$endc}
  50. {$ifc not defined __x86_64__ and defined CPUX86_64}
  51. {$setc __x86_64__ := 1}
  52. {$elsec}
  53. {$setc __x86_64__ := 0}
  54. {$endc}
  55. {$ifc not defined __arm__ and defined CPUARM}
  56. {$setc __arm__ := 1}
  57. {$elsec}
  58. {$setc __arm__ := 0}
  59. {$endc}
  60. {$ifc defined cpu64}
  61. {$setc __LP64__ := 1}
  62. {$elsec}
  63. {$setc __LP64__ := 0}
  64. {$endc}
  65. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  66. {$error Conflicting definitions for __ppc__ and __i386__}
  67. {$endc}
  68. {$ifc defined __ppc__ and __ppc__}
  69. {$setc TARGET_CPU_PPC := TRUE}
  70. {$setc TARGET_CPU_PPC64 := FALSE}
  71. {$setc TARGET_CPU_X86 := FALSE}
  72. {$setc TARGET_CPU_X86_64 := FALSE}
  73. {$setc TARGET_CPU_ARM := FALSE}
  74. {$setc TARGET_OS_MAC := TRUE}
  75. {$setc TARGET_OS_IPHONE := FALSE}
  76. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  77. {$setc TARGET_OS_EMBEDDED := 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. {$setc TARGET_OS_EMBEDDED := FALSE}
  88. {$elifc defined __i386__ and __i386__}
  89. {$setc TARGET_CPU_PPC := FALSE}
  90. {$setc TARGET_CPU_PPC64 := FALSE}
  91. {$setc TARGET_CPU_X86 := TRUE}
  92. {$setc TARGET_CPU_X86_64 := FALSE}
  93. {$setc TARGET_CPU_ARM := FALSE}
  94. {$ifc defined(iphonesim)}
  95. {$setc TARGET_OS_MAC := FALSE}
  96. {$setc TARGET_OS_IPHONE := TRUE}
  97. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  98. {$elsec}
  99. {$setc TARGET_OS_MAC := TRUE}
  100. {$setc TARGET_OS_IPHONE := FALSE}
  101. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  102. {$endc}
  103. {$setc TARGET_OS_EMBEDDED := FALSE}
  104. {$elifc defined __x86_64__ and __x86_64__}
  105. {$setc TARGET_CPU_PPC := FALSE}
  106. {$setc TARGET_CPU_PPC64 := FALSE}
  107. {$setc TARGET_CPU_X86 := FALSE}
  108. {$setc TARGET_CPU_X86_64 := TRUE}
  109. {$setc TARGET_CPU_ARM := FALSE}
  110. {$setc TARGET_OS_MAC := TRUE}
  111. {$setc TARGET_OS_IPHONE := FALSE}
  112. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  113. {$setc TARGET_OS_EMBEDDED := FALSE}
  114. {$elifc defined __arm__ and __arm__}
  115. {$setc TARGET_CPU_PPC := FALSE}
  116. {$setc TARGET_CPU_PPC64 := FALSE}
  117. {$setc TARGET_CPU_X86 := FALSE}
  118. {$setc TARGET_CPU_X86_64 := FALSE}
  119. {$setc TARGET_CPU_ARM := TRUE}
  120. { will require compiler define when/if other Apple devices with ARM cpus ship }
  121. {$setc TARGET_OS_MAC := FALSE}
  122. {$setc TARGET_OS_IPHONE := TRUE}
  123. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  124. {$setc TARGET_OS_EMBEDDED := TRUE}
  125. {$elsec}
  126. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ is defined.}
  127. {$endc}
  128. {$ifc defined __LP64__ and __LP64__ }
  129. {$setc TARGET_CPU_64 := TRUE}
  130. {$elsec}
  131. {$setc TARGET_CPU_64 := FALSE}
  132. {$endc}
  133. {$ifc defined FPC_BIG_ENDIAN}
  134. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  135. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  136. {$elifc defined FPC_LITTLE_ENDIAN}
  137. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  138. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  139. {$elsec}
  140. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  141. {$endc}
  142. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  143. {$setc CALL_NOT_IN_CARBON := FALSE}
  144. {$setc OLDROUTINENAMES := FALSE}
  145. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  146. {$setc OPAQUE_UPP_TYPES := TRUE}
  147. {$setc OTCARBONAPPLICATION := TRUE}
  148. {$setc OTKERNEL := FALSE}
  149. {$setc PM_USE_SESSION_APIS := TRUE}
  150. {$setc TARGET_API_MAC_CARBON := TRUE}
  151. {$setc TARGET_API_MAC_OS8 := FALSE}
  152. {$setc TARGET_API_MAC_OSX := TRUE}
  153. {$setc TARGET_CARBON := TRUE}
  154. {$setc TARGET_CPU_68K := FALSE}
  155. {$setc TARGET_CPU_MIPS := FALSE}
  156. {$setc TARGET_CPU_SPARC := FALSE}
  157. {$setc TARGET_OS_UNIX := FALSE}
  158. {$setc TARGET_OS_WIN32 := FALSE}
  159. {$setc TARGET_RT_MAC_68881 := FALSE}
  160. {$setc TARGET_RT_MAC_CFM := FALSE}
  161. {$setc TARGET_RT_MAC_MACHO := TRUE}
  162. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  163. {$setc TYPE_BOOL := FALSE}
  164. {$setc TYPE_EXTENDED := FALSE}
  165. {$setc TYPE_LONGLONG := TRUE}
  166. uses MacTypes,Dialogs,QuickdrawTypes,PMDefinitions,CFBase;
  167. {$endc} {not MACOSALLINCLUDE}
  168. {$ifc TARGET_OS_MAC}
  169. {$ALIGN POWER}
  170. {$ifc not TARGET_CPU_64}
  171. { Callbacks }
  172. type
  173. PMSheetDoneProcPtr = procedure( printSession: PMPrintSession; documentWindow: WindowRef; accepted: Boolean );
  174. PMSheetDoneUPP = PMSheetDoneProcPtr;
  175. {
  176. * NewPMSheetDoneUPP()
  177. *
  178. * Availability:
  179. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  180. * CarbonLib: in CarbonLib 1.1 and later
  181. * Non-Carbon CFM: not available
  182. }
  183. function NewPMSheetDoneUPP( userRoutine: PMSheetDoneProcPtr ): PMSheetDoneUPP; external name '_NewPMSheetDoneUPP';
  184. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  185. {
  186. * DisposePMSheetDoneUPP()
  187. *
  188. * Availability:
  189. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  190. * CarbonLib: in CarbonLib 1.1 and later
  191. * Non-Carbon CFM: not available
  192. }
  193. procedure DisposePMSheetDoneUPP( userUPP: PMSheetDoneUPP ); external name '_DisposePMSheetDoneUPP';
  194. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  195. {
  196. * InvokePMSheetDoneUPP()
  197. *
  198. * Availability:
  199. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  200. * CarbonLib: in CarbonLib 1.1 and later
  201. * Non-Carbon CFM: not available
  202. }
  203. procedure InvokePMSheetDoneUPP( printSession: PMPrintSession; documentWindow: WindowRef; accepted: Boolean; userUPP: PMSheetDoneUPP ); external name '_InvokePMSheetDoneUPP';
  204. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  205. {$ifc PM_USE_SESSION_APIS}
  206. { Print loop }
  207. {
  208. * PMSessionBeginCGDocument()
  209. *
  210. * Summary:
  211. * Begin a new print job that uses only drawing to a CoreGraphics
  212. * context.
  213. *
  214. * Discussion:
  215. * This is an updated version of the function
  216. * PMSessionBeginDocument. The functionality is identical to
  217. * PMSessionBeginDocument except that during a print job, the caller
  218. * cannot obtain a Quickdraw grafPort for the printing context but
  219. * can only obtain a Quartz graphics context (CGContextRef). This
  220. * function should be used in conjunction with
  221. * PMSessionGetCGGraphicsContext instead of
  222. * PMSessionGetGraphicsContext.
  223. *
  224. * Availability:
  225. * Mac OS X: in version 10.4 and later in Carbon.framework [32-bit only]
  226. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  227. * Non-Carbon CFM: not available
  228. }
  229. function PMSessionBeginCGDocument( printSession: PMPrintSession; printSettings: PMPrintSettings; pageFormat: PMPageFormat ): OSStatus; external name '_PMSessionBeginCGDocument';
  230. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  231. {
  232. * PMSessionEndDocument()
  233. *
  234. * Availability:
  235. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  236. * CarbonLib: in CarbonLib 1.1 and later
  237. * Non-Carbon CFM: not available
  238. }
  239. function PMSessionEndDocument( printSession: PMPrintSession ): OSStatus; external name '_PMSessionEndDocument';
  240. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  241. {
  242. * PMSessionBeginPage()
  243. *
  244. * Availability:
  245. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  246. * CarbonLib: in CarbonLib 1.1 and later
  247. * Non-Carbon CFM: not available
  248. }
  249. function PMSessionBeginPage( printSession: PMPrintSession; pageFormat: PMPageFormat; pageFrame: PMRectPtr ): OSStatus; external name '_PMSessionBeginPage';
  250. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  251. {
  252. * PMSessionEndPage()
  253. *
  254. * Availability:
  255. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  256. * CarbonLib: in CarbonLib 1.1 and later
  257. * Non-Carbon CFM: not available
  258. }
  259. function PMSessionEndPage( printSession: PMPrintSession ): OSStatus; external name '_PMSessionEndPage';
  260. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  261. (*
  262. #pragma mark
  263. #pragma mark Dialogs
  264. #pragma mark
  265. *)
  266. {
  267. * PMSessionPageSetupDialog()
  268. *
  269. * Availability:
  270. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  271. * CarbonLib: in CarbonLib 1.1 and later
  272. * Non-Carbon CFM: not available
  273. }
  274. function PMSessionPageSetupDialog( printSession: PMPrintSession; pageFormat: PMPageFormat; var accepted: Boolean ): OSStatus; external name '_PMSessionPageSetupDialog';
  275. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  276. {
  277. * PMSessionPrintDialog()
  278. *
  279. * Availability:
  280. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  281. * CarbonLib: in CarbonLib 1.1 and later
  282. * Non-Carbon CFM: not available
  283. }
  284. function PMSessionPrintDialog( printSession: PMPrintSession; printSettings: PMPrintSettings; constPageFormat: PMPageFormat; var accepted: Boolean ): OSStatus; external name '_PMSessionPrintDialog';
  285. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  286. {
  287. * PMSessionUseSheets()
  288. *
  289. *
  290. * Availability:
  291. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  292. * CarbonLib: in CarbonLib 1.2 and later
  293. * Non-Carbon CFM: not available
  294. }
  295. function PMSessionUseSheets( printSession: PMPrintSession; documentWindow: WindowRef; sheetDoneProc: PMSheetDoneUPP ): OSStatus; external name '_PMSessionUseSheets';
  296. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  297. {
  298. * PMShowPageSetupDialogAsSheet()
  299. *
  300. * Availability:
  301. * Mac OS X: in version 10.5 and later in Carbon.framework [32-bit only]
  302. * CarbonLib: not available
  303. * Non-Carbon CFM: not available
  304. }
  305. function PMShowPageSetupDialogAsSheet( printSession: PMPrintSession; pageFormat: PMPageFormat; documentWindow: WindowRef; sheetDoneProc: PMSheetDoneUPP ): OSStatus; external name '_PMShowPageSetupDialogAsSheet';
  306. (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
  307. {
  308. * PMShowPrintDialogWithOptions()
  309. *
  310. * Availability:
  311. * Mac OS X: in version 10.5 and later in Carbon.framework [32-bit only]
  312. * CarbonLib: not available
  313. * Non-Carbon CFM: not available
  314. }
  315. function PMShowPrintDialogWithOptions( printSession: PMPrintSession; printSettings: PMPrintSettings; pageFormat: PMPageFormat; printDialogOptions: PMPrintDialogOptionFlags; var accepted: Boolean ): OSStatus; external name '_PMShowPrintDialogWithOptions';
  316. (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
  317. {
  318. * PMShowPrintDialogWithOptionsAsSheet()
  319. *
  320. * Availability:
  321. * Mac OS X: in version 10.5 and later in Carbon.framework [32-bit only]
  322. * CarbonLib: not available
  323. * Non-Carbon CFM: not available
  324. }
  325. function PMShowPrintDialogWithOptionsAsSheet( printSession: PMPrintSession; printSettings: PMPrintSettings; pageFormat: PMPageFormat; printDialogOptions: PMPrintDialogOptionFlags; documentWindow: WindowRef; sheetDoneProc: PMSheetDoneUPP ): OSStatus; external name '_PMShowPrintDialogWithOptionsAsSheet';
  326. (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
  327. (*
  328. #pragma mark
  329. #pragma mark Presets
  330. #pragma mark
  331. *)
  332. { Presets }
  333. {
  334. * PMSessionEnablePrinterPresets()
  335. *
  336. * Summary:
  337. * Enable the use of printer presets in the print dialog.
  338. *
  339. * Discussion:
  340. * Displaying the print dialog on a session after making this call
  341. * will show the presets available for the specified graphics type.
  342. *
  343. * Parameters:
  344. *
  345. * session:
  346. * The session that will be used to present the print dialog.
  347. *
  348. * graphicsType:
  349. * The printer presets in the dialog should be suitable for
  350. * rendering this type of graphic. Currently defined graphics
  351. * types are: "Photo"
  352. *
  353. * Availability:
  354. * Mac OS X: in version 10.2 and later in Carbon.framework [32-bit only]
  355. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  356. * Non-Carbon CFM: not available
  357. }
  358. function PMSessionEnablePrinterPresets( session: PMPrintSession; graphicsType: CFStringRef ): OSStatus; external name '_PMSessionEnablePrinterPresets';
  359. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  360. {
  361. * PMSessionDisablePrinterPresets()
  362. *
  363. * Summary:
  364. * Disable the use of printer presets in the print dialog.
  365. *
  366. * Parameters:
  367. *
  368. * session:
  369. * The session that will be used to present the print dialog.
  370. *
  371. * Availability:
  372. * Mac OS X: in version 10.2 and later in Carbon.framework [32-bit only]
  373. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  374. * Non-Carbon CFM: not available
  375. }
  376. function PMSessionDisablePrinterPresets( session: PMPrintSession ): OSStatus; external name '_PMSessionDisablePrinterPresets';
  377. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  378. {$endc} {PM_USE_SESSION_APIS}
  379. {$endc} {not TARGET_CPU_64}
  380. {$endc} {TARGET_OS_MAC}
  381. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  382. end.
  383. {$endc} {not MACOSALLINCLUDE}