Keyboards.pas 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. {
  2. File: HIToolbox/Keyboards.h
  3. Contains: Keyboard API.
  4. Version: HIToolbox-624~3
  5. Copyright: © 1997-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 Keyboards;
  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;
  202. {$endc} {not MACOSALLINCLUDE}
  203. {$ifc TARGET_OS_MAC}
  204. {$ALIGN POWER}
  205. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  206. { Keyboard API constants }
  207. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  208. {
  209. * PhysicalKeyboardLayoutType
  210. *
  211. * Summary:
  212. * Physical keyboard layout types indicate the physical keyboard
  213. * layout. They are returned by the KBGetLayoutType API.
  214. }
  215. type
  216. PhysicalKeyboardLayoutType = OSType;
  217. const
  218. {
  219. * A JIS keyboard layout type.
  220. }
  221. kKeyboardJIS = FourCharCode('JIS ');
  222. {
  223. * An ANSI keyboard layout type.
  224. }
  225. kKeyboardANSI = FourCharCode('ANSI');
  226. {
  227. * An ISO keyboard layout type.
  228. }
  229. kKeyboardISO = FourCharCode('ISO ');
  230. {
  231. * An unknown physical keyboard layout type.
  232. }
  233. kKeyboardUnknown = kUnknownType; { '????'}
  234. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  235. { Keyboard API types }
  236. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  237. {
  238. * KeyboardLayoutRef
  239. *
  240. * Summary:
  241. * The opaque keyboard layout contains information about a keyboard
  242. * layout. It is used with the keyboard layout APIs.
  243. *
  244. * Discussion:
  245. * KeyboardLayoutRef APIs follow CoreFoundation function naming
  246. * convention. You mustn't release any references you get from APIs
  247. * named "Get."
  248. }
  249. type
  250. KeyboardLayoutRef = ^OpaqueKeyboardLayoutRef; { an opaque type }
  251. OpaqueKeyboardLayoutRef = record end;
  252. {
  253. * KeyboardLayoutPropertyTag
  254. *
  255. * Summary:
  256. * Keyboard layout property tags specify the value you want to
  257. * retrieve. They are used with the KLGetKeyboardLayoutProperty API.
  258. }
  259. type
  260. KeyboardLayoutPropertyTag = UInt32;
  261. const
  262. {
  263. * The keyboard layout data (const void *). It is used with the
  264. * KeyTranslate API.
  265. }
  266. kKLKCHRData = 0;
  267. {
  268. * The keyboard layout data (const void *). It is used with the
  269. * UCKeyTranslate API.
  270. }
  271. kKLuchrData = 1;
  272. {
  273. * The keyboard layout identifier (KeyboardLayoutIdentifier).
  274. }
  275. kKLIdentifier = 2;
  276. {
  277. * The keyboard layout icon (IconRef).
  278. }
  279. kKLIcon = 3;
  280. {
  281. * The localized keyboard layout name (CFStringRef).
  282. }
  283. kKLLocalizedName = 4;
  284. {
  285. * The keyboard layout name (CFStringRef).
  286. }
  287. kKLName = 5;
  288. {
  289. * The keyboard layout group identifier (SInt32).
  290. }
  291. kKLGroupIdentifier = 6;
  292. {
  293. * The keyboard layout kind (KeyboardLayoutKind).
  294. }
  295. kKLKind = 7;
  296. {
  297. * The language/locale string associated with the keyboard, if any
  298. * (CFStringRef). This string uses ISO 639 and ISO 3166 codes
  299. * (examples: "fr", "en_US". Note: The CFStringRef may be NULL for
  300. * some keyboards.
  301. }
  302. kKLLanguageCode = 9;
  303. {
  304. * KeyboardLayoutKind
  305. *
  306. * Summary:
  307. * Keyboard layout kinds indicate available keyboard layout formats.
  308. }
  309. type
  310. KeyboardLayoutKind = SInt32;
  311. const
  312. {
  313. * Both KCHR and uchr formats are available.
  314. }
  315. kKLKCHRuchrKind = 0;
  316. {
  317. * Only KCHR format is avaiable.
  318. }
  319. kKLKCHRKind = 1;
  320. {
  321. * Only uchr format is available.
  322. }
  323. kKLuchrKind = 2;
  324. {
  325. * KeyboardLayoutIdentifier
  326. *
  327. * Summary:
  328. * Keyboard layout identifiers specify particular keyboard layouts.
  329. }
  330. type
  331. KeyboardLayoutIdentifier = SInt32;
  332. const
  333. kKLUSKeyboard = 0;
  334. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  335. { Keyboard API routines }
  336. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  337. {
  338. * KBGetLayoutType()
  339. *
  340. * Summary:
  341. * Returns the physical keyboard layout type.
  342. *
  343. * Mac OS X threading:
  344. * Not thread safe
  345. *
  346. * Parameters:
  347. *
  348. * iKeyboardType:
  349. * The keyboard type ID. LMGetKbdType().
  350. *
  351. * Availability:
  352. * Mac OS X: in version 10.0 and later in Carbon.framework
  353. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  354. * Non-Carbon CFM: in KeyboardsLib 1.0 and later
  355. }
  356. function KBGetLayoutType( iKeyboardType: SInt16 ): PhysicalKeyboardLayoutType; external name '_KBGetLayoutType';
  357. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  358. { iterate keyboard layouts}
  359. {$ifc not TARGET_CPU_64}
  360. {
  361. * KLGetKeyboardLayoutCount() *** DEPRECATED ***
  362. *
  363. * Deprecated:
  364. * Use TISCreateInputSourceList API to create a list of input
  365. * sources that match specified properties.
  366. *
  367. * Summary:
  368. * Returns the number of keyboard layouts.
  369. *
  370. * Mac OS X threading:
  371. * Not thread safe
  372. *
  373. * Parameters:
  374. *
  375. * oCount:
  376. * On exit, the number of keyboard layouts
  377. *
  378. * Availability:
  379. * Mac OS X: in version 10.2 and later in Carbon.framework [32-bit only] but deprecated in 10.5
  380. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  381. * Non-Carbon CFM: not available
  382. }
  383. function KLGetKeyboardLayoutCount( var oCount: CFIndex ): OSStatus; external name '_KLGetKeyboardLayoutCount';
  384. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
  385. {
  386. * KLGetKeyboardLayoutAtIndex() *** DEPRECATED ***
  387. *
  388. * Deprecated:
  389. * Use TISCreateInputSourceList API to create a list of input
  390. * sources that match specified properties.
  391. *
  392. * Summary:
  393. * Retrieves the keyboard layout at the given index.
  394. *
  395. * Mac OS X threading:
  396. * Not thread safe
  397. *
  398. * Parameters:
  399. *
  400. * iIndex:
  401. * The index of the keyboard layout to retrieve. If the index is
  402. * outside the index space of the keyboard layouts (0 to N-1
  403. * inclusive, where N is the count of the keyboard layouts), the
  404. * behavior is undefined.
  405. *
  406. * oKeyboardLayout:
  407. * On exit, the keyboard layout with the given index.
  408. *
  409. * Availability:
  410. * Mac OS X: in version 10.2 and later in Carbon.framework [32-bit only] but deprecated in 10.5
  411. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  412. * Non-Carbon CFM: not available
  413. }
  414. function KLGetKeyboardLayoutAtIndex( iIndex: CFIndex; var oKeyboardLayout: KeyboardLayoutRef ): OSStatus; external name '_KLGetKeyboardLayoutAtIndex';
  415. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
  416. {
  417. *** deprecated. ***
  418. NOTE: "Indexed" is a wrong name, please use "AtIndex"...
  419. OSStatus KLGetIndexedKeyboardLayout(
  420. CFIndex iIndex,
  421. KeyboardLayoutRef *oKeyboardLayout );
  422. }
  423. { get keyboard layout info}
  424. {
  425. * KLGetKeyboardLayoutProperty() *** DEPRECATED ***
  426. *
  427. * Deprecated:
  428. * Use TISGetInputSourceProperty API to query properties of a
  429. * TISInputSourceRef.
  430. *
  431. * Summary:
  432. * Retrives property value for the given keyboard layout and tag.
  433. *
  434. * Mac OS X threading:
  435. * Not thread safe
  436. *
  437. * Parameters:
  438. *
  439. * iKeyboardLayout:
  440. * The keyboard layout to be queried. If this parameter is not a
  441. * valid KeyboardLayoutRef, the behavior is undefined.
  442. *
  443. * iPropertyTag:
  444. * The property tag.
  445. *
  446. * oValue:
  447. * On exit, the property value for the given keyboard layout and
  448. * tag.
  449. *
  450. * Availability:
  451. * Mac OS X: in version 10.2 and later in Carbon.framework [32-bit only] but deprecated in 10.5
  452. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  453. * Non-Carbon CFM: not available
  454. }
  455. function KLGetKeyboardLayoutProperty( iKeyboardLayout: KeyboardLayoutRef; iPropertyTag: KeyboardLayoutPropertyTag; var oValue: UnivPtr ): OSStatus; external name '_KLGetKeyboardLayoutProperty';
  456. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
  457. { get keyboard layout with identifier or name}
  458. {
  459. * KLGetKeyboardLayoutWithIdentifier() *** DEPRECATED ***
  460. *
  461. * Deprecated:
  462. * Use TISCreateInputSourceList API to create a list of input
  463. * sources that match specified properties, such as the
  464. * kTISPropertyInputSourceID property.
  465. *
  466. * Summary:
  467. * Retrieves the keyboard layout with the given identifier.
  468. *
  469. * Discussion:
  470. * For now, the identifier is in the range of SInt16 which is
  471. * compatible with the Resource Manager resource ID. However, it
  472. * will become an arbitrary SInt32 value at some point, so do not
  473. * assume it is in SInt16 range or falls into the "script range" of
  474. * the resource IDs.
  475. *
  476. * Mac OS X threading:
  477. * Not thread safe
  478. *
  479. * Parameters:
  480. *
  481. * iIdentifier:
  482. * The keyboard layout identifier.
  483. *
  484. * oKeyboardLayout:
  485. * On exit, the keyboard layout with the given identifier.
  486. *
  487. * Availability:
  488. * Mac OS X: in version 10.2 and later in Carbon.framework [32-bit only] but deprecated in 10.5
  489. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  490. * Non-Carbon CFM: not available
  491. }
  492. function KLGetKeyboardLayoutWithIdentifier( iIdentifier: KeyboardLayoutIdentifier; var oKeyboardLayout: KeyboardLayoutRef ): OSStatus; external name '_KLGetKeyboardLayoutWithIdentifier';
  493. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
  494. {
  495. * KLGetKeyboardLayoutWithName() *** DEPRECATED ***
  496. *
  497. * Deprecated:
  498. * Use TISCreateInputSourceList API to create a list of input
  499. * sources that match specified properties, such as the
  500. * kTISPropertyInputSourceID property.
  501. *
  502. * Summary:
  503. * Retrieves the keyboard layout with the given name.
  504. *
  505. * Mac OS X threading:
  506. * Not thread safe
  507. *
  508. * Parameters:
  509. *
  510. * iName:
  511. * The keyboard layout name.
  512. *
  513. * oKeyboardLayout:
  514. * On exit, the keyboard layout with the given name.
  515. *
  516. * Availability:
  517. * Mac OS X: in version 10.2 and later in Carbon.framework [32-bit only] but deprecated in 10.5
  518. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  519. * Non-Carbon CFM: not available
  520. }
  521. function KLGetKeyboardLayoutWithName( iName: CFStringRef; var oKeyboardLayout: KeyboardLayoutRef ): OSStatus; external name '_KLGetKeyboardLayoutWithName';
  522. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
  523. { get/set current keyboard layout of the current group identifier}
  524. {
  525. * KLGetCurrentKeyboardLayout() *** DEPRECATED ***
  526. *
  527. * Deprecated:
  528. * Use TISCopyCurrentKeyboardLayoutInputSource.
  529. * TISCopyCurrentKeyboardLayoutInputSource will return the current
  530. * input source if it is a keyboard layout. If the current input
  531. * source is an input method or one of its input modes, the TIS API
  532. * will also return any keyboard override specified via
  533. * TISSetInputMethodKeyboardLayoutOverride.
  534. *
  535. * Summary:
  536. * Retrieves the current keyboard layout.
  537. *
  538. * Discussion:
  539. * Retrieves the current keyboard layout for the current keyboard
  540. * script. To retrive the current keyboard script for Roman
  541. * keyboard script, you need to call KeyScript( smRoman |
  542. * smKeyForceKeyScriptMask ) then call KLGetCurrentKeyboardLayout().
  543. *
  544. * Mac OS X threading:
  545. * Not thread safe
  546. *
  547. * Parameters:
  548. *
  549. * oKeyboardLayout:
  550. * On exit, the current keyboard layout.
  551. *
  552. * Availability:
  553. * Mac OS X: in version 10.2 and later in Carbon.framework [32-bit only] but deprecated in 10.5
  554. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  555. * Non-Carbon CFM: not available
  556. }
  557. function KLGetCurrentKeyboardLayout( var oKeyboardLayout: KeyboardLayoutRef ): OSStatus; external name '_KLGetCurrentKeyboardLayout';
  558. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
  559. {
  560. * KLSetCurrentKeyboardLayout() *** DEPRECATED ***
  561. *
  562. * Deprecated:
  563. * To make a keyboard layout become the current input source, use
  564. * TISSelectInputSource API.
  565. *
  566. * Input methods have used this API to override the keyboard layout
  567. * used when the input method or one of its input modes is selected.
  568. * TISSetInputMethodKeyboardLayoutOverride should be used for this
  569. * purpose and TISCopyCurrentKeyboardLayoutInputSource will return
  570. * the keyboard layout specified.
  571. * An benefit of using the TIS API to specify an override is that
  572. * when the input method is selected, the keyboard layout specified
  573. * will be visible to users of the Keyboard Viewer and allow them to
  574. * see the underlying keyboard used for event delivery to your input
  575. * method.
  576. *
  577. * Summary:
  578. * Sets the current keyboard layout.
  579. *
  580. * Discussion:
  581. * Sets the current keyboard layout for the current keyboard script.
  582. * Returns "paramErr" when the current keyboard layout is not
  583. * Unicode and the specified keyboard layout belongs to Unicode
  584. * group. To set Roman keyboard script's current keyboard layout to
  585. * "U.S." for example, you need to call KeyScript( smRoman |
  586. * smKeyForceKeyScriptMask ) then call KLSetCurrentKeyboardLayout(
  587. * theUSKeyboardLayoutRef ).
  588. *
  589. * Mac OS X threading:
  590. * Not thread safe
  591. *
  592. * Parameters:
  593. *
  594. * iKeyboardLayout:
  595. * The keyboard layout.
  596. *
  597. * Availability:
  598. * Mac OS X: in version 10.2 and later in Carbon.framework [32-bit only] but deprecated in 10.5
  599. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  600. * Non-Carbon CFM: not available
  601. }
  602. function KLSetCurrentKeyboardLayout( iKeyboardLayout: KeyboardLayoutRef ): OSStatus; external name '_KLSetCurrentKeyboardLayout';
  603. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5 *)
  604. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  605. { OBSOLETE }
  606. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  607. { These are obsolete. Carbon does not support these. }
  608. { Keyboard API Trap Number. Should be moved to Traps.i }
  609. {$endc} {not TARGET_CPU_64}
  610. const
  611. _KeyboardDispatch = $AA7A;
  612. { Gestalt selector and values for the Keyboard API }
  613. const
  614. gestaltKeyboardsAttr = FourCharCode('kbds');
  615. gestaltKBPS2Keyboards = 1;
  616. gestaltKBPS2SetIDToAny = 2;
  617. gestaltKBPS2SetTranslationTable = 4;
  618. { Keyboard API Error Codes }
  619. {
  620. I stole the range blow from the empty space in the Allocation project but should
  621. be updated to the officially registered range.
  622. }
  623. const
  624. errKBPS2KeyboardNotAvailable = -30850;
  625. errKBIlligalParameters = -30851;
  626. errKBFailSettingID = -30852;
  627. errKBFailSettingTranslationTable = -30853;
  628. errKBFailWritePreference = -30854;
  629. {$endc} {TARGET_OS_MAC}{$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  630. end.
  631. {$endc} {not MACOSALLINCLUDE}