TextServices.pas 72 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945
  1. {
  2. File: HIToolbox/TextServices.h
  3. Contains: Text Services Manager Interfaces.
  4. Version: HIToolbox-219.4.81~2
  5. Copyright: © 1991-2005 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. {
  12. Modified for use with Free Pascal
  13. Version 200
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$CALLING MWPASCAL}
  21. unit TextServices;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0200}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  45. {$error Conflicting definitions for __ppc__ and __i386__}
  46. {$endc}
  47. {$ifc defined __ppc__ and __ppc__}
  48. {$setc TARGET_CPU_PPC := TRUE}
  49. {$setc TARGET_CPU_X86 := FALSE}
  50. {$elifc defined __i386__ and __i386__}
  51. {$setc TARGET_CPU_PPC := FALSE}
  52. {$setc TARGET_CPU_X86 := TRUE}
  53. {$elsec}
  54. {$error Neither __ppc__ nor __i386__ is defined.}
  55. {$endc}
  56. {$setc TARGET_CPU_PPC_64 := FALSE}
  57. {$ifc defined FPC_BIG_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  60. {$elifc defined FPC_LITTLE_ENDIAN}
  61. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  62. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  63. {$elsec}
  64. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  65. {$endc}
  66. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  67. {$setc CALL_NOT_IN_CARBON := FALSE}
  68. {$setc OLDROUTINENAMES := FALSE}
  69. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  70. {$setc OPAQUE_UPP_TYPES := TRUE}
  71. {$setc OTCARBONAPPLICATION := TRUE}
  72. {$setc OTKERNEL := FALSE}
  73. {$setc PM_USE_SESSION_APIS := TRUE}
  74. {$setc TARGET_API_MAC_CARBON := TRUE}
  75. {$setc TARGET_API_MAC_OS8 := FALSE}
  76. {$setc TARGET_API_MAC_OSX := TRUE}
  77. {$setc TARGET_CARBON := TRUE}
  78. {$setc TARGET_CPU_68K := FALSE}
  79. {$setc TARGET_CPU_MIPS := FALSE}
  80. {$setc TARGET_CPU_SPARC := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_UNIX := FALSE}
  83. {$setc TARGET_OS_WIN32 := FALSE}
  84. {$setc TARGET_RT_MAC_68881 := FALSE}
  85. {$setc TARGET_RT_MAC_CFM := FALSE}
  86. {$setc TARGET_RT_MAC_MACHO := TRUE}
  87. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  88. {$setc TYPE_BOOL := FALSE}
  89. {$setc TYPE_EXTENDED := FALSE}
  90. {$setc TYPE_LONGLONG := TRUE}
  91. uses MacTypes,Quickdraw,ConditionalMacros,CFBase,CarbonEventsCore,ATSTypes,CFArray,CFDictionary,Events,Menus,AEDataModel,AERegistry,AEInteraction,Components,CarbonEvents;
  92. {$ALIGN MAC68K}
  93. const
  94. kTextService = $74737663 (* 'tsvc' *); { component type for the component description }
  95. const
  96. kTSMVersion = $0150; { Version 1.5 of the Text Services Manager }
  97. kTSM15Version = kTSMVersion;
  98. kTSM20Version = $0200; { Version 2.0 as of MacOSX 10.0 }
  99. kTSM22Version = $0220; { Version 2.2 as of MacOSX 10.3 }
  100. kTSM23Version = $0230; { Version 2.3 as of MacOSX 10.4 }
  101. { Interface types for NewTSMDocument}
  102. type
  103. InterfaceTypeList = array[0..$7F000000 div SizeOf(OSType)-1] of OSType;
  104. InterfaceTypeListPtr = ^InterfaceTypeList;
  105. type
  106. TSMDocumentInterfaceType = OSType;
  107. {
  108. * Summary:
  109. * InterfaceTypeList - array of OSTypes passed to NewTSMDocument to
  110. * specify capabilities of the new TSMDocument.
  111. *
  112. * Discussion:
  113. * TSM's Interface types, as of 10.3, are also stored as TSMDocument
  114. * properties, so once a TSMDocument is created, you can easily find
  115. * out what were its InterfaceTypes at document creation.
  116. }
  117. const
  118. {
  119. * This is the traditional TSMDocument type. It does not support
  120. * Unicode. TSM will convert all Unicode produced by input methods to
  121. * the Mac encoding represented by the current keyboard script (or
  122. * the Mac encoding specified by the input method producing text.)
  123. * Full Unicode input sources may not be selectable when this
  124. * TSMDocument is active.
  125. }
  126. kTextServiceDocumentInterfaceType = kTextService; { TSM Document type for traditional (non-Unicode) NewTSMDocument }
  127. {
  128. * TSMTE document type. This requests automatic management of inline
  129. * input sessions by TextEdit (the text engine.) See Technote TE27 -
  130. * Inline Input for TextEdit with TSMTE.
  131. }
  132. kTSMTEDocumentInterfaceType = $746D5445 (* 'tmTE' *); { TSM Document type for TSMTE document (see kTSMTEInterfaceType - TSMTE.h) }
  133. {
  134. * Unicode-savvy TSMDocument. TSM will pass thru all Unicode text
  135. * unchanged. When this TSMDocument is active, the full range of
  136. * input sources is available to the user, such as Unicode keyboard
  137. * layouts.
  138. }
  139. kUnicodeDocumentInterfaceType = $75646F63 (* 'udoc' *); { TSM Document type for Unicode-savvy application }
  140. { Older names, to be deprecated}
  141. kUnicodeDocument = kUnicodeDocumentInterfaceType; { TSM Document type for Unicode-savvy application }
  142. {
  143. TextServiceClass constants supported by TSM
  144. Same as component subtype for the component description
  145. }
  146. type
  147. TextServiceClass = OSType;
  148. {
  149. * Summary:
  150. * TextService classes
  151. *
  152. * Discussion:
  153. * Text Service classes fall in two categories or behaviors. Text
  154. * services that belong to some classes are exclusive of oneanother
  155. * within a given Mac script code, such input methods of the
  156. * keyboard class.
  157. *
  158. * Input Methods of other classes are additive in nature, regardless
  159. * of the current keyboard script.
  160. *
  161. * Within a given class and script, exclusive input methods can only
  162. * be activated one at a time. Input methods in additive classes
  163. * are keyboard script agnostic and can be active in parallel with
  164. * other text services in the same class, such as multiple character
  165. * palettes.
  166. }
  167. const
  168. {
  169. * Text service class for keyboard input methods. Behavior is
  170. * exclusive. Input Methods in this class are normally associated
  171. * with a Mac ScriptCode or Unicode, although they can be associated
  172. * with several scripts by adopting the Input Mode protocol.
  173. * Keyboard input methods are always visible in the System UI.
  174. }
  175. kKeyboardInputMethodClass = $696E706D (* 'inpm' *);
  176. {
  177. * Text service class for Ink (Handwriting) input methods. Behavior
  178. * is Additive. Text Services in the Ink class do not belong to any
  179. * given script in the sense that those of the Keyboard class do.
  180. * Once selected, this kind of text service will remain active
  181. * regardless of the current keyboard script. Although text services
  182. * in this class are keyboard script agnostic, like input methods of
  183. * the keyboard class they can still profess to produce only those
  184. * Unicodes that are encoded in the mac encoding specified in their
  185. * component description record or their implementation of the
  186. * GetScriptLanguageSupport component call.
  187. *
  188. * Unlike input methods in the keyboard class, multiple such text
  189. * services can be activate in parallel.
  190. *
  191. * Dictionary Service input methods are visible in the system UI by
  192. * default. Use the kComponentBundleInvisibleInSystemUIKey plist key
  193. * to make them invisible if a developer-provided UI is to be used
  194. * instead. Mac OS X only provides System UI for Apple's Ink input
  195. * method.
  196. }
  197. kInkInputMethodClass = $696E6B20 (* 'ink ' *);
  198. {
  199. * Text service class for Character Palette input methods. Behavior
  200. * is Additive. Text Services in the character palette class do not
  201. * belong to any given script in the same sense that do those of the
  202. * Keyboard class. Once selected, this kind of text service will
  203. * remain active regardless of the current keyboard script. Although
  204. * text services in this class are keyboard script agnostic, like
  205. * input methods of the keyboard class they can still profess to
  206. * produce only those Unicodes that are encoded in the mac encoding
  207. * specified in their component description record or their
  208. * implementation of the GetScriptLanguageSupport component
  209. * call.
  210. *
  211. * Unlike input methods in the keyboard class, multiple such text
  212. * services can be activate in parallel, and unlike input methods in
  213. * the Ink class, Mac OS X provides System UI to allow the user to
  214. * both enable and select multiple such input methods.
  215. *
  216. * Use the kComponentBundleInvisibleInSystemUIKey plist key to make
  217. * Character Palette input methods invisible to the System UI.
  218. }
  219. kCharacterPaletteInputMethodClass = $63706C74 (* 'cplt' *);
  220. {
  221. * Text Service class for Speech input methods. Behavior is
  222. * Additive.
  223. *
  224. * Similar to Character palette class. System UI for these has not
  225. * yet been determined.
  226. }
  227. kSpeechInputMethodClass = $766F6963 (* 'voic' *);
  228. {
  229. * Text Service class for Optical Character Recognition input
  230. * methods. Behavior is Additive.
  231. *
  232. * Similar to Character palette class. System UI for these has not
  233. * yet been determined.
  234. }
  235. kOCRInputMethodClass = $6F637220 (* 'ocr ' *);
  236. { New opaque definitions for types }
  237. type
  238. TSMDocumentID = ^SInt32; { an opaque 32-bit type }
  239. { TSMDocumentID Properties}
  240. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  241. { TSMDocumentID Properties }
  242. { With the following property APIs, you can attach any piece of data you'd like to a }
  243. { TSMDocument.}
  244. { to attach the data to the menu itself, and not to any specific menu item. }
  245. {ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ}
  246. type
  247. TSMDocumentPropertyTag = OSType;
  248. {
  249. * Summary:
  250. * TSMDocument Property Tags
  251. *
  252. * Discussion:
  253. * With the following property APIs, you can attach any piece of
  254. * data you'd like to a TSMDocument. The property tags pre-defined
  255. * below by TSM fall in several categories. Read-only properties:
  256. * these property tags are actually the interface type used to
  257. * create a TSMDocument, such as kUnicodeDocumentInterfaceType.
  258. * These properties are all property value-independent... see below.
  259. * Value-independent properties: these property tags are value
  260. * independent. Only the fact that the tag is or is not a property
  261. * of a TSMDocument is important. These are used where the
  262. * existence of the property is sufficient... Read-only TSMDocment
  263. * properties are examples of value independent properties.
  264. * SupportGlyphInfo is another. Pass a non-NULL actualSize parameter
  265. * and a NULL propertyBuffer to check if the property exists (i.e.
  266. * to obtain the size.) Value-dependent properties: these are
  267. * properties for which the value is meaningful. Examples of this
  268. * are the Refcon ProtocolVersion properties. NOTE:
  269. * Value-independent properties can read by other clients, in
  270. * particular input methods. For example, input methods may want to
  271. * query the current TSMDocument to see if supports unrestricted
  272. * Unicode input, or if it supports the GlyphInfo protocol.
  273. }
  274. const
  275. { Property values for value-independent property tags (i.e. only the existence of}
  276. { the property is meaningful). To remove these properties, use TSMRemoveDocumentProperty.}
  277. { To test these properties, it is sufficient to obtain the property's size, i.e. buffer = NULL}
  278. { and test for error.}
  279. { Read-only (value-independent) properties}
  280. { Identical to Interface types passed to NewTSMDocument}
  281. {
  282. * Property is read-only, value-independent. The value is identical
  283. * to the TextServiceDocument interface type, but is not needed.
  284. * Simply test for existence of the property. Property available in
  285. * TSM 2.2 and later
  286. }
  287. kTSMDocumentTextServicePropertyTag = kTextServiceDocumentInterfaceType;
  288. {
  289. * Property is read-only, value-independent. The value is identical
  290. * to the UnicodeDocument interface type, but is not needed. Simply
  291. * test for existence of the property. Property available in TSM 2.2
  292. * and later
  293. }
  294. kTSMDocumentUnicodePropertyTag = kUnicodeDocumentInterfaceType;
  295. {
  296. * Property is read-only, value-independent. The value is identical
  297. * to the TSMTEDocument interface type, but is not needed. Simply
  298. * test for existence of the property. Property available in TSM 2.2
  299. * and later
  300. }
  301. kTSMDocumentTSMTEPropertyTag = kTSMTEDocumentInterfaceType; { }
  302. { Settable value-independent properties}
  303. {
  304. * Property is value-independent. The existence of this property in
  305. * a TSMDocument indicates that the event handlers associated with
  306. * the TSMDocument are aware of TSM's GlyhInfo data structure. This
  307. * structure allows the input source producing text to apply Glyph
  308. * IDs, CIDs, or Fonts to subranges of text produced. This is useful
  309. * for characters in Unicode private use area, such as Windings. For
  310. * more information, see the Glyph Access protocol described in
  311. * TechNote TN20TT. By convention, this value can be a UInt32 with a
  312. * value of 0, but this is really arbitrary. Simply test for
  313. * existence of the property. Property available in TSM 1.5 from
  314. * MacOSX 10.2 and later
  315. }
  316. kTSMDocumentSupportGlyphInfoPropertyTag = $64706769 (* 'dpgi' *); { property value is arbitrary}
  317. {
  318. * Property is value-independent. The presence of this property tag
  319. * indicates that the TSMDocument should use TSM's floating input
  320. * window to handle input from input methods. This form of input
  321. * does not support Unicode input by default, unless the
  322. * UnicodeInputWindow property is set. By convention, this value can
  323. * be a UInt32 with a value of 0, but this is really arbitrary.
  324. * Simply test for existence of the property. Property available in
  325. * TSM 2.2 and later
  326. }
  327. kTSMDocumentUseFloatingWindowPropertyTag = $7573776D (* 'uswm' *); { use bottom-line input (floating TSM) window for text input}
  328. {
  329. * Property is value-independent. The presence of this property tag
  330. * indicates that although the TSMDocument has been told to use TSM's
  331. * floating input window to handle input from input methods, the
  332. * floating window is to support Unicode input. This is useful when
  333. * non input-related activity is to produce Unicode, such as keyboard
  334. * navigation . By convention, this value can be a UInt32 with a
  335. * value of 0, but this is really arbitrary. Simply test for
  336. * existence of the property. Property available in TSM 2.2 and later
  337. }
  338. kTSMDocumentUnicodeInputWindowPropertyTag = $64707562 (* 'dpub' *); { Unicode support in bottom line input window}
  339. {
  340. * Property is value-independent. The presence of this property tag
  341. * indicates that the event handlers associated with this TSMDocument
  342. * support TSM's DocumentAccess event suite (see CarbonEvents.h) This
  343. * property also indicates that the handler for TSM's
  344. * kEventTextInputUpdateActiveInputArea event supports the
  345. * 'replaceRange' parameter and that the handler is a Carbon event
  346. * handler, not an AppleEvent handler. By convention, this value can
  347. * be a UInt32 with a value of 0, but this is really arbitrary.
  348. * Simply test for existence of the property. Property available in
  349. * TSM 2.2 and later
  350. }
  351. kTSMDocumentSupportDocumentAccessPropertyTag = $64617079 (* 'dapy' *); { support TSM Document Access protocol}
  352. { Older names, to be deprecated}
  353. kTSMDocumentPropertySupportGlyphInfo = kTSMDocumentSupportGlyphInfoPropertyTag;
  354. kTSMDocumentPropertyUnicodeInputWindow = kTSMDocumentUnicodeInputWindowPropertyTag; { }
  355. { Settable value-dependent properties}
  356. { Property values for the following property tags are meaningful}
  357. {
  358. * Property is value-dependent. The property value initially
  359. * contains the Refcon value passed to NewTSMDocument. This property
  360. * is useful for changing the refcon on-the-fly after the TSMDocument
  361. * has been created. The refcon value is a long, the same as that
  362. * passed to NewTSMDocument. Property available in TSM 2.2 and later
  363. }
  364. kTSMDocumentRefconPropertyTag = $72656663 (* 'refc' *); { refcon passed to TSMDocument (UInt32)}
  365. {
  366. * Property is value-dependent. The property value indicates which
  367. * input mode should be used by the current keyboard-class input
  368. * method. It is useful for temporarily restricting text input to a
  369. * subset of characters normally produced by an input method in a
  370. * given script, such as Katakana for Japanese input. See details in
  371. * TextServiceProperty API below. Also note that this property tag
  372. * and value are passed unchanged to the TextServiceProperty API, so
  373. * it also serves as a TextServicePropertyTag. See
  374. * kTextServiceInputModePropertyTag for discussion on the values
  375. * associated with this property. Usage Note: Property value is a
  376. * CFStringRef. With TSMGetTextServiceProperty, the behavior is that
  377. * of a Copy function. The implementation of
  378. * TSMSetTextServiceProperty (in the component) retains or copies the
  379. * CFString... in either case the caller is responsible for releasing
  380. * its reference. Property available in TSM 2.2 and later
  381. }
  382. kTSMDocumentInputModePropertyTag = $696D696D (* 'imim' *); { Input mode property for input methods (CFStringRef - see Input Modes below)}
  383. {
  384. * Property is value-dependent. The property value indicates the
  385. * level of the window that will host inline input sessions for a
  386. * given TSMDocument. Input Methods will query this property to
  387. * determine the level above which its "candidate" (floating)
  388. * window(s) should be positioned, typically by adding its window to
  389. * a window group (see Carbon's WindowGroup API) and incrementing the
  390. * level for the group. If no level is available, the input method
  391. * is expected to use the default behavior, i.e. let the Window
  392. * Manager manage the level for floating windows. Window levels are
  393. * typed as CGWindowLevel. NSWindow levels are accessed through
  394. * NSWindow's (int)level method. Property available in TSM 2.3 and
  395. * later
  396. }
  397. kTSMDocumentWindowLevelPropertyTag = $74776C70 (* 'twlp' *); { document window level (CGWindowLevel)}
  398. {
  399. * TSMSetDocumentProperty()
  400. *
  401. * Summary:
  402. * Set a TSMDocument property
  403. *
  404. * Discussion:
  405. * With the following property APIs, you can attach any piece of
  406. * data you'd like to a TSMDocument. Other uses include setting a
  407. * (value-independent) property for input methods to query in order
  408. * to determine an application's compliance with various TSM
  409. * protocols. NOTE: Property values are currently typed as SInt32,
  410. * but should really be a void* since a variety of data types are
  411. * used in practice. Note that the semantics for refcounted objects
  412. * is ambiguous, so retain/release model is discussed for each
  413. * TSM-defined property individually. (See notes for
  414. * TSMDocumentPropertyTag) Error Codes (MacErrors.h):
  415. * tsmComponentPropertyUnsupportedErr tsmInputModeChangeFailedErr
  416. *
  417. * Mac OS X threading:
  418. * Not thread safe
  419. *
  420. * Availability:
  421. * Mac OS X: in version 10.2 and later in Carbon.framework
  422. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  423. * Non-Carbon CFM: not available
  424. }
  425. function TSMSetDocumentProperty( docID: TSMDocumentID; propertyTag: TSMDocumentPropertyTag; propertySize: UInt32; propertyData: UnivPtr ): OSStatus; external name '_TSMSetDocumentProperty';
  426. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  427. {
  428. * TSMGetDocumentProperty()
  429. *
  430. * Summary:
  431. * Get a TSMDocument property
  432. *
  433. * Discussion:
  434. * With the following property APIs, you can attach any piece of
  435. * data you'd like to a TSMDocument. Other uses include setting a
  436. * (value-independent) property for input methods to query in order
  437. * to determine an application's compliance with various TSM
  438. * protocols. NOTE: Property values are currently typed as SInt32,
  439. * but should really be a void* since a variety of data types are
  440. * used in practice. Note that the semantics for refcounted objects
  441. * is ambiguous, so retain/release model is discussed for each
  442. * TSM-defined property individually. (See notes for
  443. * TSMDocumentPropertyTag) Error Codes (MacErrors.h)
  444. * tsmDocPropertyNotFoundErr tsmDocPropertyBufferTooSmallErr
  445. * tsmComponentPropertyNotFoundErr tsmComponentPropertyUnsupportedErr
  446. *
  447. * Mac OS X threading:
  448. * Not thread safe
  449. *
  450. * Availability:
  451. * Mac OS X: in version 10.2 and later in Carbon.framework
  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 TSMGetDocumentProperty( docID: TSMDocumentID; propertyTag: TSMDocumentPropertyTag; bufferSize: UInt32; var actualSize: UInt32; propertyBuffer: UnivPtr { can be NULL } ): OSStatus; external name '_TSMGetDocumentProperty';
  456. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  457. {
  458. * TSMRemoveDocumentProperty()
  459. *
  460. * Mac OS X threading:
  461. * Not thread safe
  462. *
  463. * Availability:
  464. * Mac OS X: in version 10.2 and later in Carbon.framework
  465. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  466. * Non-Carbon CFM: not available
  467. }
  468. function TSMRemoveDocumentProperty( docID: TSMDocumentID; propertyTag: TSMDocumentPropertyTag ): OSStatus; external name '_TSMRemoveDocumentProperty';
  469. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  470. { Language and Script constants}
  471. const
  472. kUnknownLanguage = $FFFF;
  473. kUnknownScript = $FFFF;
  474. kNeutralScript = $FFFF;
  475. const
  476. { Component Flags in ComponentDescription }
  477. bTakeActiveEvent = 15; { bit set if the component takes active event }
  478. bHandleAERecording = 16; { bit set if the component takes care of recording Apple Events <new in vers2.0> }
  479. bScriptMask = $00007F00; { bit 8 - 14 }
  480. bLanguageMask = $000000FF; { bit 0 - 7 }
  481. bScriptLanguageMask = bScriptMask + bLanguageMask; { bit 0 - 14 }
  482. const
  483. { Low level routines which are dispatched directly to the Component Manager }
  484. kCMGetScriptLangSupport = $0001; { Component Manager call selector 1 }
  485. kCMInitiateTextService = $0002; { Component Manager call selector 2 }
  486. kCMTerminateTextService = $0003; { Component Manager call selector 3 }
  487. kCMActivateTextService = $0004; { Component Manager call selector 4 }
  488. kCMDeactivateTextService = $0005; { Component Manager call selector 5 }
  489. kCMTextServiceEvent = $0006; { Component Manager call selector 6 }
  490. kCMTextServiceEventRef = kCMTextServiceEvent;
  491. kCMGetTextServiceMenu = $0007; { Component Manager call selector 7 }
  492. kCMTextServiceMenuSelect = $0008; { Component Manager call selector 8 }
  493. kCMFixTextService = $0009; { Component Manager call selector 9 }
  494. kCMSetTextServiceCursor = $000A; { Component Manager call selector 10 }
  495. kCMHidePaletteWindows = $000B; { Component Manager call selector 11 }
  496. kCMGetTextServiceProperty = $000C; { Component Manager call selector 12 }
  497. kCMSetTextServiceProperty = $000D; { Component Manager call selector 13 }
  498. kCMUCTextServiceEvent = $000E; { Component Manager call selector 14 }
  499. kCMCopyTextServiceInputModeList = $000F; { Component Manager call selector 15 }
  500. kCMInputModePaletteItemHit = $0010; { Component Manager call selector 16 }
  501. kCMGetInputModePaletteMenu = $0011; { Component Manager call selector 17 }
  502. { extract Script/Language code from Component flag ... }
  503. // #define mGetScriptCode(cdRec) ((ScriptCode) ((cdRec.componentFlags & bScriptMask) >> 8))
  504. // #define mGetLanguageCode(cdRec) ((LangCode) cdRec.componentFlags & bLanguageMask)
  505. { Text Service Info List }
  506. type
  507. TextServiceInfo = record
  508. fComponent: Component;
  509. fItemName: Str255;
  510. end;
  511. TextServiceInfoPtr = ^TextServiceInfo;
  512. type
  513. TextServiceList = record
  514. fTextServiceCount: SInt16; { number of entries in the 'fServices' array }
  515. fServices: array [0..0] of TextServiceInfo; { Note: array of 'TextServiceInfo' records follows }
  516. end;
  517. TextServiceListPtr = ^TextServiceList;
  518. type
  519. TextServiceListHandle = ^TextServiceListPtr;
  520. ScriptLanguageRecord = record
  521. fScript: ScriptCode;
  522. fLanguage: LangCode;
  523. end;
  524. ScriptLanguageRecordPtr = ^ScriptLanguageRecord;
  525. type
  526. ScriptLanguageSupport = record
  527. fScriptLanguageCount: SInt16; { number of entries in the 'fScriptLanguageArray' array }
  528. fScriptLanguageArray: array [0..0] of ScriptLanguageRecord; { Note: array of 'ScriptLanguageRecord' records follows }
  529. end;
  530. ScriptLanguageSupportPtr = ^ScriptLanguageSupport;
  531. type
  532. ScriptLanguageSupportHandle = ^ScriptLanguageSupportPtr;
  533. TSMGlyphInfo = record
  534. range: CFRange; { two SInt32s}
  535. fontRef: ATSFontRef;
  536. collection: UInt16; { kGlyphCollectionXXX enum}
  537. glyphID: UInt16; { GID (when collection==0) or CID}
  538. end;
  539. type
  540. TSMGlyphInfoArray = record
  541. numGlyphInfo: ItemCount; { UInt32}
  542. glyphInfo: array[0..$7F000000 div SizeOf(TSMGlyphInfo)-1] of TSMGlyphInfo;
  543. end;
  544. { High level TSM Doucment routines }
  545. {
  546. * NewTSMDocument()
  547. *
  548. * Mac OS X threading:
  549. * Not thread safe
  550. *
  551. * Availability:
  552. * Mac OS X: in version 10.0 and later in Carbon.framework
  553. * CarbonLib: in CarbonLib 1.0 and later
  554. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  555. }
  556. function NewTSMDocument( numOfInterface: SInt16; supportedInterfaceTypes: {variable-size-array} InterfaceTypeListPtr; var idocID: TSMDocumentID; refcon: SInt32 ): OSErr; external name '_NewTSMDocument';
  557. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  558. {
  559. * DeleteTSMDocument()
  560. *
  561. * Mac OS X threading:
  562. * Not thread safe
  563. *
  564. * Availability:
  565. * Mac OS X: in version 10.0 and later in Carbon.framework
  566. * CarbonLib: in CarbonLib 1.0 and later
  567. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  568. }
  569. function DeleteTSMDocument( idocID: TSMDocumentID ): OSErr; external name '_DeleteTSMDocument';
  570. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  571. {
  572. * ActivateTSMDocument()
  573. *
  574. * Mac OS X threading:
  575. * Not thread safe
  576. *
  577. * Availability:
  578. * Mac OS X: in version 10.0 and later in Carbon.framework
  579. * CarbonLib: in CarbonLib 1.0 and later
  580. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  581. }
  582. function ActivateTSMDocument( idocID: TSMDocumentID ): OSErr; external name '_ActivateTSMDocument';
  583. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  584. {
  585. * DeactivateTSMDocument()
  586. *
  587. * Mac OS X threading:
  588. * Not thread safe
  589. *
  590. * Availability:
  591. * Mac OS X: in version 10.0 and later in Carbon.framework
  592. * CarbonLib: in CarbonLib 1.0 and later
  593. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  594. }
  595. function DeactivateTSMDocument( idocID: TSMDocumentID ): OSErr; external name '_DeactivateTSMDocument';
  596. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  597. {
  598. * FixTSMDocument()
  599. *
  600. * Mac OS X threading:
  601. * Not thread safe
  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: in InterfaceLib 7.1 and later
  607. }
  608. function FixTSMDocument( idocID: TSMDocumentID ): OSErr; external name '_FixTSMDocument';
  609. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  610. {
  611. * GetServiceList()
  612. *
  613. * Mac OS X threading:
  614. * Not thread safe
  615. *
  616. * Availability:
  617. * Mac OS X: in version 10.0 and later in Carbon.framework
  618. * CarbonLib: in CarbonLib 1.0 and later
  619. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  620. }
  621. function GetServiceList( numOfInterface: SInt16; {const} supportedInterfaceTypes: {variable-size-array} InterfaceTypeListPtr; var serviceInfo: TextServiceListHandle; var seedValue: SInt32 ): OSErr; external name '_GetServiceList';
  622. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  623. {
  624. * OpenTextService()
  625. *
  626. * Mac OS X threading:
  627. * Not thread safe
  628. *
  629. * Availability:
  630. * Mac OS X: in version 10.0 and later in Carbon.framework
  631. * CarbonLib: in CarbonLib 1.0 and later
  632. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  633. }
  634. function OpenTextService( idocID: TSMDocumentID; aComponent: Component; var aComponentInstance: ComponentInstance ): OSErr; external name '_OpenTextService';
  635. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  636. {
  637. * CloseTextService()
  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
  644. * CarbonLib: in CarbonLib 1.0 and later
  645. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  646. }
  647. function CloseTextService( idocID: TSMDocumentID; aComponentInstance: ComponentInstance ): OSErr; external name '_CloseTextService';
  648. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  649. {
  650. * SendAEFromTSMComponent()
  651. *
  652. * Mac OS X threading:
  653. * Not thread safe
  654. *
  655. * Availability:
  656. * Mac OS X: in version 10.0 and later in Carbon.framework
  657. * CarbonLib: in CarbonLib 1.0 and later
  658. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  659. }
  660. function SendAEFromTSMComponent( const (*var*) theAppleEvent: AppleEvent; var reply: AppleEvent; sendMode: AESendMode; sendPriority: AESendPriority; timeOutInTicks: SInt32; idleProc: AEIdleUPP; filterProc: AEFilterUPP ): OSErr; external name '_SendAEFromTSMComponent';
  661. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  662. {
  663. * SendTextInputEvent()
  664. *
  665. * Discussion:
  666. * This API replaces SendAEFromTSMComponent on Mac OS X only. Input
  667. * Methods on Mac OS X are Carbon Event based instead of AppleEvent
  668. * based. The Carbon TextInput events which they generate are
  669. * provided to TSM for dispatching via this API.
  670. *
  671. * Mac OS X threading:
  672. * Not thread safe
  673. *
  674. * Availability:
  675. * Mac OS X: in version 10.0 and later in Carbon.framework
  676. * CarbonLib: in CarbonLib N.e.v.e.r and later
  677. * Non-Carbon CFM: not available
  678. }
  679. function SendTextInputEvent( inEvent: EventRef ): OSStatus; external name '_SendTextInputEvent';
  680. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  681. {
  682. * SetDefaultInputMethod()
  683. *
  684. * Mac OS X threading:
  685. * Not thread safe
  686. *
  687. * Availability:
  688. * Mac OS X: in version 10.0 and later in Carbon.framework
  689. * CarbonLib: in CarbonLib 1.0 and later
  690. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  691. }
  692. function SetDefaultInputMethod( ts: Component; var slRecordPtr: ScriptLanguageRecord ): OSErr; external name '_SetDefaultInputMethod';
  693. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  694. {
  695. * GetDefaultInputMethod()
  696. *
  697. * Mac OS X threading:
  698. * Not thread safe
  699. *
  700. * Availability:
  701. * Mac OS X: in version 10.0 and later in Carbon.framework
  702. * CarbonLib: in CarbonLib 1.0 and later
  703. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  704. }
  705. function GetDefaultInputMethod( var ts: Component; var slRecordPtr: ScriptLanguageRecord ): OSErr; external name '_GetDefaultInputMethod';
  706. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  707. {
  708. * SetTextServiceLanguage()
  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
  715. * CarbonLib: in CarbonLib 1.0 and later
  716. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  717. }
  718. function SetTextServiceLanguage( var slRecordPtr: ScriptLanguageRecord ): OSErr; external name '_SetTextServiceLanguage';
  719. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  720. {
  721. * GetTextServiceLanguage()
  722. *
  723. * Mac OS X threading:
  724. * Not thread safe
  725. *
  726. * Availability:
  727. * Mac OS X: in version 10.0 and later in Carbon.framework
  728. * CarbonLib: in CarbonLib 1.0 and later
  729. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  730. }
  731. function GetTextServiceLanguage( var slRecordPtr: ScriptLanguageRecord ): OSErr; external name '_GetTextServiceLanguage';
  732. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  733. {
  734. * UseInputWindow()
  735. *
  736. * Mac OS X threading:
  737. * Not thread safe
  738. *
  739. * Availability:
  740. * Mac OS X: in version 10.0 and later in Carbon.framework
  741. * CarbonLib: in CarbonLib 1.0 and later
  742. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  743. }
  744. function UseInputWindow( idocID: TSMDocumentID; useWindow: Boolean ): OSErr; external name '_UseInputWindow';
  745. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  746. {
  747. * TSMSetInlineInputRegion()
  748. *
  749. * Summary:
  750. * Tell TSM what region and which window make up the inline input
  751. * session.
  752. *
  753. * Discussion:
  754. * Tell TSM about the region occupied by an inline input session. If
  755. * the location of certain mouse events (clicks, mouse moved) occur
  756. * within the specified inline input region, TSM will forward these
  757. * events to the current Input Method so that it can interact with
  758. * the user. Note: If you do not specify this information, TSM will
  759. * need to intercept mouse events in the entire content region as
  760. * the default, when an input method is active, in order to ensure
  761. * that input methods can manage user interaction properly.
  762. *
  763. * Mac OS X threading:
  764. * Not thread safe
  765. *
  766. * Parameters:
  767. *
  768. * inTSMDocument:
  769. * The document.
  770. *
  771. * inWindow:
  772. * The window that contains the inline input session. You can pass
  773. * NULL for this parameter to indicate the user focus window.
  774. *
  775. * inRegion:
  776. * The region occupied by the current inline input region. This
  777. * should be in the coordinates of the port associated with the
  778. * window you passed to inPort. It will need to be recomputed when
  779. * the text content of the inline input session content changes
  780. * (i.e. due to Update Active Input Area events) and when the
  781. * region moves for other reasons, such as window resized,
  782. * scrolling, etc. If you pass a NULL region for this parameter,
  783. * TSM will default to intercept mouse events in the focus
  784. * window's content region.
  785. *
  786. * Availability:
  787. * Mac OS X: in version 10.0 and later in Carbon.framework
  788. * CarbonLib: in CarbonLib 1.1 and later
  789. * Non-Carbon CFM: not available
  790. }
  791. function TSMSetInlineInputRegion( inTSMDocument: TSMDocumentID; inWindow: WindowRef; inRegion: RgnHandle ): OSStatus; external name '_TSMSetInlineInputRegion';
  792. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  793. { Following calls from Classic event loops not needed for Carbon clients. }
  794. {
  795. * TSMEvent()
  796. *
  797. * Availability:
  798. * Mac OS X: not available
  799. * CarbonLib: not available
  800. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  801. }
  802. {
  803. * TSMMenuSelect()
  804. *
  805. * Availability:
  806. * Mac OS X: not available
  807. * CarbonLib: not available
  808. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  809. }
  810. {
  811. * SetTSMCursor()
  812. *
  813. * Availability:
  814. * Mac OS X: not available
  815. * CarbonLib: not available
  816. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  817. }
  818. { Following ServiceWindow API replaced by Window Manager API in Carbon. }
  819. {
  820. * NewServiceWindow()
  821. *
  822. * Availability:
  823. * Mac OS X: not available
  824. * CarbonLib: not available
  825. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  826. }
  827. {
  828. * CloseServiceWindow()
  829. *
  830. * Availability:
  831. * Mac OS X: not available
  832. * CarbonLib: not available
  833. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  834. }
  835. {
  836. * GetFrontServiceWindow()
  837. *
  838. * Availability:
  839. * Mac OS X: not available
  840. * CarbonLib: not available
  841. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  842. }
  843. {
  844. * FindServiceWindow()
  845. *
  846. * Availability:
  847. * Mac OS X: not available
  848. * CarbonLib: not available
  849. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  850. }
  851. {
  852. * NewCServiceWindow()
  853. *
  854. * Availability:
  855. * Mac OS X: not available
  856. * CarbonLib: not available
  857. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  858. }
  859. { Explicit initialization not needed for Carbon clients, since TSM is }
  860. { instanciated per-context. }
  861. {
  862. * InitTSMAwareApplication()
  863. *
  864. * Availability:
  865. * Mac OS X: not available
  866. * CarbonLib: not available
  867. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  868. }
  869. {
  870. * CloseTSMAwareApplication()
  871. *
  872. * Availability:
  873. * Mac OS X: not available
  874. * CarbonLib: not available
  875. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  876. }
  877. { Component Manager Interfaces to Input Methods }
  878. {
  879. * GetScriptLanguageSupport()
  880. *
  881. * Mac OS X threading:
  882. * Not thread safe
  883. *
  884. * Availability:
  885. * Mac OS X: in version 10.0 and later in Carbon.framework
  886. * CarbonLib: in CarbonLib 1.0 and later
  887. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  888. }
  889. function GetScriptLanguageSupport( ts: ComponentInstance; var scriptHdl: ScriptLanguageSupportHandle ): ComponentResult; external name '_GetScriptLanguageSupport';
  890. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  891. {
  892. * InitiateTextService()
  893. *
  894. * Mac OS X threading:
  895. * Not thread safe
  896. *
  897. * Availability:
  898. * Mac OS X: in version 10.0 and later in Carbon.framework
  899. * CarbonLib: in CarbonLib 1.0 and later
  900. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  901. }
  902. function InitiateTextService( ts: ComponentInstance ): ComponentResult; external name '_InitiateTextService';
  903. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  904. {
  905. * TerminateTextService()
  906. *
  907. * Mac OS X threading:
  908. * Not thread safe
  909. *
  910. * Availability:
  911. * Mac OS X: in version 10.0 and later in Carbon.framework
  912. * CarbonLib: in CarbonLib 1.0 and later
  913. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  914. }
  915. function TerminateTextService( ts: ComponentInstance ): ComponentResult; external name '_TerminateTextService';
  916. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  917. {
  918. * ActivateTextService()
  919. *
  920. * Mac OS X threading:
  921. * Not thread safe
  922. *
  923. * Availability:
  924. * Mac OS X: in version 10.0 and later in Carbon.framework
  925. * CarbonLib: in CarbonLib 1.0 and later
  926. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  927. }
  928. function ActivateTextService( ts: ComponentInstance ): ComponentResult; external name '_ActivateTextService';
  929. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  930. {
  931. * DeactivateTextService()
  932. *
  933. * Mac OS X threading:
  934. * Not thread safe
  935. *
  936. * Availability:
  937. * Mac OS X: in version 10.0 and later in Carbon.framework
  938. * CarbonLib: in CarbonLib 1.0 and later
  939. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  940. }
  941. function DeactivateTextService( ts: ComponentInstance ): ComponentResult; external name '_DeactivateTextService';
  942. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  943. {
  944. * GetTextServiceMenu()
  945. *
  946. * Mac OS X threading:
  947. * Not thread safe
  948. *
  949. * Availability:
  950. * Mac OS X: in version 10.0 and later in Carbon.framework
  951. * CarbonLib: in CarbonLib 1.0 and later
  952. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  953. }
  954. function GetTextServiceMenu( ts: ComponentInstance; var serviceMenu: MenuRef ): ComponentResult; external name '_GetTextServiceMenu';
  955. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  956. { New Text Service call in Carbon. }
  957. { Note: Only Raw Key and Mouse-flavored events are passed to Text Services on MacOS X. }
  958. {
  959. * TextServiceEventRef()
  960. *
  961. * Mac OS X threading:
  962. * Not thread safe
  963. *
  964. * Availability:
  965. * Mac OS X: in version 10.0 and later in Carbon.framework
  966. * CarbonLib: in CarbonLib 1.1 and later
  967. * Non-Carbon CFM: not available
  968. }
  969. function TextServiceEventRef( ts: ComponentInstance; event: EventRef ): ComponentResult; external name '_TextServiceEventRef';
  970. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  971. {
  972. * TextServiceEvent()
  973. *
  974. * Availability:
  975. * Mac OS X: not available
  976. * CarbonLib: not available
  977. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  978. }
  979. {
  980. * UCTextServiceEvent()
  981. *
  982. * Availability:
  983. * Mac OS X: not available
  984. * CarbonLib: not available
  985. * Non-Carbon CFM: in InterfaceLib 8.5 and later
  986. }
  987. {
  988. * TextServiceMenuSelect()
  989. *
  990. * Availability:
  991. * Mac OS X: not available
  992. * CarbonLib: not available
  993. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  994. }
  995. {
  996. * SetTextServiceCursor()
  997. *
  998. * Availability:
  999. * Mac OS X: not available
  1000. * CarbonLib: not available
  1001. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1002. }
  1003. {
  1004. * FixTextService()
  1005. *
  1006. * Mac OS X threading:
  1007. * Not thread safe
  1008. *
  1009. * Availability:
  1010. * Mac OS X: in version 10.0 and later in Carbon.framework
  1011. * CarbonLib: in CarbonLib 1.0 and later
  1012. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1013. }
  1014. function FixTextService( ts: ComponentInstance ): ComponentResult; external name '_FixTextService';
  1015. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1016. {
  1017. * HidePaletteWindows()
  1018. *
  1019. * Mac OS X threading:
  1020. * Not thread safe
  1021. *
  1022. * Availability:
  1023. * Mac OS X: in version 10.0 and later in Carbon.framework
  1024. * CarbonLib: in CarbonLib 1.0 and later
  1025. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  1026. }
  1027. function HidePaletteWindows( ts: ComponentInstance ): ComponentResult; external name '_HidePaletteWindows';
  1028. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1029. {
  1030. Text Service Properties and standard values
  1031. (used with GetTextServiceProperty/SetTextServiceProperty)
  1032. }
  1033. type
  1034. TextServicePropertyTag = OSType;
  1035. {
  1036. * Summary:
  1037. * TextService Properties
  1038. *
  1039. * Discussion:
  1040. * Text Service properties are passed directly to a text service
  1041. * component via Component Mgr glue provided by TSM. Applications
  1042. * that have special knowledge of specific input methods can
  1043. * communicate private properties between each other. The 2
  1044. * following errors have been introduced (as of Mac OS X 10.3) to
  1045. * better support these API: tsmComponentPropertyUnsupportedErr //
  1046. * SetTextServiceProperty failed tsmComponentPropertyNotFoundErr
  1047. * // GetTextServiceProperty failed
  1048. }
  1049. const
  1050. { Typing input mode property tag }
  1051. {
  1052. * The JaTypingMethod property is becoming obsolete. It was
  1053. * introduced as a way for the Setup Assistant to tell Apple's
  1054. * Kotoeri (Japanese) input method to switch to either Roman or
  1055. * Katakana input mode in certain text fields. The entire input mode
  1056. * mechanism is being superceded by kTextServiceInputModePropertyTag.
  1057. * Property available in TSM 1.5 on MacOSX 10.0 and later
  1058. }
  1059. kTextServiceJaTypingMethodPropertyTag = $6A747970 (* 'jtyp' *); { Japanese input method typing property}
  1060. {
  1061. * The InputMode property is a CFStringRef that uniquely identifies
  1062. * which input mode should be made current by a keyboard class input
  1063. * method, if possible. Input modes are either generic, i.e.
  1064. * pre-defined by TSM, or specific to an input method. An example of
  1065. * a generic input mode is Katakana input (Japanese) where input in a
  1066. * text field needs to be restricted to that character subset.
  1067. * Another is Roman input mode. This is useful to temporarily
  1068. * provide Roman input from an input method that normally allows text
  1069. * input in another script. The advantage to this over forcing the
  1070. * keyboard script to Roman is that the same input method's UI
  1071. * continues to be available to the user, even though the input
  1072. * script has changed. An example of a special input mode (input
  1073. * method specific) is Hanin input mode in Traditional Chinese input
  1074. * methods. To temporarily change the current input mode from
  1075. * whatever it is to a generic one, use GetTextServiceProperty to
  1076. * obtain the current input mode, then SetTextServiceProperty to
  1077. * switch to the generic mode, and when done restore the original
  1078. * input mode. Input Methods themselves make known what input modes
  1079. * they support via the CopyTextServiceInputModeList component call.
  1080. * If the input method does not support a specified inputMode,
  1081. * GetTextServiceProperty and SetTextServiceProperty will return
  1082. * tsmComponentPropertyUnsupportedErr. GetTextServiceProperty will
  1083. * return tsmComponentPropertyNotFoundErr. RemoveTextServiceProperty
  1084. * is not supported with this tag. NOTE: This property tag is
  1085. * identical to the kTSMDocumentInputModePropertyTag passed to the
  1086. * TSMDocumentProperty API. This allows the tag and value to be
  1087. * passed through without interpretation. NOTE: Input modes
  1088. * CFStringRef's are cast to SInt32 in these API. Property available
  1089. * in TSM 2.2 and later Error Codes (MacErrors.h)
  1090. * tsmComponentPropertyUnsupportedErr - SetTextServiceProperty does
  1091. * not support the specified inputMode. tsmInputModeChangeFailedErr -
  1092. * can be returned if an input method failed to succeed in switching
  1093. * to the requested input mode.
  1094. }
  1095. kTextServiceInputModePropertyTag = kTSMDocumentInputModePropertyTag; { input mode property for input methods}
  1096. { NOTE: This property is being deprecated. Use kTextServiceInputModePropertyTag instead. }
  1097. kIMJaTypingMethodProperty = kTextServiceJaTypingMethodPropertyTag; { Typing method property for Japanese input methods}
  1098. { Typing method property values for kTextServiceJaTypingMethodPropertyTag }
  1099. kIMJaTypingMethodRoman = $726F6D61 (* 'roma' *); { Roman typing}
  1100. kIMJaTypingMethodKana = $6B616E61 (* 'kana' *); { Kana typing}
  1101. type
  1102. TextServicePropertyValue = SInt32;
  1103. {
  1104. Generic, restricted, input modes
  1105. Used as values for kTextServiceInputModePropertyTag TextServiceProperty API.
  1106. These values require a cast from CFStringRef to SInt32.
  1107. }
  1108. { Restrict output to Roman characters only}
  1109. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1110. {$definec kTextServiceInputModeRoman CFSTRP('com.apple.inputmethod.Roman')}
  1111. {$endc}
  1112. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1113. {$definec kTextServiceInputModePassword CFSTRP('com.apple.inputmethod.Password')}
  1114. {$endc}
  1115. { Restrict output to Hiragana characters only (no conversion to Kanji, i.e. yomi)}
  1116. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1117. {$definec kTextServiceInputModeJapaneseHiragana CFSTRP('com.apple.inputmethod.Japanese.Hiragana')}
  1118. {$endc}
  1119. { Restrict output to Katakana characters only (no conversion to Kanji)}
  1120. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1121. {$definec kTextServiceInputModeJapaneseKatakana CFSTRP('com.apple.inputmethod.Japanese.Katakana')}
  1122. {$endc}
  1123. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1124. {$definec kTextServiceInputModeJapaneseFullWidthRoman CFSTRP('com.apple.inputmethod.Japanese.FullWidthRoman')}
  1125. {$endc}
  1126. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1127. {$definec kTextServiceInputModeJapaneseHalfWidthKana CFSTRP('com.apple.inputmethod.Japanese.HalfWidthKana')}
  1128. {$endc}
  1129. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1130. {$definec kTextServiceInputModeJapanesePlaceName CFSTRP('com.apple.inputmethod.Japanese.PlaceName')}
  1131. {$endc}
  1132. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1133. {$definec kTextServiceInputModeJapaneseFirstName CFSTRP('com.apple.inputmethod.Japanese.FirstName')}
  1134. {$endc}
  1135. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1136. {$definec kTextServiceInputModeJapaneseLastName CFSTRP('com.apple.inputmethod.Japanese.LastName')}
  1137. {$endc}
  1138. { Restrict output to Bopomofo characters only (no conversion to Han)}
  1139. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1140. {$definec kTextServiceInputModeBopomofo CFSTRP('com.apple.inputmethod.TradChinese.Bopomofo')}
  1141. {$endc}
  1142. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1143. {$definec kTextServiceInputModeTradChinesePlaceName CFSTRP('com.apple.inputmethod.TradChinese.PlaceName')}
  1144. {$endc}
  1145. { Restrict output to Hangul syllables only (no conversion to Hanja)}
  1146. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1147. {$definec kTextServiceInputModeHangul CFSTRP('com.apple.inputmethod.Korean.Hangul')}
  1148. {$endc}
  1149. {
  1150. Generic, unrestricted, Input Mode strings
  1151. Used as values for kTextServiceInputModePropertyTag in TextServiceProperty API.
  1152. Unrestricted Japanese output
  1153. }
  1154. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1155. {$definec kTextServiceInputModeJapanese CFSTRP('com.apple.inputmethod.Japanese')}
  1156. {$endc}
  1157. { Traditional Chinese generic (unrestricted) input mode}
  1158. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1159. {$definec kTextServiceInputModeTradChinese CFSTRP('com.apple.inputmethod.TradChinese')}
  1160. {$endc}
  1161. { Simplified Chinese generic (unrestricted) input mode}
  1162. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1163. {$definec kTextServiceInputModeSimpChinese CFSTRP('com.apple.inputmethod.SimpChinese')}
  1164. {$endc}
  1165. { Korean generic (unrestricted) output (i.e. Hanja possible)}
  1166. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1167. {$definec kTextServiceInputModeKorean CFSTRP('com.apple.inputmethod.Korean')}
  1168. {$endc}
  1169. {
  1170. * GetTextServiceProperty()
  1171. *
  1172. * Mac OS X threading:
  1173. * Not thread safe
  1174. *
  1175. * Availability:
  1176. * Mac OS X: in version 10.0 and later in Carbon.framework
  1177. * CarbonLib: in CarbonLib 1.0 and later
  1178. * Non-Carbon CFM: not available
  1179. }
  1180. function GetTextServiceProperty( ts: ComponentInstance; inPropertyTag: TextServicePropertyTag; var outPropertyValue: TextServicePropertyValue ): ComponentResult; external name '_GetTextServiceProperty';
  1181. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1182. {
  1183. * SetTextServiceProperty()
  1184. *
  1185. * Mac OS X threading:
  1186. * Not thread safe
  1187. *
  1188. * Availability:
  1189. * Mac OS X: in version 10.0 and later in Carbon.framework
  1190. * CarbonLib: in CarbonLib 1.0 and later
  1191. * Non-Carbon CFM: not available
  1192. }
  1193. function SetTextServiceProperty( ts: ComponentInstance; inPropertyTag: TextServicePropertyTag; inPropertyValue: TextServicePropertyValue ): ComponentResult; external name '_SetTextServiceProperty';
  1194. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1195. {
  1196. * CopyTextServiceInputModeList()
  1197. *
  1198. * Summary:
  1199. * Obtain a copy of the set of input modes supported by a
  1200. * keyboard-class input method.
  1201. *
  1202. * Discussion:
  1203. * This Component call is only intended to be supported by input
  1204. * methods that adopt the Input Mode protocol. If this component
  1205. * call is not supported by an input method, calls to the
  1206. * TextServiceProperty API with the kTextServiceInputModePropertyTag
  1207. * property will fail with tsmComponentPropertyUnsupportedErr. Below
  1208. * is the layout of the CFDictionary returned. <dict> <key>
  1209. * kTSInputModeListKey </key> <dict> <key> modeSignature : (internal
  1210. * ascii name) </key> <!-- This can be any of the generic input
  1211. * modes defined in this file, --> <!-- such as
  1212. * kTextServiceInputModeRoman, or can be a private input --> <!--
  1213. * mode such as CFSTR(
  1214. * "com.apple.MyInputmethod.Japanese.CoolInputMode" ) --> <dict>
  1215. * <key>menuIconFile</key> <string> (path for menu icon image file)
  1216. * </string> <key>alternateMenuIconFile</key> <string> (path for
  1217. * alternate menu icon image file -- when item is hilited) </string>
  1218. * <key>paletteIconFile</key> <string> (path for palette icon image
  1219. * file) </string> <key>defaultState</key> <boolean> (default on/off
  1220. * state) </boolean> <key>script</key> <string> (scriptCode string
  1221. * for this mode, i.e. "smRoman", "smJapanese", ...) </string>
  1222. * <key>primaryInScript</key> <boolean> (true if this is primary
  1223. * mode in this script) </boolean> <key>isVisible</key> <boolean>
  1224. * (true if this input mode should appear in System UI) </boolean>
  1225. * <key>keyEquivalentModifiers</key> <integer> (modifiers)
  1226. * </integer> <key>keyEquivalent</key> <string> (key equivalent
  1227. * character) </string> <key>JISKeyboardShortcut</key> <integer>
  1228. * (optional: 0=none,1=hiragana,2=katakana,3=eisu) </integer>
  1229. * </dict> </dict> <key> kTSVisibleInputModeOrderedArrayKey </key>
  1230. * <!-- This array defines the ordering (for UI purposes) of input
  1231. * modes that are --> <!-- both visible and enabled (either by
  1232. * default, i.e. by the System, or by --> <!-- the user, i.e. via
  1233. * System provided UI) --> <array> <value> modeSignature </value>
  1234. * </array> </dict> Available in TSM 2.2 and later Important: This
  1235. * dictionary must also be present in the component bundle's
  1236. * Info.plist, in addition to being available through this component
  1237. * call. This will allow retrival of input modes by the System
  1238. * without opening the component. The component call will be used
  1239. * whenever the System is notified of a change in the contents of
  1240. * the inputMode list, such as when the name or key-equivalents of
  1241. * individual input modes have changed. Note: If, when the
  1242. * input method is first activated in a login session, the settings
  1243. * of the individual input modes (names or key-equivalents) differ
  1244. * from the default settings as found in the component bundle's
  1245. * Info.plist, the System will need to be notified of the change.
  1246. * The input method does this by sending out a
  1247. * kEventTextInputInputMenuChanged Carbon event, just as it is when
  1248. * the change originally took place.
  1249. *
  1250. * Mac OS X threading:
  1251. * Not thread safe
  1252. *
  1253. * Availability:
  1254. * Mac OS X: in version 10.3 and later in Carbon.framework
  1255. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  1256. * Non-Carbon CFM: not available
  1257. }
  1258. function CopyTextServiceInputModeList( ts: ComponentInstance; var outInputModes: CFDictionaryRef ): ComponentResult; external name '_CopyTextServiceInputModeList';
  1259. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  1260. {
  1261. Key for InputMode dictionary in Component bundle's Info.plist
  1262. Value is a dictionary describing the set of input modes implemented by the component.
  1263. The supported keys in this dictionary are:
  1264. kTSInputModeListKey
  1265. kTSVisibleInputModeOrderedArrayKey
  1266. See CopyTextServiceInputModeList() for more details.
  1267. }
  1268. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1269. {$definec kComponentBundleInputModeDictKey CFSTRP('ComponentInputModeDict')}
  1270. {$endc}
  1271. {
  1272. Key for dictionary of individual input modes
  1273. NOTE: This key is used both in the Component bundle's Info.plist dictionary and the dictionary
  1274. returned by the CopyTextServiceInputModeList() component call.
  1275. }
  1276. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1277. {$definec kTSInputModeListKey CFSTRP('tsInputModeListKey')}
  1278. {$endc}
  1279. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1280. {$definec kTSInputModeMenuIconFileKey CFSTRP('tsInputModeMenuIconFileKey')}
  1281. {$endc}
  1282. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1283. {$definec kTSInputModeAlternateMenuIconFileKey CFSTRP('tsInputModeAlternateMenuIconFileKey')}
  1284. {$endc}
  1285. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1286. {$definec kTSInputModePaletteIconFileKey CFSTRP('tsInputModePaletteIconFileKey')}
  1287. {$endc}
  1288. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1289. {$definec kTSInputModeDefaultStateKey CFSTRP('tsInputModeDefaultStateKey')}
  1290. {$endc}
  1291. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1292. {$definec kTSInputModeScriptKey CFSTRP('tsInputModeScriptKey')}
  1293. {$endc}
  1294. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1295. {$definec kTSInputModePrimaryInScriptKey CFSTRP('tsInputModePrimaryInScriptKey')}
  1296. {$endc}
  1297. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1298. {$definec kTSInputModeIsVisibleKey CFSTRP('tsInputModeIsVisibleKey')}
  1299. {$endc}
  1300. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1301. {$definec kTSInputModeKeyEquivalentModifiersKey CFSTRP('tsInputModeKeyEquivalentModifiersKey')}
  1302. {$endc}
  1303. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1304. {$definec kTSInputModeKeyEquivalentKey CFSTRP('tsInputModeKeyEquivalentKey')}
  1305. {$endc}
  1306. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1307. {$definec kTSInputModeJISKeyboardShortcutKey CFSTRP('tsInputModeJISKeyboardShortcutKey')}
  1308. {$endc}
  1309. {
  1310. Key for array of visible input modes to determine UI ordering
  1311. NOTE: This key is intended to be used both in the Component bundle's Info.plist dictionary and in
  1312. in the dictionary returned by the CopyTextServiceInputModeList() component call. In the latter
  1313. case, the array should contain only the set of visible input modes that are also enabled.
  1314. }
  1315. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1316. {$definec kTSVisibleInputModeOrderedArrayKey CFSTRP('tsVisibleInputModeOrderedArrayKey')}
  1317. {$endc}
  1318. {
  1319. Key for Component bundle's Info.plist, controls visibility in System UI.
  1320. Value is a CFBoolean.
  1321. NOTE: Keyboard input methods are always visible in System UI.
  1322. }
  1323. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1324. {$definec kComponentBundleInvisibleInSystemUIKey CFSTRP('ComponentInvisibleInSystemUI')}
  1325. {$endc}
  1326. {
  1327. * TSMCopyInputMethodEnabledInputModes()
  1328. *
  1329. * Summary:
  1330. * Obtain the array of a component's enabled (and visible) input
  1331. * modes.
  1332. *
  1333. * Discussion:
  1334. * The intended use of this API is to allow an input method to query
  1335. * the System for the subset of its own input modes that are
  1336. * enabled, so that the component's own UI can ommit input modes
  1337. * disabled by the user or the System. This API is only meaningful
  1338. * for input methods that adopt the Input Mode protocol. If the
  1339. * component passed is not inputMode-savvy, the returned array will
  1340. * be NULL. The enabled input modes returned in the array are always
  1341. * visible ones, i.e. those input modes for which
  1342. * kTSInputModeIsVisibleKey is true because non-visible input modes
  1343. * are not tracked by the System. It is the responsibility of the
  1344. * caller to release the returned array. <array> <value>
  1345. * modeSignature : (internal ascii name) </value> </array> Available
  1346. * in TSM 2.2 and later
  1347. *
  1348. * Mac OS X threading:
  1349. * Not thread safe
  1350. *
  1351. * Availability:
  1352. * Mac OS X: in version 10.3 and later in Carbon.framework
  1353. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  1354. * Non-Carbon CFM: not available
  1355. }
  1356. function TSMCopyInputMethodEnabledInputModes( inComponent: Component; var outInputModeArray: CFArrayRef ): Boolean; external name '_TSMCopyInputMethodEnabledInputModes';
  1357. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  1358. {
  1359. * TSMSelectInputMode()
  1360. *
  1361. * Summary:
  1362. * Make the specified input method input mode the current input
  1363. * source.
  1364. *
  1365. * Discussion:
  1366. * The intended use of this API is to allow an input method to
  1367. * select one of its own input modes as the current input source and
  1368. * update the TextInput menu icon in the menubar. This API is only
  1369. * meaningful for input methods that adopt TSM's Input Mode
  1370. * protocol. Available in TSM 2.2 and later
  1371. *
  1372. * Mac OS X threading:
  1373. * Not thread safe
  1374. *
  1375. * Availability:
  1376. * Mac OS X: in version 10.3 and later in Carbon.framework
  1377. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  1378. * Non-Carbon CFM: not available
  1379. }
  1380. function TSMSelectInputMode( inComponent: Component; inInputMode: CFStringRef ): OSStatus; external name '_TSMSelectInputMode';
  1381. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  1382. { Get the active TSMDocument in the current application context. }
  1383. { If TSM has enabled bottom line input mode because no TSMDocument }
  1384. { is active, NULL will be returned. }
  1385. {
  1386. * TSMGetActiveDocument()
  1387. *
  1388. * Mac OS X threading:
  1389. * Not thread safe
  1390. *
  1391. * Availability:
  1392. * Mac OS X: in version 10.0 and later in Carbon.framework
  1393. * CarbonLib: in CarbonLib 1.3 and later
  1394. * Non-Carbon CFM: not available
  1395. }
  1396. function TSMGetActiveDocument: TSMDocumentID; external name '_TSMGetActiveDocument';
  1397. (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
  1398. {
  1399. * GetDefaultInputMethodOfClass()
  1400. *
  1401. * Mac OS X threading:
  1402. * Not thread safe
  1403. *
  1404. * Availability:
  1405. * Mac OS X: in version 10.2 and later in Carbon.framework
  1406. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1407. * Non-Carbon CFM: not available
  1408. }
  1409. function GetDefaultInputMethodOfClass( var aComp: Component; var slRecPtr: ScriptLanguageRecord; tsClass: TextServiceClass ): OSStatus; external name '_GetDefaultInputMethodOfClass';
  1410. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  1411. {
  1412. * SetDefaultInputMethodOfClass()
  1413. *
  1414. * Mac OS X threading:
  1415. * Not thread safe
  1416. *
  1417. * Availability:
  1418. * Mac OS X: in version 10.2 and later in Carbon.framework
  1419. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1420. * Non-Carbon CFM: not available
  1421. }
  1422. function SetDefaultInputMethodOfClass( aComp: Component; var slRecPtr: ScriptLanguageRecord; tsClass: TextServiceClass ): OSStatus; external name '_SetDefaultInputMethodOfClass';
  1423. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  1424. {
  1425. * SelectTextService()
  1426. *
  1427. * Summary:
  1428. * Select a text service component
  1429. *
  1430. * Discussion:
  1431. * This API is currently only intended for use by input methods in
  1432. * text service classes which are "additive" in nature, that is
  1433. * where the input method can operate in parallel to other input
  1434. * methods in the same class and other additive text service
  1435. * classes. An example of such a class is the Character Palette
  1436. * class. It is not for use by traditional input methods, such as
  1437. * those that belong to the keyboard input method class.
  1438. *
  1439. * Mac OS X threading:
  1440. * Not thread safe
  1441. *
  1442. * Availability:
  1443. * Mac OS X: in version 10.2 and later in Carbon.framework
  1444. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1445. * Non-Carbon CFM: not available
  1446. }
  1447. function SelectTextService( aComp: Component ): OSStatus; external name '_SelectTextService';
  1448. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  1449. {
  1450. * DeselectTextService()
  1451. *
  1452. * Summary:
  1453. * Deselect a text service component
  1454. *
  1455. * Discussion:
  1456. * See SelectTextService.
  1457. *
  1458. * Mac OS X threading:
  1459. * Not thread safe
  1460. *
  1461. * Availability:
  1462. * Mac OS X: in version 10.2 and later in Carbon.framework
  1463. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  1464. * Non-Carbon CFM: not available
  1465. }
  1466. function DeselectTextService( aComp: Component ): OSStatus; external name '_DeselectTextService';
  1467. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  1468. {
  1469. * IsTextServiceSelected()
  1470. *
  1471. * Summary:
  1472. * Checks if a text service component is selected
  1473. *
  1474. * Discussion:
  1475. * See SelectTextService.
  1476. *
  1477. * Mac OS X threading:
  1478. * Not thread safe
  1479. *
  1480. * Availability:
  1481. * Mac OS X: in version 10.3 and later in Carbon.framework
  1482. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.3 and later
  1483. * Non-Carbon CFM: not available
  1484. }
  1485. function IsTextServiceSelected( aComp: Component ): Boolean; external name '_IsTextServiceSelected';
  1486. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  1487. {$ifc OLDROUTINENAMES}
  1488. const
  1489. kInputMethodService = kKeyboardInputMethodClass;
  1490. const
  1491. kUnicodeTextService = $75747376 (* 'utsv' *); { Component type for Unicode Text Service }
  1492. {$endc} { OLDROUTINENAMES }
  1493. {-------------------------------------------}
  1494. { Input Mode Palette configuration routines }
  1495. {-------------------------------------------}
  1496. {
  1497. * TSMInputModePaletteLoadButtons()
  1498. *
  1499. * Discussion:
  1500. * Notifies the Input Mode Palette of changes in an input method's
  1501. * controls. Replaces the current controls with the new control
  1502. * array.
  1503. *
  1504. * Mac OS X threading:
  1505. * Not thread safe
  1506. *
  1507. * Parameters:
  1508. *
  1509. * paletteButtonsArray:
  1510. * CFArray containing descriptions of the controls. Each control
  1511. * is described using a CFDictionary, using the keys described
  1512. * below.
  1513. *
  1514. * Availability:
  1515. * Mac OS X: in version 10.4 and later in Carbon.framework
  1516. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  1517. * Non-Carbon CFM: not available
  1518. }
  1519. procedure TSMInputModePaletteLoadButtons( paletteButtonsArray: CFArrayRef ); external name '_TSMInputModePaletteLoadButtons';
  1520. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  1521. {
  1522. * TSMInputModePaletteUpdateButtons()
  1523. *
  1524. * Discussion:
  1525. * Notifies the Input Mode Palette of updates in an input method's
  1526. * controls. Will update controls based on the control tag ID.
  1527. * Does not replace/remove existing controls.
  1528. *
  1529. * Mac OS X threading:
  1530. * Not thread safe
  1531. *
  1532. * Parameters:
  1533. *
  1534. * paletteButtonsArray:
  1535. * CFArray containing descriptions of the controls. Each control
  1536. * is described using a CFDictionary, using the keys described
  1537. * below.
  1538. *
  1539. * Availability:
  1540. * Mac OS X: in version 10.4 and later in Carbon.framework
  1541. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  1542. * Non-Carbon CFM: not available
  1543. }
  1544. procedure TSMInputModePaletteUpdateButtons( paletteButtonsArray: CFArrayRef ); external name '_TSMInputModePaletteUpdateButtons';
  1545. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  1546. {----------------------------------------------------------------------------}
  1547. { CFDictionary keys used to build the control description passed }
  1548. { to TSMInputModePaletteLoadButtons() and TSMInputModePaletteUpdateButtons() }
  1549. {----------------------------------------------------------------------------}
  1550. {******************************************************
  1551. Example of palette controls CFArray passed to TSMInputModePaletteLoadButtons():
  1552. Buttons consist of a CFDictionary containing:
  1553. - itemType
  1554. - icon
  1555. - alternate icon
  1556. - ID
  1557. - enabled
  1558. - state
  1559. Pulldown menus consist of a CFDictionary containing:
  1560. - itemType
  1561. - icon
  1562. - alternate icon
  1563. - ID
  1564. <array>
  1565. <dict>
  1566. <!-- item 1 - a push button -->
  1567. <key>tsInputModePaletteItemTypeKey</key>
  1568. <integer>0</integer>
  1569. <key>tsInputModePaletteItemIconKey</key>
  1570. <string>modeButton1.tif</string>
  1571. <key>tsInputModePaletteItemAltIconKey</key>
  1572. <string>modeButton1Alt.tif</string>
  1573. <key>tsInputModePaletteItemIDKey</key>
  1574. <integer>1</integer>
  1575. <key>tsInputModePaletteItemEnabledKey</key>
  1576. <true/>
  1577. <key>tsInputModePaletteItemStateKey</key>
  1578. <integer>0</integer>
  1579. </dict>
  1580. <dict>
  1581. <!-- item 2 - a pulldown menu -->
  1582. <key>tsInputModePaletteItemTypeKey</key>
  1583. <integer>2</integer>
  1584. <key>tsInputModePaletteItemIconKey</key>
  1585. <string>modeMenu1.tif</string>
  1586. <key>tsInputModePaletteItemAltIconKey</key>
  1587. <string>modeMenu1Alt.tif</string>
  1588. <key>tsInputModePaletteItemIDKey</key>
  1589. <integer>2</integer>
  1590. </dict>
  1591. </array>
  1592. ******************************************************}
  1593. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1594. {$definec kTSInputModePaletteItemTypeKey CFSTRP('tsInputModePaletteItemTypeKey')}
  1595. {$endc}
  1596. { CFNumber - the type of control (0: push button, 1: toggle button, 2: pulldown menu) }
  1597. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1598. {$definec kTSInputModePaletteItemIconKey CFSTRP('tsInputModePaletteItemIconKey')}
  1599. {$endc}
  1600. { CFString - icon file name (File located in IM bundle's resource directory, so this is just the file name, not full path) }
  1601. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1602. {$definec kTSInputModePaletteItemAltIconKey CFSTRP('tsInputModePaletteItemAltIconKey')}
  1603. {$endc}
  1604. { CFString - alternate icon file name (File located in IM bundle's resource directory, so this is just the file name, not full path) }
  1605. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1606. {$definec kTSInputModePaletteItemStateKey CFSTRP('tsInputModePaletteItemStateKey')}
  1607. {$endc}
  1608. { CFNumber - state of the control (0: clear/unpressed, 1: checked/pressed, 2: mixed) }
  1609. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1610. {$definec kTSInputModePaletteItemEnabledKey CFSTRP('tsInputModePaletteItemEnabledKey')}
  1611. {$endc}
  1612. { CFBoolean - enabled state of the control }
  1613. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1614. {$definec kTSInputModePaletteItemIDKey CFSTRP('tsInputModePaletteItemIDKey')}
  1615. {$endc}
  1616. { CFNumber - UInt32 tag ID for control }
  1617. {
  1618. * InputModePaletteItemHit()
  1619. *
  1620. * Discussion:
  1621. * Component Manager call to tell an Input Method that a function
  1622. * button on the Input Mode Palette was pressed.
  1623. *
  1624. * Mac OS X threading:
  1625. * Not thread safe
  1626. *
  1627. * Parameters:
  1628. *
  1629. * inInstance:
  1630. * The component instance.
  1631. *
  1632. * inItemID:
  1633. * The item ID of the function button pressed on the palette.
  1634. *
  1635. * inItemState:
  1636. * The new state of the button.
  1637. *
  1638. * Result:
  1639. * Return non-null on successful handling of call.
  1640. *
  1641. * Availability:
  1642. * Mac OS X: in version 10.4 and later in Carbon.framework
  1643. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  1644. * Non-Carbon CFM: not available
  1645. }
  1646. function InputModePaletteItemHit( inInstance: ComponentInstance; inItemID: UInt32; inItemState: UInt32 ): ComponentResult; external name '_InputModePaletteItemHit';
  1647. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  1648. {
  1649. * GetInputModePaletteMenu()
  1650. *
  1651. * Discussion:
  1652. * Component Manager call to ask an Input Method for the menu to
  1653. * display for a pull-down menu on the Input Mode Palette.
  1654. *
  1655. * Mac OS X threading:
  1656. * Not thread safe
  1657. *
  1658. * Parameters:
  1659. *
  1660. * inInstance:
  1661. * The component instance.
  1662. *
  1663. * inItemID:
  1664. * The item ID of the pull-down menu button.
  1665. *
  1666. * outMenuItemsArray:
  1667. * The menu array to return to the Input Mode Palette.
  1668. *
  1669. * Result:
  1670. * Return non-null on successful handling of call.
  1671. *
  1672. * Availability:
  1673. * Mac OS X: in version 10.4 and later in Carbon.framework
  1674. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.4 and later
  1675. * Non-Carbon CFM: not available
  1676. }
  1677. function GetInputModePaletteMenu( inInstance: ComponentInstance; inItemID: UInt32; var outMenuItemsArray: CFArrayRef ): ComponentResult; external name '_GetInputModePaletteMenu';
  1678. (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *)
  1679. {----------------------------------------------------------}
  1680. { CFDictionary keys for menu definition returned }
  1681. { for kCMGetInputModePaletteMenu/GetInputModePaletteMenu() }
  1682. {----------------------------------------------------------}
  1683. {******************************************************
  1684. Example of menu CFArray returned to GetInputModePaletteMenu():
  1685. Pull-down menus consist of an array of CFDictionary's containing:
  1686. - title
  1687. - ID
  1688. - state
  1689. - enabled
  1690. - key equivalent (optional)
  1691. - key equivalent modifiers (optional)
  1692. <array>
  1693. <dict>
  1694. <!-- menu item w/ modifiers -->
  1695. <key>tsInputModePaletteItemTitleKey</key>
  1696. <string>menu item 1</string>
  1697. <key>tsInputModePaletteItemIDKey</key>
  1698. <integer>10</integer>
  1699. <key>tsInputModePaletteItemEnabledKey</key>
  1700. <true/>
  1701. <key>tsInputModePaletteItemStateKey</key>
  1702. <integer>0</integer>
  1703. <key>tsInputModePaletteItemKeyEquivalentKey</key>
  1704. <string>j</string>
  1705. <key>tsInputModePaletteItemKeyEquivalentModifiersKey</key>
  1706. <integer>2048</integer>
  1707. </dict>
  1708. <dict>
  1709. <!-- divider -->
  1710. <key>tsInputModePaletteItemTypeKey</key>
  1711. <string>-</string>
  1712. </dict>
  1713. <!-- menu item w/o modifiers -->
  1714. <key>tsInputModePaletteItemTitleKey</key>
  1715. <string>menu item 2</string>
  1716. <key>tsInputModePaletteItemIDKey</key>
  1717. <integer>11</integer>
  1718. <key>tsInputModePaletteItemEnabledKey</key>
  1719. <true/>
  1720. <key>tsInputModePaletteItemStateKey</key>
  1721. <integer>0</integer>
  1722. </dict>
  1723. </array>
  1724. ******************************************************}
  1725. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1726. {$definec kTSInputModePaletteItemTitleKey CFSTRP('tsInputModePaletteItemTitleKey')}
  1727. {$endc}
  1728. { CFString - menu item title (use '-' for a separator) }
  1729. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1730. {$definec kTSInputModePaletteItemKeyEquivalentKey CFSTRP('tsInputModePaletteItemKeyEquivalentKey')}
  1731. {$endc}
  1732. { CFString - menu item keyboard shortcut (example: 'j') }
  1733. {$ifc USE_CFSTR_CONSTANT_MACROS}
  1734. {$definec kTSInputModePaletteItemKeyEquivalentModifiersKey CFSTRP('tsInputModePaletteItemKeyEquivalentModifiersKey')}
  1735. {$endc}
  1736. { CFNumber - menu item keyboard shortcut modifiers (from Events.h) }
  1737. end.