IBCarbonRuntime.pas 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. {
  2. File: HIToolbox/IBCarbonRuntime.h
  3. Contains: Nib support for Carbon
  4. Version: HIToolbox-437~1
  5. Copyright: © 2000-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 IBCarbonRuntime;
  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,QuickdrawTypes,Menus,CFString,CFBundle,MacWindows,ControlDefinitions;
  163. {$endc} {not MACOSALLINCLUDE}
  164. {$ifc TARGET_OS_MAC}
  165. {$ALIGN POWER}
  166. const
  167. kIBCarbonRuntimeCantFindNibFile = -10960;
  168. kIBCarbonRuntimeObjectNotOfRequestedType = -10961;
  169. kIBCarbonRuntimeCantFindObject = -10962;
  170. { ----- typedef ------ }
  171. type
  172. IBNibRef = ^SInt32; { an opaque type }
  173. { ----- Create & Dispose NIB References ------ }
  174. {$ifc not TARGET_CPU_64}
  175. {
  176. * CreateNibReference()
  177. *
  178. * Mac OS X threading:
  179. * Not thread safe
  180. *
  181. * Availability:
  182. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  183. * CarbonLib: in CarbonLib 1.1 and later
  184. * Non-Carbon CFM: not available
  185. }
  186. function CreateNibReference( inNibName: CFStringRef; var outNibRef: IBNibRef ): OSStatus; external name '_CreateNibReference';
  187. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  188. {
  189. * CreateNibReferenceWithCFBundle()
  190. *
  191. * Mac OS X threading:
  192. * Not thread safe
  193. *
  194. * Availability:
  195. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  196. * CarbonLib: in CarbonLib 1.1 and later
  197. * Non-Carbon CFM: not available
  198. }
  199. function CreateNibReferenceWithCFBundle( inBundle: CFBundleRef; inNibName: CFStringRef; var outNibRef: IBNibRef ): OSStatus; external name '_CreateNibReferenceWithCFBundle';
  200. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  201. {
  202. * DisposeNibReference()
  203. *
  204. * Mac OS X threading:
  205. * Not thread safe
  206. *
  207. * Availability:
  208. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  209. * CarbonLib: in CarbonLib 1.1 and later
  210. * Non-Carbon CFM: not available
  211. }
  212. procedure DisposeNibReference( inNibRef: IBNibRef ); external name '_DisposeNibReference';
  213. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  214. { ----- Window ------ }
  215. {
  216. * CreateWindowFromNib()
  217. *
  218. * Summary:
  219. * Creates a window from a description stored in a nib file.
  220. *
  221. * Mac OS X threading:
  222. * Not thread safe
  223. *
  224. * Parameters:
  225. *
  226. * inNibRef:
  227. * The identifier for the nib file containing the window
  228. * description.
  229. *
  230. * inName:
  231. * The name of the window description.
  232. *
  233. * outWindow:
  234. * On exit, contains the window, if creation of the window was
  235. * successful.
  236. *
  237. * Availability:
  238. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  239. * CarbonLib: in CarbonLib 1.1 and later
  240. * Non-Carbon CFM: not available
  241. }
  242. function CreateWindowFromNib( inNibRef: IBNibRef; inName: CFStringRef; var outWindow: WindowRef ): OSStatus; external name '_CreateWindowFromNib';
  243. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  244. { ----- Menu -----}
  245. {
  246. * CreateMenuFromNib()
  247. *
  248. * Mac OS X threading:
  249. * Not thread safe
  250. *
  251. * Availability:
  252. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  253. * CarbonLib: in CarbonLib 1.1 and later
  254. * Non-Carbon CFM: not available
  255. }
  256. function CreateMenuFromNib( inNibRef: IBNibRef; inName: CFStringRef; var outMenuRef: MenuRef ): OSStatus; external name '_CreateMenuFromNib';
  257. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  258. { ----- MenuBar ------}
  259. {
  260. * CreateMenuBarFromNib()
  261. *
  262. * Mac OS X threading:
  263. * Not thread safe
  264. *
  265. * Availability:
  266. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  267. * CarbonLib: in CarbonLib 1.1 and later
  268. * Non-Carbon CFM: not available
  269. }
  270. function CreateMenuBarFromNib( inNibRef: IBNibRef; inName: CFStringRef; var outMenuBar: Handle ): OSStatus; external name '_CreateMenuBarFromNib';
  271. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  272. {
  273. * SetMenuBarFromNib()
  274. *
  275. * Mac OS X threading:
  276. * Not thread safe
  277. *
  278. * Availability:
  279. * Mac OS X: in version 10.0 and later in Carbon.framework [32-bit only]
  280. * CarbonLib: in CarbonLib 1.1 and later
  281. * Non-Carbon CFM: not available
  282. }
  283. function SetMenuBarFromNib( inNibRef: IBNibRef; inName: CFStringRef ): OSStatus; external name '_SetMenuBarFromNib';
  284. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  285. {$endc} {not TARGET_CPU_64}
  286. {$endc} {TARGET_OS_MAC}
  287. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  288. end.
  289. {$endc} {not MACOSALLINCLUDE}