Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

329 lines
10 KiB

  1. /*
  2. File: TSMTE.h
  3. Contains: Text Services Managerfor TextEdit Interfaces.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1991-2001 by Apple Computer, Inc., all rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __TSMTE__
  11. #define __TSMTE__
  12. #ifndef __TEXTEDIT__
  13. #include <TextEdit.h>
  14. #endif
  15. #ifndef __DIALOGS__
  16. #include <Dialogs.h>
  17. #endif
  18. #ifndef __TEXTSERVICES__
  19. #include <TextServices.h>
  20. #endif
  21. #if PRAGMA_ONCE
  22. #pragma once
  23. #endif
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. #if PRAGMA_IMPORT
  28. #pragma import on
  29. #endif
  30. #if PRAGMA_STRUCT_ALIGN
  31. #pragma options align=mac68k
  32. #elif PRAGMA_STRUCT_PACKPUSH
  33. #pragma pack(push, 2)
  34. #elif PRAGMA_STRUCT_PACK
  35. #pragma pack(2)
  36. #endif
  37. /* signature, interface types*/
  38. enum {
  39. kTSMTESignature = FOUR_CHAR_CODE('tmTE'),
  40. kTSMTEInterfaceType = FOUR_CHAR_CODE('tmTE')
  41. };
  42. /*
  43. In Carbon, since DialogRef is opaque, the TSMDialogRecord is removed.
  44. Only one kind of TSMTE dialog remains, with extended data managed by TSMTE.
  45. Use kTSMTESignature for the dialog refCon, and use the accessors below,
  46. i.e. GetTSMTEDialogTSMTERecHandle, to get at the old TSMDialogRecord info.
  47. */
  48. #if CALL_NOT_IN_CARBON
  49. enum {
  50. kTSMTEDialog = FOUR_CHAR_CODE('tmDI')
  51. };
  52. #endif /* CALL_NOT_IN_CARBON */
  53. /* update flag for TSMTERec*/
  54. enum {
  55. kTSMTEAutoScroll = 1
  56. };
  57. /* callback procedure definitions*/
  58. typedef CALLBACK_API( void , TSMTEPreUpdateProcPtr )(TEHandle textH, long refCon);
  59. typedef CALLBACK_API( void , TSMTEPostUpdateProcPtr )(TEHandle textH, long fixLen, long inputAreaStart, long inputAreaEnd, long pinStart, long pinEnd, long refCon);
  60. typedef STACK_UPP_TYPE(TSMTEPreUpdateProcPtr) TSMTEPreUpdateUPP;
  61. typedef STACK_UPP_TYPE(TSMTEPostUpdateProcPtr) TSMTEPostUpdateUPP;
  62. /* data types*/
  63. struct TSMTERec {
  64. TEHandle textH;
  65. TSMTEPreUpdateUPP preUpdateProc;
  66. TSMTEPostUpdateUPP postUpdateProc;
  67. long updateFlag;
  68. long refCon;
  69. };
  70. typedef struct TSMTERec TSMTERec;
  71. typedef TSMTERec * TSMTERecPtr;
  72. typedef TSMTERecPtr * TSMTERecHandle;
  73. #if !OPAQUE_TOOLBOX_STRUCTS
  74. struct TSMDialogRecord {
  75. DialogRecord fDialog;
  76. TSMDocumentID fDocID;
  77. TSMTERecHandle fTSMTERecH;
  78. long fTSMTERsvd[3]; /* reserved*/
  79. };
  80. typedef struct TSMDialogRecord TSMDialogRecord;
  81. typedef TSMDialogRecord * TSMDialogPtr;
  82. typedef TSMDialogPtr TSMDialogPeek;
  83. #endif /* !OPAQUE_TOOLBOX_STRUCTS */
  84. /*
  85. * NewTSMTEPreUpdateUPP()
  86. *
  87. * Availability:
  88. * Non-Carbon CFM: available as macro/inline
  89. * CarbonLib: in CarbonLib 1.0 and later
  90. * Mac OS X: in version 10.0 and later
  91. */
  92. EXTERN_API_C( TSMTEPreUpdateUPP )
  93. NewTSMTEPreUpdateUPP(TSMTEPreUpdateProcPtr userRoutine);
  94. #if !OPAQUE_UPP_TYPES
  95. enum { uppTSMTEPreUpdateProcInfo = 0x000003C0 }; /* pascal no_return_value Func(4_bytes, 4_bytes) */
  96. #ifdef __cplusplus
  97. inline DEFINE_API_C(TSMTEPreUpdateUPP) NewTSMTEPreUpdateUPP(TSMTEPreUpdateProcPtr userRoutine) { return (TSMTEPreUpdateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTSMTEPreUpdateProcInfo, GetCurrentArchitecture()); }
  98. #else
  99. #define NewTSMTEPreUpdateUPP(userRoutine) (TSMTEPreUpdateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTSMTEPreUpdateProcInfo, GetCurrentArchitecture())
  100. #endif
  101. #endif
  102. /*
  103. * NewTSMTEPostUpdateUPP()
  104. *
  105. * Availability:
  106. * Non-Carbon CFM: available as macro/inline
  107. * CarbonLib: in CarbonLib 1.0 and later
  108. * Mac OS X: in version 10.0 and later
  109. */
  110. EXTERN_API_C( TSMTEPostUpdateUPP )
  111. NewTSMTEPostUpdateUPP(TSMTEPostUpdateProcPtr userRoutine);
  112. #if !OPAQUE_UPP_TYPES
  113. enum { uppTSMTEPostUpdateProcInfo = 0x000FFFC0 }; /* pascal no_return_value Func(4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  114. #ifdef __cplusplus
  115. inline DEFINE_API_C(TSMTEPostUpdateUPP) NewTSMTEPostUpdateUPP(TSMTEPostUpdateProcPtr userRoutine) { return (TSMTEPostUpdateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTSMTEPostUpdateProcInfo, GetCurrentArchitecture()); }
  116. #else
  117. #define NewTSMTEPostUpdateUPP(userRoutine) (TSMTEPostUpdateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTSMTEPostUpdateProcInfo, GetCurrentArchitecture())
  118. #endif
  119. #endif
  120. /*
  121. * DisposeTSMTEPreUpdateUPP()
  122. *
  123. * Availability:
  124. * Non-Carbon CFM: available as macro/inline
  125. * CarbonLib: in CarbonLib 1.0 and later
  126. * Mac OS X: in version 10.0 and later
  127. */
  128. EXTERN_API_C( void )
  129. DisposeTSMTEPreUpdateUPP(TSMTEPreUpdateUPP userUPP);
  130. #if !OPAQUE_UPP_TYPES
  131. #ifdef __cplusplus
  132. inline DEFINE_API_C(void) DisposeTSMTEPreUpdateUPP(TSMTEPreUpdateUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  133. #else
  134. #define DisposeTSMTEPreUpdateUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  135. #endif
  136. #endif
  137. /*
  138. * DisposeTSMTEPostUpdateUPP()
  139. *
  140. * Availability:
  141. * Non-Carbon CFM: available as macro/inline
  142. * CarbonLib: in CarbonLib 1.0 and later
  143. * Mac OS X: in version 10.0 and later
  144. */
  145. EXTERN_API_C( void )
  146. DisposeTSMTEPostUpdateUPP(TSMTEPostUpdateUPP userUPP);
  147. #if !OPAQUE_UPP_TYPES
  148. #ifdef __cplusplus
  149. inline DEFINE_API_C(void) DisposeTSMTEPostUpdateUPP(TSMTEPostUpdateUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  150. #else
  151. #define DisposeTSMTEPostUpdateUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  152. #endif
  153. #endif
  154. /*
  155. * InvokeTSMTEPreUpdateUPP()
  156. *
  157. * Availability:
  158. * Non-Carbon CFM: available as macro/inline
  159. * CarbonLib: in CarbonLib 1.0 and later
  160. * Mac OS X: in version 10.0 and later
  161. */
  162. EXTERN_API_C( void )
  163. InvokeTSMTEPreUpdateUPP(
  164. TEHandle textH,
  165. long refCon,
  166. TSMTEPreUpdateUPP userUPP);
  167. #if !OPAQUE_UPP_TYPES
  168. #ifdef __cplusplus
  169. inline DEFINE_API_C(void) InvokeTSMTEPreUpdateUPP(TEHandle textH, long refCon, TSMTEPreUpdateUPP userUPP) { CALL_TWO_PARAMETER_UPP(userUPP, uppTSMTEPreUpdateProcInfo, textH, refCon); }
  170. #else
  171. #define InvokeTSMTEPreUpdateUPP(textH, refCon, userUPP) CALL_TWO_PARAMETER_UPP((userUPP), uppTSMTEPreUpdateProcInfo, (textH), (refCon))
  172. #endif
  173. #endif
  174. /*
  175. * InvokeTSMTEPostUpdateUPP()
  176. *
  177. * Availability:
  178. * Non-Carbon CFM: available as macro/inline
  179. * CarbonLib: in CarbonLib 1.0 and later
  180. * Mac OS X: in version 10.0 and later
  181. */
  182. EXTERN_API_C( void )
  183. InvokeTSMTEPostUpdateUPP(
  184. TEHandle textH,
  185. long fixLen,
  186. long inputAreaStart,
  187. long inputAreaEnd,
  188. long pinStart,
  189. long pinEnd,
  190. long refCon,
  191. TSMTEPostUpdateUPP userUPP);
  192. #if !OPAQUE_UPP_TYPES
  193. #ifdef __cplusplus
  194. inline DEFINE_API_C(void) InvokeTSMTEPostUpdateUPP(TEHandle textH, long fixLen, long inputAreaStart, long inputAreaEnd, long pinStart, long pinEnd, long refCon, TSMTEPostUpdateUPP userUPP) { CALL_SEVEN_PARAMETER_UPP(userUPP, uppTSMTEPostUpdateProcInfo, textH, fixLen, inputAreaStart, inputAreaEnd, pinStart, pinEnd, refCon); }
  195. #else
  196. #define InvokeTSMTEPostUpdateUPP(textH, fixLen, inputAreaStart, inputAreaEnd, pinStart, pinEnd, refCon, userUPP) CALL_SEVEN_PARAMETER_UPP((userUPP), uppTSMTEPostUpdateProcInfo, (textH), (fixLen), (inputAreaStart), (inputAreaEnd), (pinStart), (pinEnd), (refCon))
  197. #endif
  198. #endif
  199. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  200. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  201. #define NewTSMTEPreUpdateProc(userRoutine) NewTSMTEPreUpdateUPP(userRoutine)
  202. #define NewTSMTEPostUpdateProc(userRoutine) NewTSMTEPostUpdateUPP(userRoutine)
  203. #define CallTSMTEPreUpdateProc(userRoutine, textH, refCon) InvokeTSMTEPreUpdateUPP(textH, refCon, userRoutine)
  204. #define CallTSMTEPostUpdateProc(userRoutine, textH, fixLen, inputAreaStart, inputAreaEnd, pinStart, pinEnd, refCon) InvokeTSMTEPostUpdateUPP(textH, fixLen, inputAreaStart, inputAreaEnd, pinStart, pinEnd, refCon, userRoutine)
  205. #endif /* CALL_NOT_IN_CARBON */
  206. #if ACCESSOR_CALLS_ARE_FUNCTIONS
  207. /*
  208. * IsTSMTEDialog()
  209. *
  210. * Availability:
  211. * Non-Carbon CFM: in CarbonAccessors.o 1.0.2 and later
  212. * CarbonLib: in CarbonLib 1.0.2 and later
  213. * Mac OS X: in version 10.0 and later
  214. */
  215. EXTERN_API( Boolean )
  216. IsTSMTEDialog(DialogRef dialog);
  217. /* Getters */
  218. /*
  219. * GetTSMTEDialogDocumentID()
  220. *
  221. * Availability:
  222. * Non-Carbon CFM: in CarbonAccessors.o 1.0.2 and later
  223. * CarbonLib: in CarbonLib 1.0.2 and later
  224. * Mac OS X: in version 10.0 and later
  225. */
  226. EXTERN_API( TSMDocumentID )
  227. GetTSMTEDialogDocumentID(DialogRef dialog);
  228. /*
  229. * GetTSMTEDialogTSMTERecHandle()
  230. *
  231. * Availability:
  232. * Non-Carbon CFM: in CarbonAccessors.o 1.0.2 and later
  233. * CarbonLib: in CarbonLib 1.0.2 and later
  234. * Mac OS X: in version 10.0 and later
  235. */
  236. EXTERN_API( TSMTERecHandle )
  237. GetTSMTEDialogTSMTERecHandle(DialogRef dialog);
  238. /* Setters */
  239. /*
  240. * SetTSMTEDialogDocumentID()
  241. *
  242. * Availability:
  243. * Non-Carbon CFM: in CarbonAccessors.o 1.0.2 and later
  244. * CarbonLib: in CarbonLib 1.0.2 and later
  245. * Mac OS X: in version 10.0 and later
  246. */
  247. EXTERN_API( void )
  248. SetTSMTEDialogDocumentID(
  249. DialogRef dialog,
  250. TSMDocumentID documentID);
  251. /*
  252. * SetTSMTEDialogTSMTERecHandle()
  253. *
  254. * Availability:
  255. * Non-Carbon CFM: in CarbonAccessors.o 1.0.2 and later
  256. * CarbonLib: in CarbonLib 1.0.2 and later
  257. * Mac OS X: in version 10.0 and later
  258. */
  259. EXTERN_API( void )
  260. SetTSMTEDialogTSMTERecHandle(
  261. DialogRef dialog,
  262. TSMTERecHandle tsmteRecHandle);
  263. #endif /* ACCESSOR_CALLS_ARE_FUNCTIONS */
  264. #if PRAGMA_STRUCT_ALIGN
  265. #pragma options align=reset
  266. #elif PRAGMA_STRUCT_PACKPUSH
  267. #pragma pack(pop)
  268. #elif PRAGMA_STRUCT_PACK
  269. #pragma pack()
  270. #endif
  271. #ifdef PRAGMA_IMPORT_OFF
  272. #pragma import off
  273. #elif PRAGMA_IMPORT
  274. #pragma import reset
  275. #endif
  276. #ifdef __cplusplus
  277. }
  278. #endif
  279. #endif /* __TSMTE__ */