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.

3472 lines
125 KiB

  1. /*
  2. File: MacTextEditor.h
  3. Contains: Interfaces for MLTE - TextEdit replacement
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1996-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 __MACTEXTEDITOR__
  11. #define __MACTEXTEDITOR__
  12. #ifndef __CONDITIONALMACROS__
  13. #include <ConditionalMacros.h>
  14. #endif
  15. #ifndef __MACTYPES__
  16. #include <MacTypes.h>
  17. #endif
  18. #ifndef __FILES__
  19. #include <Files.h>
  20. #endif
  21. #ifndef __MACERRORS__
  22. #include <MacErrors.h>
  23. #endif
  24. #ifndef __CFSTRING__
  25. #include <CFString.h>
  26. #endif
  27. #ifndef __CFDICTIONARY__
  28. #include <CFDictionary.h>
  29. #endif
  30. #ifndef __ATSUNICODE__
  31. #include <ATSUnicode.h>
  32. #endif
  33. #ifndef __DRAG__
  34. #include <Drag.h>
  35. #endif
  36. #ifndef __MACWINDOWS__
  37. #include <MacWindows.h>
  38. #endif
  39. #ifndef __EVENTS__
  40. #include <Events.h>
  41. #endif
  42. #ifndef __CARBONEVENTS__
  43. #include <CarbonEvents.h>
  44. #endif
  45. #if PRAGMA_ONCE
  46. #pragma once
  47. #endif
  48. #ifdef __cplusplus
  49. extern "C" {
  50. #endif
  51. #if PRAGMA_IMPORT
  52. #pragma import on
  53. #endif
  54. #if PRAGMA_STRUCT_ALIGN
  55. #pragma options align=mac68k
  56. #elif PRAGMA_STRUCT_PACKPUSH
  57. #pragma pack(push, 2)
  58. #elif PRAGMA_STRUCT_PACK
  59. #pragma pack(2)
  60. #endif
  61. typedef struct OpaqueTXNObject* TXNObject;
  62. typedef struct OpaqueTXNFontMenuObject* TXNFontMenuObject;
  63. typedef UInt32 TXNFrameID;
  64. typedef UInt32 TXNVersionValue;
  65. enum {
  66. kTXNWillDefaultToATSUIBit = 0,
  67. kTXNWillDefaultToCarbonEventBit = 1
  68. };
  69. typedef OptionBits TXNFeatureBits;
  70. enum {
  71. kTXNWillDefaultToATSUIMask = 1L << kTXNWillDefaultToATSUIBit,
  72. kTXNWillDefaultToCarbonEventMask = 1L << kTXNWillDefaultToCarbonEventBit
  73. };
  74. enum {
  75. kTXNWantMoviesBit = 0,
  76. kTXNWantSoundBit = 1,
  77. kTXNWantGraphicsBit = 2,
  78. kTXNAlwaysUseQuickDrawTextBit = 3,
  79. kTXNUseTemporaryMemoryBit = 4
  80. };
  81. typedef OptionBits TXNInitOptions;
  82. enum {
  83. kTXNWantMoviesMask = 1L << kTXNWantMoviesBit,
  84. kTXNWantSoundMask = 1L << kTXNWantSoundBit,
  85. kTXNWantGraphicsMask = 1L << kTXNWantGraphicsBit,
  86. kTXNAlwaysUseQuickDrawTextMask = 1L << kTXNAlwaysUseQuickDrawTextBit,
  87. kTXNUseTemporaryMemoryMask = 1L << kTXNUseTemporaryMemoryBit
  88. };
  89. enum {
  90. kTXNDrawGrowIconBit = 0,
  91. kTXNShowWindowBit = 1,
  92. kTXNWantHScrollBarBit = 2,
  93. kTXNWantVScrollBarBit = 3,
  94. kTXNNoTSMEverBit = 4,
  95. kTXNReadOnlyBit = 5,
  96. kTXNNoKeyboardSyncBit = 6,
  97. kTXNNoSelectionBit = 7,
  98. kTXNSaveStylesAsSTYLResourceBit = 8,
  99. kOutputTextInUnicodeEncodingBit = 9,
  100. kTXNDoNotInstallDragProcsBit = 10,
  101. kTXNAlwaysWrapAtViewEdgeBit = 11,
  102. kTXNDontDrawCaretWhenInactiveBit = 12,
  103. kTXNDontDrawSelectionWhenInactiveBit = 13,
  104. kTXNSingleLineOnlyBit = 14,
  105. kTXNDisableDragAndDropBit = 15,
  106. kTXNUseQDforImagingBit = 16,
  107. kTXNMonostyledTextBit = 17
  108. };
  109. /*
  110. * TXNFrameOptions
  111. *
  112. * Summary:
  113. * Defines the initial behavior of an MLTE object created with
  114. * TXNNewObject.
  115. *
  116. * Discussion:
  117. * These masks can be combined and passed to TXNNewObject to define
  118. * the initial behavior of a new object.
  119. */
  120. typedef OptionBits TXNFrameOptions;
  121. enum {
  122. /*
  123. * Indicates that the frame will have a size box.
  124. */
  125. kTXNDrawGrowIconMask = 1L << kTXNDrawGrowIconBit,
  126. /*
  127. * Indicates that the window associated with the text object will be
  128. * displayed when the object is created. The application no longer
  129. * needs to call the ShowWindow function from the Window Manager;
  130. * MLTE will do this for you.
  131. */
  132. kTXNShowWindowMask = 1L << kTXNShowWindowBit,
  133. /*
  134. * Indicates that the frame will have a horizontal scrollbar.
  135. */
  136. kTXNWantHScrollBarMask = 1L << kTXNWantHScrollBarBit,
  137. /*
  138. * Indicates that the frame will have a vertical scrollbar.
  139. */
  140. kTXNWantVScrollBarMask = 1L << kTXNWantVScrollBarBit,
  141. /*
  142. * Indicates that the Text Services Manager will not be used. You
  143. * cannot use this mask when your application accepts Unicode input.
  144. */
  145. kTXNNoTSMEverMask = 1L << kTXNNoTSMEverBit,
  146. /*
  147. * Indicates that the text object will be read-only.
  148. */
  149. kTXNReadOnlyMask = 1L << kTXNReadOnlyBit,
  150. /*
  151. * Indicates that keyboard synchronization will not occur.
  152. */
  153. kTXNNoKeyboardSyncMask = 1L << kTXNNoKeyboardSyncBit,
  154. /*
  155. * Indicates that the user shouldn't be able to set the insertion
  156. * point or make a selection.
  157. */
  158. kTXNNoSelectionMask = 1L << kTXNNoSelectionBit,
  159. /*
  160. * Indicates that the text style will be saved as a
  161. * kTXNMultipleStylesPerTextDocumentResType resource. You can set
  162. * this to assure compatibility with SimpleText. If you use
  163. * kTXNMultipleStylesPerTextDocumentResType resources to save style
  164. * info, your documents can have as many styles as you'd like.
  165. * However tabs are not saved. If you don't use this mask, plain
  166. * text files are saved as kTXNSingleStylePerTextDocumentResType
  167. * resources, and only the first style in the document is saved.
  168. * (Your application is expected to apply all style changes to the
  169. * entire document.) If you save files with a
  170. * kTXNSingleStylePerTextDocumentResType resource, their output is
  171. * similar to those output by CodeWarrior, BBEdit, and MPW.
  172. */
  173. kTXNSaveStylesAsSTYLResourceMask = 1L << kTXNSaveStylesAsSTYLResourceBit,
  174. /*
  175. * Indicates that plain text will be saved as Unicode.
  176. */
  177. kOutputTextInUnicodeEncodingMask = 1L << kOutputTextInUnicodeEncodingBit,
  178. /*
  179. * Indicates that MLTE will not install its own drag handler for the
  180. * text object. This can be used if the client wants to install
  181. * their own handler.
  182. */
  183. kTXNDoNotInstallDragProcsMask = 1L << kTXNDoNotInstallDragProcsBit,
  184. /*
  185. * Indicates that lines will wrap at the edge of the view rectangle.
  186. */
  187. kTXNAlwaysWrapAtViewEdgeMask = 1L << kTXNAlwaysWrapAtViewEdgeBit,
  188. /*
  189. * Indicates that the caret shouldn't be drawn when the text object
  190. * doesn't have focus.
  191. */
  192. kTXNDontDrawCaretWhenInactiveMask = 1L << kTXNDontDrawCaretWhenInactiveBit,
  193. /*
  194. * Indicates that the selection (if one) shouldn't be drawn when the
  195. * text object doesn't have focus.
  196. */
  197. kTXNDontDrawSelectionWhenInactiveMask = 1L << kTXNDontDrawSelectionWhenInactiveBit,
  198. /*
  199. * Indicates that the text object will not scroll vertically,
  200. * horizontal scrolling will stop when the end of the text is visible
  201. * (plus any right margin), and there will be no limit to the width
  202. * of the text.
  203. */
  204. kTXNSingleLineOnlyMask = 1L << kTXNSingleLineOnlyBit,
  205. /*
  206. * Indicates that drag and drop will not be allowed in the text
  207. * object.
  208. */
  209. kTXNDisableDragAndDropMask = 1L << kTXNDisableDragAndDropBit,
  210. /*
  211. * Indicates that QuickDraw will be used for imaging instead of the
  212. * default CoreGraphics (Quartz). [X-only]
  213. */
  214. kTXNUseQDforImagingMask = 1L << kTXNUseQDforImagingBit,
  215. /*
  216. * Indicates that the text object will keep in single style no matter
  217. * what kind of changes made to the object.
  218. */
  219. kTXNMonostyledTextMask = 1L << kTXNMonostyledTextBit
  220. };
  221. enum {
  222. kTXNSetFlushnessBit = 0,
  223. kTXNSetJustificationBit = 1,
  224. kTXNUseFontFallBackBit = 2,
  225. kTXNRotateTextBit = 3,
  226. kTXNUseVerticalTextBit = 4,
  227. kTXNDontUpdateBoxRectBit = 5,
  228. kTXNDontDrawTextBit = 6,
  229. kTXNUseCGContextRefBit = 7,
  230. kTXNImageWithQDBit = 8,
  231. kTXNDontWrapTextBit = 9
  232. };
  233. /*
  234. * TXNTextBoxOptions
  235. *
  236. * Summary:
  237. * Defines how text will be drawn by one of the TXNxxxDrawTextBox
  238. * API.
  239. *
  240. * Discussion:
  241. * These masks can be combined and added to a TXNTextBoxOptionsData
  242. * structure to be passed to a TXNxxxDrawTextBox API.
  243. */
  244. typedef OptionBits TXNTextBoxOptions;
  245. enum {
  246. /*
  247. * Indicates that the text will be flush according to the line
  248. * direction.
  249. */
  250. kTXNSetFlushnessMask = 1L << kTXNSetFlushnessBit,
  251. /*
  252. * Indicates that the text will be justified in the direction that
  253. * the text is displayed. Horizontal text will be justified
  254. * horizontally, but not vertically. Vertical text will be justified
  255. * vertically, but not horizontally.
  256. */
  257. kTXNSetJustificationMask = 1L << kTXNSetJustificationBit,
  258. /*
  259. * Indicates that ATSUI transient font matching (that searches for a
  260. * font that has a matching character) will be used.
  261. */
  262. kTXNUseFontFallBackMask = 1L << kTXNUseFontFallBackBit,
  263. /*
  264. * Indicates that the text will be rotated. The amount of rotation
  265. * is given in the rotation field of the TXNTextBoxOptionsData
  266. * structure and is in units of degrees (negative values indicate
  267. * clockwise rotation).
  268. */
  269. kTXNRotateTextMask = 1L << kTXNRotateTextBit,
  270. /*
  271. * Indicates that the text will be displayed vertically from top to
  272. * bottom.
  273. */
  274. kTXNUseVerticalTextMask = 1L << kTXNUseVerticalTextBit,
  275. /*
  276. * Indicates that the specified rectangle will not be updated. If
  277. * you use this mask when you call a TXNDrawxxxTextBox function, the
  278. * funtion does not update the right coordinate (bottom coordinate if
  279. * kTXNUseVerticalTextMask is used) of the specified rectangle to
  280. * accommodate the longest line for text.
  281. */
  282. kTXNDontUpdateBoxRectMask = 1L << kTXNDontUpdateBoxRectBit,
  283. /*
  284. * Indicates that the size of the text will be returned but the text
  285. * box will not be drawn.
  286. */
  287. kTXNDontDrawTextMask = 1L << kTXNDontDrawTextBit,
  288. /*
  289. * Indicates that the client has provided a CGContext to be used for
  290. * CG imaging inside the text box. [X-only]
  291. */
  292. kTXNUseCGContextRefMask = 1L << kTXNUseCGContextRefBit,
  293. /*
  294. * Indicates that imaging will be done using QuickDraw instead of the
  295. * default CoreGraphics. [X-only]
  296. */
  297. kTXNImageWithQDMask = 1L << kTXNImageWithQDBit,
  298. /*
  299. * Indicates that text should not be wrapped. [X-only]
  300. */
  301. kTXNDontWrapTextMask = 1L << kTXNDontWrapTextBit
  302. };
  303. struct TXNTextBoxOptionsData {
  304. TXNTextBoxOptions optionTags;
  305. Fract flushness;
  306. Fract justification;
  307. Fixed rotation;
  308. void * options; /* for future use*/
  309. };
  310. typedef struct TXNTextBoxOptionsData TXNTextBoxOptionsData;
  311. enum {
  312. kTXNFontContinuousBit = 0,
  313. kTXNSizeContinuousBit = 1,
  314. kTXNStyleContinuousBit = 2,
  315. kTXNColorContinuousBit = 3
  316. };
  317. typedef OptionBits TXNContinuousFlags;
  318. enum {
  319. kTXNFontContinuousMask = 1L << kTXNFontContinuousBit,
  320. kTXNSizeContinuousMask = 1L << kTXNSizeContinuousBit,
  321. kTXNStyleContinuousMask = 1L << kTXNStyleContinuousBit,
  322. kTXNColorContinuousMask = 1L << kTXNColorContinuousBit
  323. };
  324. enum {
  325. kTXNIgnoreCaseBit = 0,
  326. kTXNEntireWordBit = 1,
  327. kTXNUseEncodingWordRulesBit = 31
  328. };
  329. typedef OptionBits TXNMatchOptions;
  330. enum {
  331. kTXNIgnoreCaseMask = 1L << kTXNIgnoreCaseBit,
  332. kTXNEntireWordMask = 1L << kTXNEntireWordBit,
  333. kTXNUseEncodingWordRulesMask = (unsigned long)(1L << kTXNUseEncodingWordRulesBit)
  334. };
  335. typedef OSType TXNFileType;
  336. enum {
  337. kTXNTextensionFile = FOUR_CHAR_CODE('txtn'),
  338. kTXNTextFile = FOUR_CHAR_CODE('TEXT'),
  339. kTXNPictureFile = FOUR_CHAR_CODE('PICT'),
  340. kTXNMovieFile = FOUR_CHAR_CODE('MooV'),
  341. kTXNSoundFile = FOUR_CHAR_CODE('sfil'),
  342. kTXNAIFFFile = FOUR_CHAR_CODE('AIFF'),
  343. kTXNUnicodeTextFile = FOUR_CHAR_CODE('utxt')
  344. };
  345. /* Only kTXNTextEditStyleFrameType is supported at this time */
  346. typedef UInt32 TXNFrameType;
  347. enum {
  348. kTXNTextEditStyleFrameType = 1,
  349. kTXNPageFrameType = 2, /* not supported*/
  350. kTXNMultipleFrameType = 3 /* not supported*/
  351. };
  352. typedef OSType TXNDataType;
  353. enum {
  354. kTXNTextData = FOUR_CHAR_CODE('TEXT'),
  355. kTXNPictureData = FOUR_CHAR_CODE('PICT'),
  356. kTXNMovieData = FOUR_CHAR_CODE('moov'),
  357. kTXNSoundData = FOUR_CHAR_CODE('snd '),
  358. kTXNUnicodeTextData = FOUR_CHAR_CODE('utxt')
  359. };
  360. typedef FourCharCode TXNControlTag;
  361. enum {
  362. kTXNLineDirectionTag = FOUR_CHAR_CODE('lndr'),
  363. kTXNJustificationTag = FOUR_CHAR_CODE('just'),
  364. kTXNIOPrivilegesTag = FOUR_CHAR_CODE('iopv'),
  365. kTXNSelectionStateTag = FOUR_CHAR_CODE('slst'),
  366. kTXNInlineStateTag = FOUR_CHAR_CODE('inst'),
  367. kTXNWordWrapStateTag = FOUR_CHAR_CODE('wwrs'),
  368. kTXNKeyboardSyncStateTag = FOUR_CHAR_CODE('kbsy'),
  369. kTXNAutoIndentStateTag = FOUR_CHAR_CODE('auin'),
  370. kTXNTabSettingsTag = FOUR_CHAR_CODE('tabs'),
  371. kTXNRefConTag = FOUR_CHAR_CODE('rfcn'),
  372. kTXNMarginsTag = FOUR_CHAR_CODE('marg'),
  373. kTXNFlattenMoviesTag = FOUR_CHAR_CODE('flat'),
  374. kTXNDoFontSubstitution = FOUR_CHAR_CODE('fSub'), /*note : this could degrade performance greatly in the case of large documents.*/
  375. kTXNNoUserIOTag = FOUR_CHAR_CODE('nuio'),
  376. kTXNUseCarbonEvents = FOUR_CHAR_CODE('cbcb'),
  377. kTXNDrawCaretWhenInactiveTag = FOUR_CHAR_CODE('dcrt'),
  378. kTXNDrawSelectionWhenInactiveTag = FOUR_CHAR_CODE('dsln'),
  379. kTXNDisableDragAndDropTag = FOUR_CHAR_CODE('drag'),
  380. kTXNSingleLevelUndoTag = FOUR_CHAR_CODE('undo'),
  381. kTXNVisibilityTag = FOUR_CHAR_CODE('visb') /*set the visibility state of the object*/
  382. };
  383. typedef UInt32 TXNActionKey;
  384. enum {
  385. kTXNTypingAction = 0,
  386. kTXNCutAction = 1,
  387. kTXNPasteAction = 2,
  388. kTXNClearAction = 3,
  389. kTXNChangeFontAction = 4,
  390. kTXNChangeFontColorAction = 5,
  391. kTXNChangeFontSizeAction = 6,
  392. kTXNChangeStyleAction = 7,
  393. kTXNAlignLeftAction = 8,
  394. kTXNAlignCenterAction = 9,
  395. kTXNAlignRightAction = 10,
  396. kTXNDropAction = 11,
  397. kTXNMoveAction = 12,
  398. kTXNFontFeatureAction = 13,
  399. kTXNFontVariationAction = 14,
  400. kTXNUndoLastAction = 1024 /*use if none of the above apply*/
  401. };
  402. enum {
  403. kTXNClearThisControl = (long)0xFFFFFFFF,
  404. kTXNClearTheseFontFeatures = (long)0x80000000
  405. };
  406. /*
  407. convenience constants for TXNGet/SetTXNControls
  408. kTXNIOPrivilegesTag
  409. */
  410. enum {
  411. kTXNReadWrite = false,
  412. kTXNReadOnly = true
  413. };
  414. /* kTXNSelectionStateTag*/
  415. enum {
  416. kTXNSelectionOn = true,
  417. kTXNSelectionOff = false
  418. };
  419. /* kTXNInlineStateTag*/
  420. enum {
  421. kTXNUseInline = false,
  422. kTXNUseBottomline = true
  423. };
  424. /* kTXNWordWrapStateTag*/
  425. enum {
  426. kTXNAutoWrap = false,
  427. kTXNNoAutoWrap = true
  428. };
  429. /* kTXNKeyboardSyncStateTag*/
  430. enum {
  431. kTXNSyncKeyboard = false,
  432. kTXNNoSyncKeyboard = true
  433. };
  434. /* kTXNAutoIndentStateTag*/
  435. enum {
  436. kTXNAutoIndentOff = false,
  437. kTXNAutoIndentOn = true
  438. };
  439. /* kTXNDrawCaretWhenInactiveTag*/
  440. enum {
  441. kTXNDontDrawCaretWhenInactive = false,
  442. kTXNDrawCaretWhenInactive = true
  443. };
  444. /* kTXNDrawSelectionWhenInactiveTag*/
  445. enum {
  446. kTXNDontDrawSelectionWhenInactive = false,
  447. kTXNDrawSelectionWhenInactive = true
  448. };
  449. /* kTXNDisableDragAndDropTag*/
  450. enum {
  451. kTXNEnableDragAndDrop = false,
  452. kTXNDisableDragAndDrop = true
  453. };
  454. typedef SInt8 TXNTabType;
  455. enum {
  456. kTXNRightTab = -1,
  457. kTXNLeftTab = 0,
  458. kTXNCenterTab = 1
  459. };
  460. struct TXNTab {
  461. SInt16 value;
  462. TXNTabType tabType;
  463. UInt8 filler;
  464. };
  465. typedef struct TXNTab TXNTab;
  466. enum {
  467. kTXNLeftToRight = 0,
  468. kTXNRightToLeft = 1
  469. };
  470. enum {
  471. kTXNFlushDefault = 0, /*flush according to the line direction */
  472. kTXNFlushLeft = 1,
  473. kTXNFlushRight = 2,
  474. kTXNCenter = 4,
  475. kTXNFullJust = 8,
  476. kTXNForceFullJust = 16 /*flush left for all scripts */
  477. };
  478. /*
  479. In version 1.2 of MLTE and later you can change the top, left and right margins.
  480. The bottom margin is a placeholder for possible future enhancements.
  481. */
  482. struct TXNMargins {
  483. SInt16 topMargin;
  484. SInt16 leftMargin;
  485. SInt16 bottomMargin;
  486. SInt16 rightMargin;
  487. };
  488. typedef struct TXNMargins TXNMargins;
  489. union TXNControlData {
  490. UInt32 uValue;
  491. SInt32 sValue;
  492. TXNTab tabValue;
  493. TXNMargins * marginsPtr;
  494. };
  495. typedef union TXNControlData TXNControlData;
  496. typedef Boolean TXNScrollBarState;
  497. enum {
  498. kScrollBarsAlwaysActive = true,
  499. kScrollBarsSyncWithFocus = false
  500. };
  501. /*
  502. kTXNNoFontVariations is returned in the dataValue field when the caller as asked
  503. to see if the variation is continuous and there was no variation in the continuous range
  504. */
  505. enum {
  506. kTXNDontCareTypeSize = (long)0xFFFFFFFF,
  507. kTXNDontCareTypeStyle = 0xFF,
  508. kTXNIncrementTypeSize = 0x00000001,
  509. kTXNDecrementTypeSize = (long)0x80000000,
  510. kTXNUseScriptDefaultValue = -1,
  511. kTXNNoFontVariations = 0x7FFF
  512. };
  513. typedef UInt32 TXNOffset;
  514. enum {
  515. kTXNUseCurrentSelection = (unsigned long)0xFFFFFFFF,
  516. kTXNStartOffset = 0,
  517. kTXNEndOffset = 0x7FFFFFFF
  518. };
  519. enum {
  520. kTXNSingleStylePerTextDocumentResType = FOUR_CHAR_CODE('MPSR'),
  521. kTXNMultipleStylesPerTextDocumentResType = FOUR_CHAR_CODE('styl')
  522. };
  523. typedef void * TXNObjectRefcon;
  524. /*constants for TXNShowSelection*/
  525. enum {
  526. kTXNShowStart = false,
  527. kTXNShowEnd = true
  528. };
  529. typedef OSStatus TXNErrors;
  530. /*default constants for TXTNInit. */
  531. #define kTXNDefaultFontName ((StringPtr)NULL)
  532. enum {
  533. kTXNDefaultFontSize = 0x000C0000
  534. };
  535. enum {
  536. kTXNDefaultFontStyle = normal
  537. };
  538. typedef UInt32 TXNHyperLinkState;
  539. enum {
  540. kTXNLinkNotPressed = 0,
  541. kTXNLinkWasPressed = 1,
  542. kTXNLinkTracking = 3
  543. };
  544. typedef FourCharCode TXNTypeRunAttributes;
  545. enum {
  546. kTXNQDFontNameAttribute = FOUR_CHAR_CODE('fntn'),
  547. kTXNQDFontFamilyIDAttribute = FOUR_CHAR_CODE('font'),
  548. kTXNQDFontSizeAttribute = FOUR_CHAR_CODE('size'),
  549. kTXNQDFontStyleAttribute = FOUR_CHAR_CODE('face'),
  550. kTXNQDFontColorAttribute = FOUR_CHAR_CODE('klor'),
  551. kTXNTextEncodingAttribute = FOUR_CHAR_CODE('encd'),
  552. kTXNATSUIFontFeaturesAttribute = FOUR_CHAR_CODE('atfe'),
  553. kTXNATSUIFontVariationsAttribute = FOUR_CHAR_CODE('atva'),
  554. kTXNURLAttribute = FOUR_CHAR_CODE('urla')
  555. };
  556. /*
  557. kTXNQDFontSizeAttributeSize is obsolete and incorrect
  558. font sizes are always returned as a Fixed value, just as
  559. they are passed to MLTE. Use kTXNFontSizeAttributeSize.
  560. */
  561. typedef ByteCount TXNTypeRunAttributeSizes;
  562. enum {
  563. kTXNQDFontNameAttributeSize = sizeof(Str255),
  564. kTXNQDFontFamilyIDAttributeSize = sizeof(SInt16),
  565. kTXNQDFontSizeAttributeSize = sizeof(SInt16),
  566. kTXNQDFontStyleAttributeSize = sizeof(Style),
  567. kTXNQDFontColorAttributeSize = sizeof(RGBColor),
  568. kTXNTextEncodingAttributeSize = sizeof(TextEncoding),
  569. kTXNFontSizeAttributeSize = sizeof(Fixed)
  570. };
  571. typedef UInt32 TXNPermanentTextEncodingType;
  572. enum {
  573. kTXNSystemDefaultEncoding = 0,
  574. kTXNMacOSEncoding = 1,
  575. kTXNUnicodeEncoding = 2
  576. };
  577. typedef FourCharCode TXTNTag;
  578. struct TXNATSUIFeatures {
  579. ItemCount featureCount;
  580. ATSUFontFeatureType * featureTypes;
  581. ATSUFontFeatureSelector * featureSelectors;
  582. };
  583. typedef struct TXNATSUIFeatures TXNATSUIFeatures;
  584. struct TXNATSUIVariations {
  585. ItemCount variationCount;
  586. ATSUFontVariationAxis * variationAxis;
  587. ATSUFontVariationValue * variationValues;
  588. };
  589. typedef struct TXNATSUIVariations TXNATSUIVariations;
  590. union TXNAttributeData {
  591. void * dataPtr;
  592. UInt32 dataValue;
  593. TXNATSUIFeatures * atsuFeatures;
  594. TXNATSUIVariations * atsuVariations;
  595. CFURLRef urlReference;
  596. };
  597. typedef union TXNAttributeData TXNAttributeData;
  598. struct TXNTypeAttributes {
  599. TXTNTag tag;
  600. ByteCount size;
  601. TXNAttributeData data;
  602. };
  603. typedef struct TXNTypeAttributes TXNTypeAttributes;
  604. struct TXNMacOSPreferredFontDescription {
  605. UInt32 fontID;
  606. Fixed pointSize;
  607. TextEncoding encoding;
  608. Style fontStyle;
  609. };
  610. typedef struct TXNMacOSPreferredFontDescription TXNMacOSPreferredFontDescription;
  611. struct TXNMatchTextRecord {
  612. const void * iTextPtr;
  613. SInt32 iTextToMatchLength;
  614. TextEncoding iTextEncoding;
  615. };
  616. typedef struct TXNMatchTextRecord TXNMatchTextRecord;
  617. /*constants & typedefs for setting the background*/
  618. typedef UInt32 TXNBackgroundType;
  619. enum {
  620. kTXNBackgroundTypeRGB = 1
  621. };
  622. /*
  623. The TXNBackgroundData is left as a union so that it can be expanded
  624. in the future to support other background types
  625. */
  626. union TXNBackgroundData {
  627. RGBColor color;
  628. };
  629. typedef union TXNBackgroundData TXNBackgroundData;
  630. struct TXNBackground {
  631. TXNBackgroundType bgType;
  632. TXNBackgroundData bg;
  633. };
  634. typedef struct TXNBackground TXNBackground;
  635. struct TXNLongRect {
  636. SInt32 top;
  637. SInt32 left;
  638. SInt32 bottom;
  639. SInt32 right;
  640. };
  641. typedef struct TXNLongRect TXNLongRect;
  642. /*
  643. options for TXNGet/ClearActionChangeCount to decide what type(s) of action
  644. count to use
  645. */
  646. enum {
  647. kTXNTextInputCountBit = 0,
  648. kTXNRunCountBit = 1
  649. };
  650. typedef OptionBits TXNCountOptions;
  651. enum {
  652. kTXNTextInputCountMask = 1L << kTXNTextInputCountBit,
  653. kTXNRunCountMask = 1L << kTXNRunCountBit,
  654. kTXNAllCountMask = kTXNTextInputCountMask | kTXNRunCountMask
  655. };
  656. typedef UInt32 TXNScrollUnit;
  657. enum {
  658. kTXNScrollUnitsInPixels = 0,
  659. kTXNScrollUnitsInLines = 1,
  660. kTXNScrollUnitsInViewRects = 2
  661. };
  662. typedef UInt32 TXNScrollBarOrientation;
  663. enum {
  664. kTXNHorizontal = 0,
  665. kTXNVertical = 1
  666. };
  667. typedef CALLBACK_API( OSStatus , TXNFindProcPtr )(const TXNMatchTextRecord *matchData, TXNDataType iDataType, TXNMatchOptions iMatchOptions, const void *iSearchTextPtr, TextEncoding encoding, TXNOffset absStartOffset, ByteCount searchTextLength, TXNOffset *oStartMatch, TXNOffset *oEndMatch, Boolean *ofound, UInt32 refCon);
  668. typedef CALLBACK_API( CFStringRef , TXNActionKeyMapperProcPtr )(TXNActionKey actionKey, UInt32 commandID);
  669. typedef CALLBACK_API( void , TXNScrollInfoProcPtr )(SInt32 iValue, SInt32 iMaximumValue, TXNScrollBarOrientation iScrollBarOrientation, SInt32 iRefCon);
  670. typedef STACK_UPP_TYPE(TXNFindProcPtr) TXNFindUPP;
  671. typedef STACK_UPP_TYPE(TXNActionKeyMapperProcPtr) TXNActionKeyMapperUPP;
  672. typedef STACK_UPP_TYPE(TXNScrollInfoProcPtr) TXNScrollInfoUPP;
  673. /*
  674. * NewTXNFindUPP()
  675. *
  676. * Availability:
  677. * Non-Carbon CFM: available as macro/inline
  678. * CarbonLib: in CarbonLib 1.0 and later
  679. * Mac OS X: in version 10.0 and later
  680. */
  681. EXTERN_API_C( TXNFindUPP )
  682. NewTXNFindUPP(TXNFindProcPtr userRoutine);
  683. #if !OPAQUE_UPP_TYPES
  684. enum { uppTXNFindProcInfo = 0x0FFFFFF0 }; /* pascal 4_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  685. #ifdef __cplusplus
  686. inline DEFINE_API_C(TXNFindUPP) NewTXNFindUPP(TXNFindProcPtr userRoutine) { return (TXNFindUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTXNFindProcInfo, GetCurrentArchitecture()); }
  687. #else
  688. #define NewTXNFindUPP(userRoutine) (TXNFindUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTXNFindProcInfo, GetCurrentArchitecture())
  689. #endif
  690. #endif
  691. /*
  692. * NewTXNActionKeyMapperUPP()
  693. *
  694. * Availability:
  695. * Non-Carbon CFM: available as macro/inline
  696. * CarbonLib: in CarbonLib 1.3 and later
  697. * Mac OS X: in version 10.0 and later
  698. */
  699. EXTERN_API_C( TXNActionKeyMapperUPP )
  700. NewTXNActionKeyMapperUPP(TXNActionKeyMapperProcPtr userRoutine);
  701. #if !OPAQUE_UPP_TYPES
  702. enum { uppTXNActionKeyMapperProcInfo = 0x000003F0 }; /* pascal 4_bytes Func(4_bytes, 4_bytes) */
  703. #ifdef __cplusplus
  704. inline DEFINE_API_C(TXNActionKeyMapperUPP) NewTXNActionKeyMapperUPP(TXNActionKeyMapperProcPtr userRoutine) { return (TXNActionKeyMapperUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTXNActionKeyMapperProcInfo, GetCurrentArchitecture()); }
  705. #else
  706. #define NewTXNActionKeyMapperUPP(userRoutine) (TXNActionKeyMapperUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTXNActionKeyMapperProcInfo, GetCurrentArchitecture())
  707. #endif
  708. #endif
  709. /*
  710. * NewTXNScrollInfoUPP()
  711. *
  712. * Availability:
  713. * Non-Carbon CFM: available as macro/inline
  714. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
  715. * Mac OS X: in version 10.1 and later
  716. */
  717. EXTERN_API_C( TXNScrollInfoUPP )
  718. NewTXNScrollInfoUPP(TXNScrollInfoProcPtr userRoutine);
  719. #if !OPAQUE_UPP_TYPES
  720. enum { uppTXNScrollInfoProcInfo = 0x00003FC0 }; /* pascal no_return_value Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  721. #ifdef __cplusplus
  722. inline DEFINE_API_C(TXNScrollInfoUPP) NewTXNScrollInfoUPP(TXNScrollInfoProcPtr userRoutine) { return (TXNScrollInfoUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTXNScrollInfoProcInfo, GetCurrentArchitecture()); }
  723. #else
  724. #define NewTXNScrollInfoUPP(userRoutine) (TXNScrollInfoUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTXNScrollInfoProcInfo, GetCurrentArchitecture())
  725. #endif
  726. #endif
  727. /*
  728. * DisposeTXNFindUPP()
  729. *
  730. * Availability:
  731. * Non-Carbon CFM: available as macro/inline
  732. * CarbonLib: in CarbonLib 1.0 and later
  733. * Mac OS X: in version 10.0 and later
  734. */
  735. EXTERN_API_C( void )
  736. DisposeTXNFindUPP(TXNFindUPP userUPP);
  737. #if !OPAQUE_UPP_TYPES
  738. #ifdef __cplusplus
  739. inline DEFINE_API_C(void) DisposeTXNFindUPP(TXNFindUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  740. #else
  741. #define DisposeTXNFindUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  742. #endif
  743. #endif
  744. /*
  745. * DisposeTXNActionKeyMapperUPP()
  746. *
  747. * Availability:
  748. * Non-Carbon CFM: available as macro/inline
  749. * CarbonLib: in CarbonLib 1.3 and later
  750. * Mac OS X: in version 10.0 and later
  751. */
  752. EXTERN_API_C( void )
  753. DisposeTXNActionKeyMapperUPP(TXNActionKeyMapperUPP userUPP);
  754. #if !OPAQUE_UPP_TYPES
  755. #ifdef __cplusplus
  756. inline DEFINE_API_C(void) DisposeTXNActionKeyMapperUPP(TXNActionKeyMapperUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  757. #else
  758. #define DisposeTXNActionKeyMapperUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  759. #endif
  760. #endif
  761. /*
  762. * DisposeTXNScrollInfoUPP()
  763. *
  764. * Availability:
  765. * Non-Carbon CFM: available as macro/inline
  766. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
  767. * Mac OS X: in version 10.1 and later
  768. */
  769. EXTERN_API_C( void )
  770. DisposeTXNScrollInfoUPP(TXNScrollInfoUPP userUPP);
  771. #if !OPAQUE_UPP_TYPES
  772. #ifdef __cplusplus
  773. inline DEFINE_API_C(void) DisposeTXNScrollInfoUPP(TXNScrollInfoUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  774. #else
  775. #define DisposeTXNScrollInfoUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  776. #endif
  777. #endif
  778. /*
  779. * InvokeTXNFindUPP()
  780. *
  781. * Availability:
  782. * Non-Carbon CFM: available as macro/inline
  783. * CarbonLib: in CarbonLib 1.0 and later
  784. * Mac OS X: in version 10.0 and later
  785. */
  786. EXTERN_API_C( OSStatus )
  787. InvokeTXNFindUPP(
  788. const TXNMatchTextRecord * matchData,
  789. TXNDataType iDataType,
  790. TXNMatchOptions iMatchOptions,
  791. const void * iSearchTextPtr,
  792. TextEncoding encoding,
  793. TXNOffset absStartOffset,
  794. ByteCount searchTextLength,
  795. TXNOffset * oStartMatch,
  796. TXNOffset * oEndMatch,
  797. Boolean * ofound,
  798. UInt32 refCon,
  799. TXNFindUPP userUPP);
  800. #if !OPAQUE_UPP_TYPES
  801. #ifdef __cplusplus
  802. inline DEFINE_API_C(OSStatus) InvokeTXNFindUPP(const TXNMatchTextRecord * matchData, TXNDataType iDataType, TXNMatchOptions iMatchOptions, const void * iSearchTextPtr, TextEncoding encoding, TXNOffset absStartOffset, ByteCount searchTextLength, TXNOffset * oStartMatch, TXNOffset * oEndMatch, Boolean * ofound, UInt32 refCon, TXNFindUPP userUPP) { return (OSStatus)CALL_ELEVEN_PARAMETER_UPP(userUPP, uppTXNFindProcInfo, matchData, iDataType, iMatchOptions, iSearchTextPtr, encoding, absStartOffset, searchTextLength, oStartMatch, oEndMatch, ofound, refCon); }
  803. #else
  804. #define InvokeTXNFindUPP(matchData, iDataType, iMatchOptions, iSearchTextPtr, encoding, absStartOffset, searchTextLength, oStartMatch, oEndMatch, ofound, refCon, userUPP) (OSStatus)CALL_ELEVEN_PARAMETER_UPP((userUPP), uppTXNFindProcInfo, (matchData), (iDataType), (iMatchOptions), (iSearchTextPtr), (encoding), (absStartOffset), (searchTextLength), (oStartMatch), (oEndMatch), (ofound), (refCon))
  805. #endif
  806. #endif
  807. /*
  808. * InvokeTXNActionKeyMapperUPP()
  809. *
  810. * Availability:
  811. * Non-Carbon CFM: available as macro/inline
  812. * CarbonLib: in CarbonLib 1.3 and later
  813. * Mac OS X: in version 10.0 and later
  814. */
  815. EXTERN_API_C( CFStringRef )
  816. InvokeTXNActionKeyMapperUPP(
  817. TXNActionKey actionKey,
  818. UInt32 commandID,
  819. TXNActionKeyMapperUPP userUPP);
  820. #if !OPAQUE_UPP_TYPES
  821. #ifdef __cplusplus
  822. inline DEFINE_API_C(CFStringRef) InvokeTXNActionKeyMapperUPP(TXNActionKey actionKey, UInt32 commandID, TXNActionKeyMapperUPP userUPP) { return (CFStringRef)CALL_TWO_PARAMETER_UPP(userUPP, uppTXNActionKeyMapperProcInfo, actionKey, commandID); }
  823. #else
  824. #define InvokeTXNActionKeyMapperUPP(actionKey, commandID, userUPP) (CFStringRef)CALL_TWO_PARAMETER_UPP((userUPP), uppTXNActionKeyMapperProcInfo, (actionKey), (commandID))
  825. #endif
  826. #endif
  827. /*
  828. * InvokeTXNScrollInfoUPP()
  829. *
  830. * Availability:
  831. * Non-Carbon CFM: available as macro/inline
  832. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
  833. * Mac OS X: in version 10.1 and later
  834. */
  835. EXTERN_API_C( void )
  836. InvokeTXNScrollInfoUPP(
  837. SInt32 iValue,
  838. SInt32 iMaximumValue,
  839. TXNScrollBarOrientation iScrollBarOrientation,
  840. SInt32 iRefCon,
  841. TXNScrollInfoUPP userUPP);
  842. #if !OPAQUE_UPP_TYPES
  843. #ifdef __cplusplus
  844. inline DEFINE_API_C(void) InvokeTXNScrollInfoUPP(SInt32 iValue, SInt32 iMaximumValue, TXNScrollBarOrientation iScrollBarOrientation, SInt32 iRefCon, TXNScrollInfoUPP userUPP) { CALL_FOUR_PARAMETER_UPP(userUPP, uppTXNScrollInfoProcInfo, iValue, iMaximumValue, iScrollBarOrientation, iRefCon); }
  845. #else
  846. #define InvokeTXNScrollInfoUPP(iValue, iMaximumValue, iScrollBarOrientation, iRefCon, userUPP) CALL_FOUR_PARAMETER_UPP((userUPP), uppTXNScrollInfoProcInfo, (iValue), (iMaximumValue), (iScrollBarOrientation), (iRefCon))
  847. #endif
  848. #endif
  849. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  850. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  851. #define NewTXNFindProc(userRoutine) NewTXNFindUPP(userRoutine)
  852. #define NewTXNActionKeyMapperProc(userRoutine) NewTXNActionKeyMapperUPP(userRoutine)
  853. #define NewTXNScrollInfoProc(userRoutine) NewTXNScrollInfoUPP(userRoutine)
  854. #define CallTXNFindProc(userRoutine, matchData, iDataType, iMatchOptions, iSearchTextPtr, encoding, absStartOffset, searchTextLength, oStartMatch, oEndMatch, ofound, refCon) InvokeTXNFindUPP(matchData, iDataType, iMatchOptions, iSearchTextPtr, encoding, absStartOffset, searchTextLength, oStartMatch, oEndMatch, ofound, refCon, userRoutine)
  855. #define CallTXNActionKeyMapperProc(userRoutine, actionKey, commandID) InvokeTXNActionKeyMapperUPP(actionKey, commandID, userRoutine)
  856. #define CallTXNScrollInfoProc(userRoutine, iValue, iMaximumValue, iScrollBarOrientation, iRefCon) InvokeTXNScrollInfoUPP(iValue, iMaximumValue, iScrollBarOrientation, iRefCon, userRoutine)
  857. #endif /* CALL_NOT_IN_CARBON */
  858. /*
  859. These are currently the only settings for the flags field of TXNCarbonEventInfo
  860. If you want the AppleEventHandlers removed use kTXNNoAppleEventHandlersMask.
  861. If you want to subsequently restart AppleEvent Handlers after removing
  862. your Texthandlers. Use kTXNRestartAppleEventHandlersMask.
  863. */
  864. enum {
  865. kTXNNoAppleEventHandlersBit = 0,
  866. kTXNRestartAppleEventHandlersBit = 1
  867. };
  868. enum {
  869. kTXNNoAppleEventHandlersMask = 1 << kTXNNoAppleEventHandlersBit,
  870. kTXNRestartAppleEventHandlersMask = 1 << kTXNRestartAppleEventHandlersBit
  871. };
  872. /*dictionary keys currently supported in the TXNCarbonEventInfo dictionary*/
  873. #define kTXNTextHandlerKey CFSTR("TextInput")
  874. #define kTXNWindowEventHandlerKey CFSTR("WindowEvent")
  875. #define kTXNWindowResizeEventHandlerKey CFSTR("WindowResize")
  876. #define kTXNCommandTargetKey CFSTR("CommandTarget")
  877. #define kTXNCommandUpdateKey CFSTR("CommandUpdate")
  878. #define kTXNFontMenuRefKey CFSTR("FontMenuRef")
  879. #define kTXNFontMenuObjectKey CFSTR("FontMenuObject")
  880. #define kTXNActionKeyMapperKey CFSTR("ActionKeyMapper")
  881. #define kTXNWheelMouseEventHandlerKey CFSTR("WheelMouseEvent")
  882. /* use this to pass an EventTargetRef to MLTE via the TXNSetTXNControl... call*/
  883. struct TXNCarbonEventInfo {
  884. Boolean useCarbonEvents;
  885. UInt8 filler;
  886. UInt16 flags;
  887. CFDictionaryRef fDictionary;
  888. };
  889. typedef struct TXNCarbonEventInfo TXNCarbonEventInfo;
  890. /*
  891. *****************************************************************************************************
  892. Allocates a new frame (i.e. new is called to allocate a TXNObject) and returns a pointer to the object
  893. in the newDoc parameter.
  894. Input:
  895. iFileSpec: If not NULL the file is read to obtain the document contents after the object is
  896. successfully allocated. If NULL you start with an empty document.
  897. iWindow: Required. The window in which the document is going to be displayed.
  898. iFrame: If text-area does not fill the entire window. This specifies the area to fill. Can be NULL.
  899. In which case, the window's portRect is used as the frame.
  900. iFrameOptions: Specify the options to be supported by this frame. The available options are support
  901. for cutting and pasting movies and sound, handle scrollbars and handle grow box in the
  902. frame.
  903. iFrameType: Specify the type of frame to be used. In MLTE version 1.1 and earlier, only
  904. kTXNTextEditStyleFrameType is supported.
  905. iFileType: Specify the primary file type. If you use kTextensionTextFile files will be saved
  906. in a private format (see xxx). If you want saved files to be plain text files you should
  907. specify 'TEXT' here. If you specify 'TEXT' here you can use the frameOptions parameter to
  908. specify whether the TEXT files should be saved with 'MPSR' resources or 'styl' resources.
  909. These are resources which contain style information for a file, and they both have there
  910. own limitations. If you use 'styl' resources to save style info your documents can have as
  911. many styles as you like however tabs will not be saved. If you use 'MPSR' resources only the
  912. first style in the document will be saved (you as client are expected to apply all style
  913. changes to the entire document). If you truly want rich documents which can potentially
  914. contain graphics and sound you should specify kTextensionTextFileOutput. If you want a plain
  915. text editor like SimpleText specify that style information by saved via 'styl' resources.
  916. If you want files similar to those output by CW IDE, BBEdit, and MPW specify that style
  917. information be saved in a 'MPSR' resource.
  918. Output:
  919. OSStatus: function result. If anything goes wrong the error is returned. Success must be complete.
  920. That is if everything works, but there is a failure reading a specified file the object
  921. is freed.
  922. oTXNObject: Pointer to the opaque datastructure allocated by the function. Most of the subsequent
  923. functions require that such a pointer be passed in.
  924. oTXNFrameID: Unique ID for the frame. <Note in version 1.0 this value is always set to 0>
  925. iRefCon: Caller can set this to any value. It is retained by the
  926. TXNNewObject which can later be asked to return it.
  927. **************************************************************************************************************
  928. */
  929. /*
  930. * TXNNewObject()
  931. *
  932. * Availability:
  933. * Non-Carbon CFM: in Textension 1.0 and later
  934. * CarbonLib: in CarbonLib 1.0 and later
  935. * Mac OS X: in version 10.0 and later
  936. */
  937. EXTERN_API_C( OSStatus )
  938. TXNNewObject(
  939. const FSSpec * iFileSpec, /* can be NULL */
  940. WindowRef iWindow,
  941. const Rect * iFrame, /* can be NULL */
  942. TXNFrameOptions iFrameOptions,
  943. TXNFrameType iFrameType,
  944. TXNFileType iFileType,
  945. TXNPermanentTextEncodingType iPermanentEncoding,
  946. TXNObject * oTXNObject,
  947. TXNFrameID * oTXNFrameID,
  948. TXNObjectRefcon iRefCon);
  949. /*
  950. *************************************************************************************************
  951. Delete a previously allocated TXNObject and all associated data structures. If the frameType is
  952. multiple frames all frames are released.
  953. Input:
  954. iTXNObject: opaque structure to free.
  955. **************************************************************************************************
  956. */
  957. /*
  958. * TXNDeleteObject()
  959. *
  960. * Availability:
  961. * Non-Carbon CFM: in Textension 1.0 and later
  962. * CarbonLib: in CarbonLib 1.0 and later
  963. * Mac OS X: in version 10.0 and later
  964. */
  965. EXTERN_API_C( void )
  966. TXNDeleteObject(TXNObject iTXNObject);
  967. /*
  968. *************************************************************************************************
  969. Changes the frame's size to match the new width and height.
  970. Input:
  971. iTXNObject: opaque Textension structure.
  972. iWidth: New width in pixels.
  973. iHeight: New height in pixels.
  974. iTXNFrameID: FrameID that specifies the frame to move.
  975. *************************************************************************************************
  976. */
  977. /*
  978. * TXNResizeFrame()
  979. *
  980. * Availability:
  981. * Non-Carbon CFM: in Textension 1.0 and later
  982. * CarbonLib: in CarbonLib 1.0 and later
  983. * Mac OS X: in version 10.0 and later
  984. */
  985. EXTERN_API_C( void )
  986. TXNResizeFrame(
  987. TXNObject iTXNObject,
  988. UInt32 iWidth,
  989. UInt32 iHeight,
  990. TXNFrameID iTXNFrameID);
  991. /*
  992. *************************************************************************************************
  993. Changes the frame's bounds to match the Rect.
  994. Input:
  995. iTXNObject : opaque Textension structure.
  996. (iTop, iLeft, iBottom, iRight): Rect of the view
  997. iTXNFrameID: FrameID that specifies the frame to move.
  998. *************************************************************************************************
  999. */
  1000. /*
  1001. * TXNSetFrameBounds()
  1002. *
  1003. * Availability:
  1004. * Non-Carbon CFM: in Textension 1.0 and later
  1005. * CarbonLib: in CarbonLib 1.0 and later
  1006. * Mac OS X: in version 10.0 and later
  1007. */
  1008. EXTERN_API_C( void )
  1009. TXNSetFrameBounds(
  1010. TXNObject iTXNObject,
  1011. SInt32 iTop,
  1012. SInt32 iLeft,
  1013. SInt32 iBottom,
  1014. SInt32 iRight,
  1015. TXNFrameID iTXNFrameID);
  1016. /*
  1017. ****************************************************************************************************
  1018. Initialize the Textension library. Should be called as soon as possible after the Macintosh toolbox
  1019. is initialized.
  1020. Input:
  1021. iDefaultFonts: A table of font information including fontFamily ID, point size,
  1022. style, and script code. The table can be NULL or can have
  1023. an entry for any script for which you would like to to
  1024. designate a default font. Only a valid script number is
  1025. required. You can designate that Textension should use
  1026. the default for a give script by setting the field to kTXNUseScriptDefaultValue (-1).
  1027. For example, if you wanted to specify New York as the default
  1028. font to use for Roman scripts, but were happy with the
  1029. default style and size you would call the function like this:
  1030. TXNMacOSPreferredFontDescription defaults;
  1031. GetFNum( "\pNew York", &defaults.fontFamilyID );
  1032. defaults.pointSize = kTXNDefaultFontSize;
  1033. defaults.fontStyle = kTXNDefaultFontStyle;
  1034. defaults.script = smRoman;
  1035. status = TXNInitTextension( &defaults, 1, 0 );
  1036. iCountDefaultFonts: Count of entries in the iDefaultFonts parameter.
  1037. iUsageFlags: Specify whether sound and movies should be supported.
  1038. Output:
  1039. OSStatus: Function result. NoErr if everything initialized correctly. Variety of
  1040. possible MacOS errors if something goes wrong.
  1041. *********************************************************************************************|
  1042. */
  1043. /*
  1044. * TXNInitTextension()
  1045. *
  1046. * Availability:
  1047. * Non-Carbon CFM: in Textension 1.0 and later
  1048. * CarbonLib: in CarbonLib 1.0 and later
  1049. * Mac OS X: in version 10.0 and later
  1050. */
  1051. EXTERN_API_C( OSStatus )
  1052. TXNInitTextension(
  1053. const TXNMacOSPreferredFontDescription iDefaultFonts[], /* can be NULL */
  1054. ItemCount iCountDefaultFonts,
  1055. TXNInitOptions iUsageFlags);
  1056. /*
  1057. *************************************************************************************
  1058. Close the Textension library. It is necessary to call this function so that Textension
  1059. can correctly close down any TSM connections and do other clean up.
  1060. **************************************************************************************
  1061. */
  1062. /*
  1063. * TXNTerminateTextension()
  1064. *
  1065. * Availability:
  1066. * Non-Carbon CFM: in Textension 1.0 and later
  1067. * CarbonLib: in CarbonLib 1.0 and later
  1068. * Mac OS X: in version 10.0 and later
  1069. */
  1070. EXTERN_API_C( void )
  1071. TXNTerminateTextension(void);
  1072. /*
  1073. **************************************************************************************
  1074. Process a keydown event. Note that if CJK script is installed and current font is
  1075. CJK inline input will take place. This is always the case unless the application has
  1076. requested the bottomline window or has turned off TSM (see initialization options above).
  1077. Input:
  1078. iTXNObject: opaque struct to apply keydown to.
  1079. iEvent: the keydown event.
  1080. ***************************************************************************************
  1081. */
  1082. /*
  1083. * TXNKeyDown()
  1084. *
  1085. * Availability:
  1086. * Non-Carbon CFM: in Textension 1.0 and later
  1087. * CarbonLib: in CarbonLib 1.0 and later
  1088. * Mac OS X: in version 10.0 and later
  1089. */
  1090. EXTERN_API_C( void )
  1091. TXNKeyDown(
  1092. TXNObject iTXNObject,
  1093. const EventRecord * iEvent);
  1094. /*
  1095. ***************************************************************************************
  1096. Handle switching the cursor. If over text area set to i-beam. Over graphics, sound,
  1097. movie, scrollbar or outside of window set to arrow.
  1098. Input:
  1099. iTXNObject: Opaque struct obtained from TXNNewObject.
  1100. ioCursorRgn: Region to be passed to WaitNextEvent. Resized accordingly by
  1101. TXNAdjustCursor.
  1102. ***************************************************************************************
  1103. */
  1104. /*
  1105. * TXNAdjustCursor()
  1106. *
  1107. * Availability:
  1108. * Non-Carbon CFM: in Textension 1.0 and later
  1109. * CarbonLib: in CarbonLib 1.0 and later
  1110. * Mac OS X: in version 10.0 and later
  1111. */
  1112. EXTERN_API_C( void )
  1113. TXNAdjustCursor(
  1114. TXNObject iTXNObject,
  1115. RgnHandle ioCursorRgn);
  1116. /*
  1117. ****************************************************************************************
  1118. Process click in content region. Takes care of scrolling, selecting text, playing
  1119. sound and movies, drag & drop, and double-clicks.
  1120. Input:
  1121. iTXNObject: Opaque struct obtained from TXNNewObject.
  1122. iEvent: the mousedown event
  1123. *****************************************************************************************
  1124. */
  1125. /*
  1126. * TXNClick()
  1127. *
  1128. * Availability:
  1129. * Non-Carbon CFM: in Textension 1.0 and later
  1130. * CarbonLib: in CarbonLib 1.0 and later
  1131. * Mac OS X: in version 10.0 and later
  1132. */
  1133. EXTERN_API_C( void )
  1134. TXNClick(
  1135. TXNObject iTXNObject,
  1136. const EventRecord * iEvent);
  1137. /*
  1138. ********************************************************************************************
  1139. Call this when WaitNextEvent returns false or there is no active TSNObject .
  1140. The TXNObject parameter can be NULL which allows a client to call this function at any
  1141. time. This is necessary to insure input methods enough time to be reasonably responsive.
  1142. NOTE : You do not need to call this when working on Carbon, TSM events are passed directly
  1143. to the text object.
  1144. Input:
  1145. iTXNObject: The currently active TXNObject or NULL.
  1146. ioEvent: The event record. Usually a NULL event. If the
  1147. event is not an NULL event on entry, and an input
  1148. method consumes the event the event should return
  1149. as a NULL event.
  1150. Output:
  1151. Boolean: True if TSM handled this event. False if TSM did not handle this event.
  1152. **********************************************************************************************
  1153. */
  1154. #if CALL_NOT_IN_CARBON
  1155. /*
  1156. * TXNTSMCheck()
  1157. *
  1158. * Availability:
  1159. * Non-Carbon CFM: in Textension 1.0 and later
  1160. * CarbonLib: not available
  1161. * Mac OS X: not available
  1162. */
  1163. EXTERN_API_C( Boolean )
  1164. TXNTSMCheck(
  1165. TXNObject iTXNObject, /* can be NULL */
  1166. EventRecord * ioEvent);
  1167. /*
  1168. ***********************************************************************************************
  1169. Selects everything in a frame.
  1170. Input:
  1171. iTXNObject: opaque TXNObject
  1172. ***********************************************************************************************
  1173. */
  1174. #endif /* CALL_NOT_IN_CARBON */
  1175. /*
  1176. * TXNSelectAll()
  1177. *
  1178. * Availability:
  1179. * Non-Carbon CFM: in Textension 1.0 and later
  1180. * CarbonLib: in CarbonLib 1.0 and later
  1181. * Mac OS X: in version 10.0 and later
  1182. */
  1183. EXTERN_API_C( void )
  1184. TXNSelectAll(TXNObject iTXNObject);
  1185. /*
  1186. ***********************************************************************************************
  1187. Focues the TXNObject. Scrollbars and insertion point are made active if iBecomingFocused
  1188. is true, and inactive if false.
  1189. Input:
  1190. iTXNObject: opaque TXNObject
  1191. iBecomingFocused: true if becoming active. false otherwise.
  1192. ************************************************************************************************
  1193. */
  1194. /*
  1195. * TXNFocus()
  1196. *
  1197. * Availability:
  1198. * Non-Carbon CFM: in Textension 1.0 and later
  1199. * CarbonLib: in CarbonLib 1.0 and later
  1200. * Mac OS X: in version 10.0 and later
  1201. */
  1202. EXTERN_API_C( void )
  1203. TXNFocus(
  1204. TXNObject iTXNObject,
  1205. Boolean iBecomingFocused);
  1206. /*
  1207. ************************************************************************************************
  1208. Handle update event (i.e. draw everything in a frame.) This function calls the Toolbox
  1209. BeginUpdate - EndUpdate functions for the window that was passed to TXNNewObject. This
  1210. makes it inappropriate for windows that contain something else besides the TXNObject.
  1211. Input:
  1212. iTXNObject: opaque TXNObject
  1213. ************************************************************************************************
  1214. */
  1215. /*
  1216. * TXNUpdate()
  1217. *
  1218. * Availability:
  1219. * Non-Carbon CFM: in Textension 1.0 and later
  1220. * CarbonLib: in CarbonLib 1.0 and later
  1221. * Mac OS X: in version 10.0 and later
  1222. */
  1223. EXTERN_API_C( void )
  1224. TXNUpdate(TXNObject iTXNObject);
  1225. /*
  1226. *************************************************************************************************
  1227. Redraw the TXNObject including any scrollbars associated with the text frame. Call this function
  1228. in response to an update event for a window that contains multiple TXNObjects or some other graphic
  1229. element. The caller is responsible for calling BeginUpdate/EndUpdate in response to the update
  1230. event.
  1231. Input:
  1232. iTXNObject: opaque TXNObject to draw
  1233. iDrawPort: Can be NULL. If NULL the port is drawn to the port currently attached to the
  1234. iTXNObject. If not NULL drawing goes to the iDrawPort. If drawing is done
  1235. to the iDrawPort selection is not updated. This works this way so that it
  1236. is possible to Draw a TXNObject to a static port (i.e. print the thing without
  1237. reflowing the text to match the paper size which is what TXNPrint does)
  1238. and not have a line drawn where the selection would be. If you pass an
  1239. iDrawPort to an active TXNObject (i.e. editable) the selection will not be updated. In
  1240. this case the selection will behave oddly until text is typed which will serve
  1241. to realign the selection. Bottom-line don't pass a port in unless you want
  1242. static text (printed or non-editable)
  1243. *************************************************************************************************
  1244. */
  1245. /*
  1246. * TXNDraw()
  1247. *
  1248. * Availability:
  1249. * Non-Carbon CFM: in Textension 1.0 and later
  1250. * CarbonLib: in CarbonLib 1.0 and later
  1251. * Mac OS X: in version 10.0 and later
  1252. */
  1253. EXTERN_API_C( void )
  1254. TXNDraw(
  1255. TXNObject iTXNObject,
  1256. GWorldPtr iDrawPort); /* can be NULL */
  1257. /*
  1258. *************************************************************************************************
  1259. Force a frame to be updated. Very much like toolbox call InvalRect.
  1260. Input:
  1261. iTXNObject: opaque TXNObject
  1262. **************************************************************************************************
  1263. */
  1264. /*
  1265. * TXNForceUpdate()
  1266. *
  1267. * Availability:
  1268. * Non-Carbon CFM: in Textension 1.0 and later
  1269. * CarbonLib: in CarbonLib 1.0 and later
  1270. * Mac OS X: in version 10.0 and later
  1271. */
  1272. EXTERN_API_C( void )
  1273. TXNForceUpdate(TXNObject iTXNObject);
  1274. /*
  1275. **************************************************************************************************
  1276. Depending on state of window get the appropriate sleep time to be passed to WaitNextEvent.
  1277. Input:
  1278. iTXNObject: opaque TXNObject obtained from TXNNewObject
  1279. Output:
  1280. UInt32: function result appropriate sleep time.
  1281. ***************************************************************************************************
  1282. */
  1283. /*
  1284. * TXNGetSleepTicks()
  1285. *
  1286. * Availability:
  1287. * Non-Carbon CFM: in Textension 1.0 and later
  1288. * CarbonLib: in CarbonLib 1.0 and later
  1289. * Mac OS X: in version 10.0 and later
  1290. */
  1291. EXTERN_API_C( UInt32 )
  1292. TXNGetSleepTicks(TXNObject iTXNObject);
  1293. /*
  1294. ***************************************************************************************************
  1295. Do necessary Idle time processing. Typically flash the cursor. If a TextService is active
  1296. pass a NULL event to the Text Service so it gets time.
  1297. Input:
  1298. iTXNObject: opaque TXNObject obtained from TXNNewObject
  1299. ****************************************************************************************************
  1300. */
  1301. /*
  1302. * TXNIdle()
  1303. *
  1304. * Availability:
  1305. * Non-Carbon CFM: in Textension 1.0 and later
  1306. * CarbonLib: in CarbonLib 1.0 and later
  1307. * Mac OS X: in version 10.0 and later
  1308. */
  1309. EXTERN_API_C( void )
  1310. TXNIdle(TXNObject iTXNObject);
  1311. /*
  1312. *********************************************************************************************************
  1313. Handle mouse-down in grow region.
  1314. Input:
  1315. iTXNObject: opaque TXNObject obtained from TXNNewObject
  1316. iEvent: The mousedown event
  1317. *********************************************************************************************************
  1318. */
  1319. /*
  1320. * TXNGrowWindow()
  1321. *
  1322. * Availability:
  1323. * Non-Carbon CFM: in Textension 1.0 and later
  1324. * CarbonLib: in CarbonLib 1.0 and later
  1325. * Mac OS X: in version 10.0 and later
  1326. */
  1327. EXTERN_API_C( void )
  1328. TXNGrowWindow(
  1329. TXNObject iTXNObject,
  1330. const EventRecord * iEvent);
  1331. /*
  1332. ********************************************************************************************************
  1333. Handle mousedown in zoom.
  1334. Input:
  1335. iTXNObject: opaque TXNObject obtained from TXNNewObject
  1336. iPart: Value returned by FindWindow
  1337. *********************************************************************************************************
  1338. */
  1339. /*
  1340. * TXNZoomWindow()
  1341. *
  1342. * Availability:
  1343. * Non-Carbon CFM: in Textension 1.0 and later
  1344. * CarbonLib: in CarbonLib 1.0 and later
  1345. * Mac OS X: in version 10.0 and later
  1346. */
  1347. EXTERN_API_C( void )
  1348. TXNZoomWindow(
  1349. TXNObject iTXNObject,
  1350. SInt16 iPart);
  1351. /*
  1352. *******************************************************************************************************
  1353. Use this to determine if the Undo item in Edit menu should be highlighted or not. Tells you if last
  1354. command was undoable.
  1355. Input:
  1356. iTXNObject: opaque TXNObject obtained from TXNNewObject
  1357. Output:
  1358. Boolean function result. If True the last command is undoable and the undo item in the menu
  1359. should be active. If false last command cannot be undone and undo should be grayed
  1360. in the menu.
  1361. oTXNActionKey The key code that the caller can use to pick a string to describe the undoable
  1362. action in the undo item. Pass in NULL if the string isn't needed.
  1363. *********************************************************************************************************
  1364. */
  1365. /*
  1366. * TXNCanUndo()
  1367. *
  1368. * Availability:
  1369. * Non-Carbon CFM: in Textension 1.0 and later
  1370. * CarbonLib: in CarbonLib 1.0 and later
  1371. * Mac OS X: in version 10.0 and later
  1372. */
  1373. EXTERN_API_C( Boolean )
  1374. TXNCanUndo(
  1375. TXNObject iTXNObject,
  1376. TXNActionKey * oTXNActionKey); /* can be NULL */
  1377. /*
  1378. ********************************************************************************************************
  1379. Undo the last command.
  1380. Input:
  1381. iTXNObject: opaque TXNObject obtained from TXNNewObject
  1382. *********************************************************************************************************
  1383. */
  1384. /*
  1385. * TXNUndo()
  1386. *
  1387. * Availability:
  1388. * Non-Carbon CFM: in Textension 1.0 and later
  1389. * CarbonLib: in CarbonLib 1.0 and later
  1390. * Mac OS X: in version 10.0 and later
  1391. */
  1392. EXTERN_API_C( void )
  1393. TXNUndo(TXNObject iTXNObject);
  1394. /*
  1395. *********************************************************************************************************
  1396. Use this to determine if the current item on the undo stack is redoable. If it returns true.
  1397. than the redo item in the edit menu should be active.
  1398. Input:
  1399. iTXNObject: opaque TXNObject obtained from TXNNewObject.
  1400. oTXNActionKey The key code that the caller can use to pick a string to describe the redoable
  1401. action in the redo item. Pass in NULL if the string isn't needed.
  1402. */
  1403. /***********************************************************************************************************/
  1404. /*
  1405. * TXNCanRedo()
  1406. *
  1407. * Availability:
  1408. * Non-Carbon CFM: in Textension 1.0 and later
  1409. * CarbonLib: in CarbonLib 1.0 and later
  1410. * Mac OS X: in version 10.0 and later
  1411. */
  1412. EXTERN_API_C( Boolean )
  1413. TXNCanRedo(
  1414. TXNObject iTXNObject,
  1415. TXNActionKey * oTXNActionKey); /* can be NULL */
  1416. /*
  1417. ********************************************************************************************************
  1418. Redo the last command.
  1419. Input:
  1420. iTXNObject: opaque TXNObject obtained from TXNNewObject
  1421. *********************************************************************************************************
  1422. */
  1423. /*
  1424. * TXNRedo()
  1425. *
  1426. * Availability:
  1427. * Non-Carbon CFM: in Textension 1.0 and later
  1428. * CarbonLib: in CarbonLib 1.0 and later
  1429. * Mac OS X: in version 10.0 and later
  1430. */
  1431. EXTERN_API_C( void )
  1432. TXNRedo(TXNObject iTXNObject);
  1433. /*
  1434. *********************************************************************************************************
  1435. Cut the current selection to the clipboard.
  1436. Input:
  1437. iTXNObject: opaque TXNObject obtained from TXNNewObject
  1438. Output:
  1439. OSStatus: function result. Variety of memory or scrap MacOS errors.
  1440. **********************************************************************************************************
  1441. */
  1442. /*
  1443. * TXNCut()
  1444. *
  1445. * Availability:
  1446. * Non-Carbon CFM: in Textension 1.0 and later
  1447. * CarbonLib: in CarbonLib 1.0 and later
  1448. * Mac OS X: in version 10.0 and later
  1449. */
  1450. EXTERN_API_C( OSStatus )
  1451. TXNCut(TXNObject iTXNObject);
  1452. /*
  1453. *********************************************************************************************************
  1454. TXNCopy
  1455. Copy current selection
  1456. Input:
  1457. iTXNObject: current document
  1458. **********************************************************************************************************
  1459. */
  1460. /*
  1461. * TXNCopy()
  1462. *
  1463. * Availability:
  1464. * Non-Carbon CFM: in Textension 1.0 and later
  1465. * CarbonLib: in CarbonLib 1.0 and later
  1466. * Mac OS X: in version 10.0 and later
  1467. */
  1468. EXTERN_API_C( OSStatus )
  1469. TXNCopy(TXNObject iTXNObject);
  1470. /*
  1471. ***********************************************************************************************************
  1472. TXNPaste
  1473. Paste the clipboard
  1474. Input:
  1475. iTXNObject: current document
  1476. **********************************************************************************************************
  1477. */
  1478. /*
  1479. * TXNPaste()
  1480. *
  1481. * Availability:
  1482. * Non-Carbon CFM: in Textension 1.0 and later
  1483. * CarbonLib: in CarbonLib 1.0 and later
  1484. * Mac OS X: in version 10.0 and later
  1485. */
  1486. EXTERN_API_C( OSStatus )
  1487. TXNPaste(TXNObject iTXNObject);
  1488. /*
  1489. **********************************************************************************************************
  1490. TXNClear
  1491. clear the current selection
  1492. Input:
  1493. iTXNObject: current document
  1494. **********************************************************************************************************
  1495. */
  1496. /*
  1497. * TXNClear()
  1498. *
  1499. * Availability:
  1500. * Non-Carbon CFM: in Textension 1.0 and later
  1501. * CarbonLib: in CarbonLib 1.0 and later
  1502. * Mac OS X: in version 10.0 and later
  1503. */
  1504. EXTERN_API_C( OSStatus )
  1505. TXNClear(TXNObject iTXNObject);
  1506. /*
  1507. *********************************************************************************************************
  1508. TXNGetSelection
  1509. Get the absolute offsets of the current selection.
  1510. Embedded graphics, sound, etc. each count as one character.
  1511. Input:
  1512. iTXNObject: current document
  1513. Output:
  1514. oStartOffset: absolute beginning of the current selection.
  1515. oEndOffset: end of current selection.
  1516. *********************************************************************************************************
  1517. */
  1518. /*
  1519. * TXNGetSelection()
  1520. *
  1521. * Availability:
  1522. * Non-Carbon CFM: in Textension 1.0 and later
  1523. * CarbonLib: in CarbonLib 1.0 and later
  1524. * Mac OS X: in version 10.0 and later
  1525. */
  1526. EXTERN_API_C( void )
  1527. TXNGetSelection(
  1528. TXNObject iTXNObject,
  1529. TXNOffset * oStartOffset,
  1530. TXNOffset * oEndOffset);
  1531. /*
  1532. *****************************************************************************************************
  1533. Scroll the current selection into view.
  1534. Input:
  1535. iTXNObject: opaque TXNObject obtained from TXNNewObject
  1536. iShowEnd: If true the end of the selection is scrolled into view. If false the
  1537. beginning of selection is scrolled into view.
  1538. ****************************************************************************************************
  1539. */
  1540. /*
  1541. * TXNShowSelection()
  1542. *
  1543. * Availability:
  1544. * Non-Carbon CFM: in Textension 1.0 and later
  1545. * CarbonLib: in CarbonLib 1.0 and later
  1546. * Mac OS X: in version 10.0 and later
  1547. */
  1548. EXTERN_API_C( void )
  1549. TXNShowSelection(
  1550. TXNObject iTXNObject,
  1551. Boolean iShowEnd);
  1552. /*
  1553. *****************************************************************************************************
  1554. Call to find out if the current selection is empty. Use this to determine if Paste, Cut, Copy,
  1555. Clear should be highlighted in Edit menu.
  1556. Input:
  1557. iTXNObject: opaque TXNObject obtained from TXNNewObject
  1558. Output:
  1559. Boolean: function result. True if current selection is empty (i.e. start offset == end offset).
  1560. False if selection is not empty.
  1561. ********************************************************************************************************
  1562. */
  1563. /*
  1564. * TXNIsSelectionEmpty()
  1565. *
  1566. * Availability:
  1567. * Non-Carbon CFM: in Textension 1.0 and later
  1568. * CarbonLib: in CarbonLib 1.0 and later
  1569. * Mac OS X: in version 10.0 and later
  1570. */
  1571. EXTERN_API_C( Boolean )
  1572. TXNIsSelectionEmpty(TXNObject iTXNObject);
  1573. /*
  1574. ********************************************************************************************************
  1575. Set the current selection.
  1576. Input:
  1577. iTXNObject: opaque TXNObject obtained from TXNNewObject
  1578. iStartOffset: new beginning
  1579. iEndOffset: new end
  1580. ********************************************************************************************************
  1581. */
  1582. /*
  1583. * TXNSetSelection()
  1584. *
  1585. * Availability:
  1586. * Non-Carbon CFM: in Textension 1.0 and later
  1587. * CarbonLib: in CarbonLib 1.0 and later
  1588. * Mac OS X: in version 10.0 and later
  1589. */
  1590. EXTERN_API_C( OSStatus )
  1591. TXNSetSelection(
  1592. TXNObject iTXNObject,
  1593. TXNOffset iStartOffset,
  1594. TXNOffset iEndOffset);
  1595. /*
  1596. *******************************************************************************************************
  1597. TXNGetContinuousTypeAttributes
  1598. Test the current selection to see if type size, style, color and/or font are continuous.
  1599. That is is the current selection made up of one font, one font size, one Style, and/or one color.
  1600. On return examine the flags to see if the attributes specified were continuous. If an attribute
  1601. is continuous then the dataValue field in the TXNTypeAttributes can be examined to get the continous
  1602. value. Remember that for color you pass a ptr to an RGBColor in attr[0].data.dataPtr.
  1603. Input:
  1604. iTXNObject: current document
  1605. oContinuousFlags: Bits which can be examined to see if type size, style, color, and/or font are continuous
  1606. e.g
  1607. if ( TXNGetContinuousTypeAttributes( txnObject, &flags, 1, &attr ) == noErr )
  1608. {
  1609. if ( flags & kTXNFontContinuousMask )
  1610. ....check a font name
  1611. ioCount: Count of TXNTypeAttributes records in the ioTypeAttributes array.
  1612. ioTypeAttributes: Array of TXNTypeAttributes that indicate the type attributes the
  1613. caller is interested in. For example, if you wanted to know if
  1614. the current selection was continuous in terms of being all
  1615. one same font size you could do something like this.
  1616. TXNTypeAttributes attr[1] = { TXNFontSizeAttribute, sizeof(Fixed),{ 0 } }
  1617. on return from the function if size is continuous (i.e. if the bit 3 of flags is set)
  1618. then the third field (attr[0].data.dataValue) will contain the size of the font as a Fixed value.
  1619. ***********************************************************************************************************
  1620. */
  1621. /*
  1622. * TXNGetContinuousTypeAttributes()
  1623. *
  1624. * Availability:
  1625. * Non-Carbon CFM: in Textension 1.0 and later
  1626. * CarbonLib: in CarbonLib 1.0 and later
  1627. * Mac OS X: in version 10.0 and later
  1628. */
  1629. EXTERN_API_C( OSStatus )
  1630. TXNGetContinuousTypeAttributes(
  1631. TXNObject iTxnObject,
  1632. TXNContinuousFlags * oContinuousFlags,
  1633. ItemCount iCount,
  1634. TXNTypeAttributes ioTypeAttributes[]); /* can be NULL */
  1635. /*
  1636. *************************************************************************************************
  1637. TXNSetTypeAttributes
  1638. Set the current ranges font information. Values are passed
  1639. in the attributes array. Values <= sizeof(UInt32) are passed
  1640. by value. > sizeof(UInt32) are passed as a pointer. That is
  1641. the TXNTypeAttributes' 3rd field is a union that servers as
  1642. either a 32-bit integer where values can be written or a 32-bit pointer
  1643. a value.
  1644. Input:
  1645. iTXNObject: current document
  1646. iAttrCount: Count of type attributes in the TXNTypeAttributes array.
  1647. iAttributes: Attributes that caller would like to set.
  1648. iStartOffset: Start of the range where text attributes should be changed.
  1649. iEndOffset: End of the range.
  1650. Output:
  1651. OSStatus: various MacOS errs. Notably memory manager and paramErrs.
  1652. *************************************************************************************************
  1653. */
  1654. /*
  1655. * TXNSetTypeAttributes()
  1656. *
  1657. * Availability:
  1658. * Non-Carbon CFM: in Textension 1.0 and later
  1659. * CarbonLib: in CarbonLib 1.0 and later
  1660. * Mac OS X: in version 10.0 and later
  1661. */
  1662. EXTERN_API_C( OSStatus )
  1663. TXNSetTypeAttributes(
  1664. TXNObject iTXNObject,
  1665. ItemCount iAttrCount,
  1666. const TXNTypeAttributes iAttributes[],
  1667. TXNOffset iStartOffset,
  1668. TXNOffset iEndOffset);
  1669. /*
  1670. * TXNSetTXNObjectControls()
  1671. *
  1672. * Summary:
  1673. * Sets formatting and privileges attributes (such as justification,
  1674. * line direction, tab values, and read-only status) that apply to
  1675. * the entire text object.
  1676. *
  1677. * Discussion:
  1678. * On systems that use Apple Type Services for Unicode Imaging
  1679. * (ATSUI), the ATSUI line control attribute tags can be passed to
  1680. * this function in the iControlTag parameter. This is the case for
  1681. * all the ATSUI tags except kATSULineRotationTag. ATSUI tags are
  1682. * applied to the entire text object.
  1683. *
  1684. * Parameters:
  1685. *
  1686. * iTXNObject:
  1687. * The text object that identifies the document for which you want
  1688. * to set formatting and privileges attributes.
  1689. *
  1690. * iClearAll:
  1691. * A Boolean value. If you set this to true, all formatting and
  1692. * privileges attributes are reset to their default value. That
  1693. * is, true clears existing tags and resets each to its default
  1694. * value.
  1695. *
  1696. * iControlCount:
  1697. * The number of items in the iControlTags array.
  1698. *
  1699. * iControlTags:
  1700. * An array of values that specifies kind of data that is passed
  1701. * in the iControlData parameter. See "Formatting and Privileges
  1702. * Settings" for a description of possible values. On systems that
  1703. * use Apple Type Services for Unicode Imaging (ATSUI), you can
  1704. * also pass ATSUI attribute tag constants. See the ATSUI
  1705. * documentation for a description of the ATSUI constants. Can be
  1706. * NULL if iClearAll is true.
  1707. *
  1708. * iControlData:
  1709. * An array of TXNControlData unions that contain the information
  1710. * your application wants to set. The value you supply to the
  1711. * iControlTags parameter specifies how the union of type
  1712. * TXNControlData is treated. You must make sure that the value
  1713. * you assign to the iControlData parameter is the appropriate
  1714. * type implied by the value you passed in the iControlTags
  1715. * parameter. Can be NULL if iClearAll is true.
  1716. *
  1717. * Result:
  1718. * An operating system status code.
  1719. *
  1720. * Availability:
  1721. * Non-Carbon CFM: in Textension 1.0 and later
  1722. * CarbonLib: in CarbonLib 1.0 and later
  1723. * Mac OS X: in version 10.0 and later
  1724. */
  1725. EXTERN_API_C( OSStatus )
  1726. TXNSetTXNObjectControls(
  1727. TXNObject iTXNObject,
  1728. Boolean iClearAll,
  1729. ItemCount iControlCount,
  1730. const TXNControlTag iControlTags[], /* can be NULL */
  1731. const TXNControlData iControlData[]); /* can be NULL */
  1732. /*
  1733. * TXNGetTXNObjectControls()
  1734. *
  1735. * Summary:
  1736. * Gets the current formatting and privileges attributes (such as
  1737. * justification, line direction, tab values, and read-only status)
  1738. * for a text object.
  1739. *
  1740. * Parameters:
  1741. *
  1742. * iTXNObject:
  1743. * The text object that identifies the document to be activated.
  1744. *
  1745. * iControlCount:
  1746. * The number of items in the iControlTags array.
  1747. *
  1748. * iControlTags:
  1749. * An array of values that specify the kind of formatting
  1750. * information you want returned in the oControlData array. See
  1751. * "Formatting and Privileges Settings" for a description of
  1752. * possible values.
  1753. *
  1754. * oControlData:
  1755. * An array of TXNControlData unions. On return, the array
  1756. * contains the information that was requested through the
  1757. * iControlTags array. Your application must allocate the
  1758. * oControlData array.
  1759. *
  1760. * Result:
  1761. * An operating system status code.
  1762. *
  1763. * Availability:
  1764. * Non-Carbon CFM: in Textension 1.0 and later
  1765. * CarbonLib: in CarbonLib 1.0 and later
  1766. * Mac OS X: in version 10.0 and later
  1767. */
  1768. EXTERN_API_C( OSStatus )
  1769. TXNGetTXNObjectControls(
  1770. TXNObject iTXNObject, /* can be NULL */
  1771. ItemCount iControlCount,
  1772. const TXNControlTag iControlTags[],
  1773. TXNControlData oControlData[]);
  1774. /*
  1775. ******************************************************************************************************
  1776. TXNCountRunsInRange
  1777. Given a range specified by the starting and ending offset return a count of the runs in that
  1778. range. Run in this case means changes in TextSyles or a graphic or sound.
  1779. Result:
  1780. OSStatus: paramerr mostly
  1781. Input:
  1782. iTXNObject The TXNObject you are interested in.
  1783. iStartOffset start of range
  1784. iEndOffset end of range
  1785. Output:
  1786. oRunCount count of runs in the range
  1787. *******************************************************************************************************
  1788. */
  1789. /*
  1790. * TXNCountRunsInRange()
  1791. *
  1792. * Availability:
  1793. * Non-Carbon CFM: in Textension 1.0 and later
  1794. * CarbonLib: in CarbonLib 1.0 and later
  1795. * Mac OS X: in version 10.0 and later
  1796. */
  1797. EXTERN_API_C( OSStatus )
  1798. TXNCountRunsInRange(
  1799. TXNObject iTXNObject,
  1800. TXNOffset iStartOffset,
  1801. TXNOffset iEndOffset,
  1802. ItemCount * oRunCount);
  1803. /*
  1804. * TXNGetIndexedRunInfoFromRange()
  1805. *
  1806. * Summary:
  1807. * Gets information about a run in a range of data.
  1808. *
  1809. * Discussion:
  1810. * You should first call the TXNCountRunsInRange function to get the
  1811. * count. The TXNTypeAttributes structure must specify the text
  1812. * attribute in which the application is interested. In other words,
  1813. * the tag field must be set.
  1814. *
  1815. * Parameters:
  1816. *
  1817. * iTXNObject:
  1818. * The text object for the current text area.
  1819. *
  1820. * iIndex:
  1821. * The value that corresponds to the run for which you want to get
  1822. * information. You call the TXNCountRunsInRange function to get
  1823. * the number of runs in a range. The iIndex parameter is
  1824. * zero-based, so its possible values are from 0 to the number of
  1825. * runs in a range minus 1.
  1826. *
  1827. * iStartOffset:
  1828. * The offset at which you want to start to obtain run information.
  1829. *
  1830. * iEndOffset:
  1831. * The offset at which you want run information to end.
  1832. *
  1833. * oRunStartOffset:
  1834. * On return, a pointer to a value that identifies the start of
  1835. * run relative to the beginning of the text, not the beginning of
  1836. * the range you specified in the iStartOffset parameter.
  1837. *
  1838. * oRunEndOffset:
  1839. * On return, a pointer to a value that identifies the end of the
  1840. * run relative to the beginning of the text, not the beginning of
  1841. * the range you specified in the iStartOffset parameter.
  1842. *
  1843. * oRunDataType:
  1844. * On return, a pointer to a value that identifies the type of
  1845. * data in the run. See "Supported Data Types" for a description
  1846. * of possible values.
  1847. *
  1848. * iTypeAttributeCount:
  1849. * The number of font attributes.
  1850. *
  1851. * ioTypeAttributes:
  1852. * A pointer to a structure of type TXNTypeAttributes. On input,
  1853. * you specify the attribute (such as color) in the tag field and
  1854. * the attribute size in the size field. You can pass NULL for the
  1855. * data field. On return, the data field contains the attribute
  1856. * data. The data field is a union that serves either as a 32-bit
  1857. * integer or a 32-bit pointer, depending on the size field.
  1858. *
  1859. * Result:
  1860. * An operating system status code.
  1861. *
  1862. * Availability:
  1863. * Non-Carbon CFM: in Textension 1.0 and later
  1864. * CarbonLib: in CarbonLib 1.0 and later
  1865. * Mac OS X: in version 10.0 and later
  1866. */
  1867. EXTERN_API_C( OSStatus )
  1868. TXNGetIndexedRunInfoFromRange(
  1869. TXNObject iTXNObject,
  1870. ItemCount iIndex,
  1871. TXNOffset iStartOffset,
  1872. TXNOffset iEndOffset,
  1873. TXNOffset * oRunStartOffset, /* can be NULL */
  1874. TXNOffset * oRunEndOffset, /* can be NULL */
  1875. TXNDataType * oRunDataType, /* can be NULL */
  1876. ItemCount iTypeAttributeCount,
  1877. TXNTypeAttributes * ioTypeAttributes); /* can be NULL */
  1878. /*
  1879. **********************************************************************************************************
  1880. TXNDataSize
  1881. Return the size in bytes of the characters in a given TXNObject.
  1882. Result:
  1883. ByteCount: The bytes required to hold the characters
  1884. Input:
  1885. iTXNObject: The TXNObject
  1886. **********************************************************************************************************
  1887. */
  1888. /*
  1889. * TXNDataSize()
  1890. *
  1891. * Availability:
  1892. * Non-Carbon CFM: in Textension 1.0 and later
  1893. * CarbonLib: in CarbonLib 1.0 and later
  1894. * Mac OS X: in version 10.0 and later
  1895. */
  1896. EXTERN_API_C( ByteCount )
  1897. TXNDataSize(TXNObject iTXNObject);
  1898. /*
  1899. ***********************************************************************************************************
  1900. Copy the data in the range specified by startOffset and endOffset. This function should be used
  1901. in conjunction with TXNNextDataRun. The client would call TXNCountRunsInRange to the number of data
  1902. runs in a given range. The client can then walk the runs with the function TXNGetIndexedRunInfoFromRange.
  1903. TXNGetIndexedRunInfoFromRange lets you examine each runs type and text attributes.
  1904. For each data run of interest (i.e. one whose data the caller wanted to look at)
  1905. the client would call TXNGetData. The handle passed to TXNGetData should not be allocated.
  1906. TXNGetData takes care of allocating the dataHandle as necessary. However, the caller is responsible
  1907. for disposing the handle.
  1908. No effort is made to insure that data copies align on a word boundary. Data is simply copied as
  1909. specified in the offsets.
  1910. Input:
  1911. iTXNObject: opaque TXNObject obtained from TXNNewObject.
  1912. iStartOffset: absolute offset from which data copy should begin.
  1913. iEndOffset: absolute offset at which data copy should end.
  1914. Output:
  1915. OSStatus Memory errors or TXN_IllegalToCrossDataBoundaries if offsets specify a range that
  1916. crosses a data type boundary.
  1917. oDataHandle: If noErr a new handle containing the requested data. The caller is responsible
  1918. for disposing the handle. Note that the handle is a copy so it can be safely
  1919. disposed at any time.
  1920. **********************************************************************************************************
  1921. */
  1922. /*
  1923. * TXNGetData()
  1924. *
  1925. * Availability:
  1926. * Non-Carbon CFM: in Textension 1.0 and later
  1927. * CarbonLib: in CarbonLib 1.0 and later
  1928. * Mac OS X: in version 10.0 and later
  1929. */
  1930. EXTERN_API_C( OSStatus )
  1931. TXNGetData(
  1932. TXNObject iTXNObject,
  1933. TXNOffset iStartOffset,
  1934. TXNOffset iEndOffset,
  1935. Handle * oDataHandle);
  1936. /*
  1937. ***********************************************************************************************************
  1938. Copy the data in the range specified by startOffset and endOffset.
  1939. The handle passed to TXNGetDataEncoded should not be allocated.
  1940. TXNGetData takes care of allocating the dataHandle as necessary. However, the caller is responsible
  1941. for disposing the handle.
  1942. No effort is made to insure that data copies align on a word boundary. Data is simply copied as
  1943. specified in the offsets.
  1944. Input:
  1945. iTXNObject: opaque TXNObject obtained from TXNNewObject.
  1946. iStartOffset: absolute offset from which data copy should begin.
  1947. iEndOffset: absolute offset at which data copy should end.
  1948. iEncoding : should be kTXNTextData or kTXNUnicodeTextData
  1949. Output:
  1950. OSStatus Memory errors or TXN_IllegalToCrossDataBoundaries if offsets specify a range that
  1951. crosses a data type boundary.
  1952. oDataHandle: If noErr a new handle containing the requested data.
  1953. **********************************************************************************************************
  1954. */
  1955. /*
  1956. * TXNGetDataEncoded()
  1957. *
  1958. * Availability:
  1959. * Non-Carbon CFM: in Textension 1.0 and later
  1960. * CarbonLib: in CarbonLib 1.0 and later
  1961. * Mac OS X: in version 10.0 and later
  1962. */
  1963. EXTERN_API_C( OSStatus )
  1964. TXNGetDataEncoded(
  1965. TXNObject iTXNObject,
  1966. TXNOffset iStartOffset,
  1967. TXNOffset iEndOffset,
  1968. Handle * oDataHandle,
  1969. TXNDataType iEncoding);
  1970. /*
  1971. *********************************************************************************************************
  1972. Replace the specified range with the contents of the specified file. The data fork of the file
  1973. must be opened by the caller.
  1974. Input:
  1975. iTXNObject: opaque TXNObject obtained from TXNNewObject
  1976. fileSpec: HFS file reference obtained when file is opened.
  1977. fileType: files type.
  1978. iFileLength: The length of data in the file that should be considered data. This
  1979. parameter is available to enable callers to embed text inside their
  1980. own private data structures. Note that if the data is in the Textension(txtn)
  1981. format this parameter is ignored since length, etc. information is
  1982. part of the format. Further note that if you you just want Textension
  1983. to read a file and you are not interested in embedding you can just pass
  1984. kTXNEndOffset(0x7FFFFFFF), and Textension will use the file manager to
  1985. determine the files length.
  1986. iStartOffset: start position at which to insert the file into the document.
  1987. iEndOffset: end position of range being replaced by the file.
  1988. Output:
  1989. OSStatus: File manager error or noErr.
  1990. ***********************************************************************************************************
  1991. */
  1992. /*
  1993. * TXNSetDataFromFile()
  1994. *
  1995. * Availability:
  1996. * Non-Carbon CFM: in Textension 1.0 and later
  1997. * CarbonLib: in CarbonLib 1.0 and later
  1998. * Mac OS X: in version 10.0 and later
  1999. */
  2000. EXTERN_API_C( OSStatus )
  2001. TXNSetDataFromFile(
  2002. TXNObject iTXNObject,
  2003. SInt16 iFileRefNum,
  2004. OSType iFileType,
  2005. ByteCount iFileLength,
  2006. TXNOffset iStartOffset,
  2007. TXNOffset iEndOffset);
  2008. /*
  2009. * TXNSetData()
  2010. *
  2011. * Summary:
  2012. * Replaces a range of data (text, graphics, and so forth).
  2013. *
  2014. * Parameters:
  2015. *
  2016. * iTXNObject:
  2017. * The text object that identifies the document in which you want
  2018. * to replace data.
  2019. *
  2020. * iDataType:
  2021. * The type of the replacement data. See "Supported Data Types"
  2022. * for a description of possible values.
  2023. *
  2024. * iDataPtr:
  2025. * A pointer to the data that will replace the data that is in the
  2026. * range specified by the iStartOffset and iEndOffset parameters.
  2027. * Can be NULL if the start and end offsets are different.
  2028. *
  2029. * iDataSize:
  2030. * The size of the data to which iDataPtr points.
  2031. *
  2032. * iStartOffset:
  2033. * The beginning of the range of data to replace. You can use the
  2034. * TXNGetSelection function to get the absolute offsets of the
  2035. * current selection.
  2036. *
  2037. * iEndOffset:
  2038. * The end of the range to replace. You can use the
  2039. * TXNGetSelection function to get the absolute offsets of the
  2040. * current selection. If you want to insert text, the ending and
  2041. * starting offsets should be the same value.
  2042. *
  2043. * Result:
  2044. * An operating system status code.
  2045. *
  2046. * Availability:
  2047. * Non-Carbon CFM: in Textension 1.0 and later
  2048. * CarbonLib: in CarbonLib 1.0 and later
  2049. * Mac OS X: in version 10.0 and later
  2050. */
  2051. EXTERN_API_C( OSStatus )
  2052. TXNSetData(
  2053. TXNObject iTXNObject,
  2054. TXNDataType iDataType,
  2055. const void * iDataPtr, /* can be NULL */
  2056. ByteCount iDataSize,
  2057. TXNOffset iStartOffset,
  2058. TXNOffset iEndOffset);
  2059. /*
  2060. ************************************************************************************************************
  2061. Retrieve number of times document has been changed. That is for every committed command
  2062. (keydown, cut, copy) the value returned is count of those. This is useful for deciding if the Save
  2063. item in the File menu should be active.
  2064. Input:
  2065. iTXNObject: opaque TXNObject obtained from TXNNewObject
  2066. Output:
  2067. ItemCount: count of changes. This is total changes since document was created or last saved.
  2068. Not count since this routine was last called or anything like that.
  2069. ***********************************************************************************************************
  2070. */
  2071. /*
  2072. * TXNGetChangeCount()
  2073. *
  2074. * Availability:
  2075. * Non-Carbon CFM: in Textension 1.0 and later
  2076. * CarbonLib: in CarbonLib 1.0 and later
  2077. * Mac OS X: in version 10.0 and later
  2078. */
  2079. EXTERN_API_C( ItemCount )
  2080. TXNGetChangeCount(TXNObject iTXNObject);
  2081. /*
  2082. *********************************************************************************************************
  2083. Save the contents of the document as the given type.
  2084. Input:
  2085. iTXNObject: opaque TXNObject obtained from TXNNewObject.
  2086. iType: The type of file to create.
  2087. iResType: When saving file as plain TEXT the type of resource to
  2088. save style information. Use kTXNMultipleStylesPerTextDocumentResType
  2089. if your document contains multiple styles and you want a SimpleText
  2090. like document. Use kTXNSingleStylePerTextDocumentResType if the
  2091. document has a single style and you would like a BBEdit, MPW, CW type
  2092. of document.
  2093. iPermanentEncoding: The encoding in which the document should be saved (Unicode, Text or System
  2094. default).
  2095. iFileSpecification: The file specification to which the document should be saved. The
  2096. file must have been opened by the caller. The file specification is remembered by the TXNObject
  2097. and is used for any subsequent calls to TXNRevert.
  2098. iDataReference: The data fork ref num. This is used to write data to the data fork of the
  2099. file. The data is written beginning at the current mark.
  2100. iResourceReference: The resource fork ref num. If the caller has specified that style information be
  2101. saved as a resource (MPW or SimpleText) than this should be a valid reference to
  2102. an open resource fork. If the txtn format is being used than this input value
  2103. is ignored.
  2104. Output:
  2105. OSStatus The result of writing the file.
  2106. **********************************************************************************************************
  2107. */
  2108. /*
  2109. * TXNSave()
  2110. *
  2111. * Availability:
  2112. * Non-Carbon CFM: in Textension 1.0 and later
  2113. * CarbonLib: in CarbonLib 1.0 and later
  2114. * Mac OS X: in version 10.0 and later
  2115. */
  2116. EXTERN_API_C( OSStatus )
  2117. TXNSave(
  2118. TXNObject iTXNObject,
  2119. TXNFileType iType,
  2120. OSType iResType,
  2121. TXNPermanentTextEncodingType iPermanentEncoding,
  2122. const FSSpec * iFileSpecification,
  2123. SInt16 iDataReference,
  2124. SInt16 iResourceReference);
  2125. /*
  2126. ***********************************************************************************************************
  2127. Revert to the last saved version of this document. If the file was not previously saved the document
  2128. is reverted to an empty document.
  2129. Input:
  2130. iTXNObject: opaque TXNObject obtained from TXNNewObject
  2131. Output:
  2132. OSStatus: File manager errors, paramErr, or noErr.
  2133. **********************************************************************************************************
  2134. */
  2135. /*
  2136. * TXNRevert()
  2137. *
  2138. * Availability:
  2139. * Non-Carbon CFM: in Textension 1.0 and later
  2140. * CarbonLib: in CarbonLib 1.0 and later
  2141. * Mac OS X: in version 10.0 and later
  2142. */
  2143. EXTERN_API_C( OSStatus )
  2144. TXNRevert(TXNObject iTXNObject);
  2145. /*
  2146. *********************************************************************************************************
  2147. Display the Page Setup dialog of the current default printer and react to any changes
  2148. (i.e. Reformat the text if the page layout changes.)
  2149. Input:
  2150. iTXNObject: opaque TXNObject obtained from TXNNewObject.
  2151. Output:
  2152. OSStatus: Print Manager errors, paramErr, noErr.
  2153. **********************************************************************************************************
  2154. */
  2155. /*
  2156. * TXNPageSetup()
  2157. *
  2158. * Availability:
  2159. * Non-Carbon CFM: in Textension 1.0 and later
  2160. * CarbonLib: in CarbonLib 1.0 and later
  2161. * Mac OS X: in version 10.0 and later
  2162. */
  2163. EXTERN_API_C( OSStatus )
  2164. TXNPageSetup(TXNObject iTXNObject);
  2165. /*
  2166. **********************************************************************************************************
  2167. Print the document.
  2168. Input:
  2169. iTXNObject: opaque TXNObject obtained from TXNNewObject.
  2170. Output:
  2171. OSStatus: Print Manager errors, paramErr, noErr.
  2172. **********************************************************************************************************
  2173. */
  2174. /*
  2175. * TXNPrint()
  2176. *
  2177. * Availability:
  2178. * Non-Carbon CFM: in Textension 1.0 and later
  2179. * CarbonLib: in CarbonLib 1.0 and later
  2180. * Mac OS X: in version 10.0 and later
  2181. */
  2182. EXTERN_API_C( OSStatus )
  2183. TXNPrint(TXNObject iTXNObject);
  2184. /*
  2185. ***********************************************************************************************************
  2186. Test to see if the current scrap contains data that is supported by Textension. Used to determine
  2187. if Paste item in Edit menu should be active or inactive. The types of data supported depends on what
  2188. data types were specified in the TXNInitTextension options.
  2189. Output:
  2190. Boolean: function result. True if data type in Clipboard is supported. False if
  2191. not a supported data type. If result is True the Paste item in the menu can
  2192. be highlighted.
  2193. **********************************************************************************************************
  2194. */
  2195. /*
  2196. * TXNIsScrapPastable()
  2197. *
  2198. * Availability:
  2199. * Non-Carbon CFM: in Textension 1.0 and later
  2200. * CarbonLib: in CarbonLib 1.0 and later
  2201. * Mac OS X: in version 10.0 and later
  2202. */
  2203. EXTERN_API_C( Boolean )
  2204. TXNIsScrapPastable(void);
  2205. /*
  2206. ***********************************************************************************************************
  2207. Convert the Textension private scrap to the public clipboard. This should be called on suspend
  2208. events and before the application displays a dialog that might support cut and paste. Or more
  2209. generally, whenever someone other than the Textension Shared Library needs access to the scrap data.
  2210. Output:
  2211. OSStatus: Function result. Memory Manager errors, Scrap Manager errors, noErr.
  2212. ************************************************************************************************************
  2213. */
  2214. /*
  2215. * TXNConvertToPublicScrap()
  2216. *
  2217. * Availability:
  2218. * Non-Carbon CFM: in Textension 1.0 and later
  2219. * CarbonLib: in CarbonLib 1.0 and later
  2220. * Mac OS X: in version 10.0 and later
  2221. */
  2222. EXTERN_API_C( OSStatus )
  2223. TXNConvertToPublicScrap(void);
  2224. /*
  2225. ***********************************************************************************************************
  2226. Convert the public clipboard to our private scrap . This should be called on resume
  2227. events and after an application has modified the scrap. Before doing work we check the validity of the public
  2228. scrap (date modification and type)
  2229. Output:
  2230. OSStatus: Function result. Memory Manager errors, Scrap Manager errors, noErr.
  2231. ************************************************************************************************************
  2232. */
  2233. /*
  2234. * TXNConvertFromPublicScrap()
  2235. *
  2236. * Availability:
  2237. * Non-Carbon CFM: in Textension 1.0 and later
  2238. * CarbonLib: in CarbonLib 1.0 and later
  2239. * Mac OS X: in version 10.0 and later
  2240. */
  2241. EXTERN_API_C( OSStatus )
  2242. TXNConvertFromPublicScrap(void);
  2243. /*
  2244. ************************************************************************************************************
  2245. Get the rectangle describing the current view into the document. The coordinates of this rectangle will be
  2246. local to the the window.
  2247. Input:
  2248. iTXNObject: opaque TXNObject obtained from TXNNewObject.
  2249. Output:
  2250. oViewRect: the requested view rectangle.
  2251. *************************************************************************************************************
  2252. */
  2253. /*
  2254. * TXNGetViewRect()
  2255. *
  2256. * Availability:
  2257. * Non-Carbon CFM: in Textension 1.0 and later
  2258. * CarbonLib: in CarbonLib 1.0 and later
  2259. * Mac OS X: in version 10.0 and later
  2260. */
  2261. EXTERN_API_C( void )
  2262. TXNGetViewRect(
  2263. TXNObject iTXNObject,
  2264. Rect * oViewRect);
  2265. /*
  2266. !! TXNSetViewRect is now deprecated for 10.2 and later. Please use TXNSetFrameBounds or TXNSetRectBounds API !!
  2267. *************************************************************************************************
  2268. Set the rectangle describing the current view into the document. This
  2269. will change how much text is viewable. Not where a line of text wraps.
  2270. That is controlled by TXNSetFrameBoundsSize.
  2271. Input:
  2272. iTXNObject : opaque Textension structure.
  2273. iViewRect: Rect of the view
  2274. *************************************************************************************************
  2275. */
  2276. /*
  2277. * TXNSetViewRect()
  2278. *
  2279. * Availability:
  2280. * Non-Carbon CFM: in Textension 1.3 and later
  2281. * CarbonLib: in CarbonLib 1.3 and later
  2282. * Mac OS X: in version 10.0 and later
  2283. */
  2284. EXTERN_API_C( void )
  2285. TXNSetViewRect(
  2286. TXNObject iTXNObject,
  2287. const Rect * iViewRect);
  2288. /*
  2289. ***********************************************************************************************************
  2290. Find a piece of text or a graphics object.
  2291. Input:
  2292. iTXNObject: opaque TXNObject obtained from TXNNewObject.
  2293. iMatchTextDataPtr ptr to a MatchTextRecord which contains the text to match, the length of that text
  2294. and the TextEncoding the text is encoded in. This must be there if you are looking
  2295. for Text, but can be NULL if you are looking for a graphics object.
  2296. iDataType The type of data to find. This can be any of the types defined in TXNDataType enum
  2297. (TEXT, PICT, moov, snd ). However, if PICT, moov, or snd is passed then the default
  2298. behavior is to match on any non-Text object. If you really want to find a specific
  2299. type you can provide a custom find callback or ignore matches which aren't the precise
  2300. type you are interested in.
  2301. iStartSearchOffset The offset at which a search should begin. The constant kTXNStartOffset specifies the start
  2302. of the objects data.
  2303. iEndSearchOffset The offset at which the search should end. The constant kTXNEndOffset specifies the end
  2304. of the objects data.
  2305. iFindProc A custom callback. If will be called to match things rather than the default matching
  2306. behavior.
  2307. iRefCon This can be use for whatever the caller likes. It is passed to the FindProc (if a FindProc
  2308. is provided.
  2309. Output:
  2310. oStartMatchOffset absolute offset to start of match. set to 0xFFFFFFFF if not match.
  2311. oEndMatchOffset absolute offset to end of match. Set to 0xFFFFFFFF is no match.
  2312. The default matching behavior is pretty simple for Text a basic binary compare is done. If the matchOptions say
  2313. to ignore case the characters to be searched are duplicated and case neutralized. This naturally can fail due
  2314. to lack of memory if there is a large amount of text. It also slows things down. If MatchOptions say
  2315. find an entire word that once a match is found an effort is made to determine if the match is a word. The default
  2316. behavior is to test the character before and after the to see if it is White space. If the kTXNUseEncodingWordRulesBit
  2317. is set than the Script Manager's FindWord function is called to make this determination.
  2318. If the caller is looking for a non-text type than each non-text type in the document is returned.
  2319. If more elaborate ( a regular expression processor or whatever ) is what you want then that is what the FindProc is
  2320. for.
  2321. *******************************************************************************************************************
  2322. */
  2323. /*
  2324. * TXNFind()
  2325. *
  2326. * Availability:
  2327. * Non-Carbon CFM: in Textension 1.0 and later
  2328. * CarbonLib: in CarbonLib 1.0 and later
  2329. * Mac OS X: in version 10.0 and later
  2330. */
  2331. EXTERN_API_C( OSStatus )
  2332. TXNFind(
  2333. TXNObject iTXNObject,
  2334. const TXNMatchTextRecord * iMatchTextDataPtr, /* can be NULL */
  2335. TXNDataType iDataType,
  2336. TXNMatchOptions iMatchOptions,
  2337. TXNOffset iStartSearchOffset,
  2338. TXNOffset iEndSearchOffset,
  2339. TXNFindUPP iFindProc,
  2340. SInt32 iRefCon,
  2341. TXNOffset * oStartMatchOffset,
  2342. TXNOffset * oEndMatchOffset);
  2343. /*
  2344. ***************************************************************************************************************
  2345. TXNSetFontDefaults
  2346. For a given TXNObject specify the font defaults for each script.
  2347. Input:
  2348. iTXNObject: opaque TXNObject obtained from TXNNewObject.
  2349. iCount: count of FontDescriptions.
  2350. iFontDefaults: array of FontDescriptions.
  2351. Output:
  2352. OSStatus: function result ( memory error, paramErr )
  2353. ****************************************************************************************************************
  2354. */
  2355. /*
  2356. * TXNSetFontDefaults()
  2357. *
  2358. * Availability:
  2359. * Non-Carbon CFM: in Textension 1.0 and later
  2360. * CarbonLib: in CarbonLib 1.0 and later
  2361. * Mac OS X: in version 10.0 and later
  2362. */
  2363. EXTERN_API_C( OSStatus )
  2364. TXNSetFontDefaults(
  2365. TXNObject iTXNObject,
  2366. ItemCount iCount,
  2367. const TXNMacOSPreferredFontDescription iFontDefaults[]);
  2368. /*
  2369. ***************************************************************************************************************
  2370. TXNGetFontDefaults
  2371. For a given TXNObject make a copy of the font defaults.
  2372. Input:
  2373. iTXNObject: opaque TXNObject obtained from TXNNewObject.
  2374. iCount: count of FontDescriptions in the array.
  2375. iFontDefaults: array of FontDescriptins to be filled out.
  2376. Output:
  2377. OSStatus: function result ( memory error, paramErr )
  2378. To determine how many font descriptions need to be in the array you should call this function with
  2379. a NULL for the array. iCount will return with the number of font defaults currently stored.
  2380. ****************************************************************************************************************
  2381. */
  2382. /*
  2383. * TXNGetFontDefaults()
  2384. *
  2385. * Availability:
  2386. * Non-Carbon CFM: in Textension 1.0 and later
  2387. * CarbonLib: in CarbonLib 1.0 and later
  2388. * Mac OS X: in version 10.0 and later
  2389. */
  2390. EXTERN_API_C( OSStatus )
  2391. TXNGetFontDefaults(
  2392. TXNObject iTXNObject,
  2393. ItemCount * ioCount,
  2394. TXNMacOSPreferredFontDescription ioFontDefaults[]); /* can be NULL */
  2395. /*
  2396. ****************************************************************************************************************
  2397. TXNAttachObjectToWindow
  2398. If a TXNObject was initialized with a NULL window pointer use this function to attach a window
  2399. to that object. In version 1.0 of Textension attaching a TXNObject to more than one window
  2400. is not supported. Note that if a CGContextRef was passed to the TXNObject previously thru the
  2401. API TXNSetTXNObjectControls, that CGContextRef will be ignored. The CGContextRef associated with
  2402. the iWindow will be used instead. You may revert back to the previous CGContextRef by calling the
  2403. API TXNSetTXNObjectControls with the desired CGContextRef again after calling TXNAttachObjectToWindow.
  2404. Input:
  2405. iTXNObject: opaque TXNObject obtained from TXNNewObject.
  2406. iWindow: GWorldPtr that the object should be attached to
  2407. iIsActualWindow: Let the library know if the GWorldPtr is actually
  2408. a WindowRef or actually a GWorldPtr. This is important
  2409. if the client is taking advantage of the editing packages
  2410. scrollbar support.
  2411. Output:
  2412. OSStatus: function result. paramErrs.
  2413. ****************************************************************************************************************
  2414. */
  2415. /*
  2416. * TXNAttachObjectToWindow()
  2417. *
  2418. * Availability:
  2419. * Non-Carbon CFM: in Textension 1.0 and later
  2420. * CarbonLib: in CarbonLib 1.0 and later
  2421. * Mac OS X: in version 10.0 and later
  2422. */
  2423. EXTERN_API_C( OSStatus )
  2424. TXNAttachObjectToWindow(
  2425. TXNObject iTXNObject,
  2426. GWorldPtr iWindow,
  2427. Boolean iIsActualWindow);
  2428. /*
  2429. ****************************************************************************************************************
  2430. TXNIsObjectAttachedToWindow
  2431. A utility function that allows a caller to check a TXNObject to see if it is attached
  2432. to a window.
  2433. Input:
  2434. iTXNObject: opaque TXNObject obtained from TXNNewObject.
  2435. Output:
  2436. Boolean: function result. True is object is attached.
  2437. False if TXNObject is not attached.
  2438. ****************************************************************************************************************
  2439. */
  2440. /*
  2441. * TXNIsObjectAttachedToWindow()
  2442. *
  2443. * Availability:
  2444. * Non-Carbon CFM: in Textension 1.0 and later
  2445. * CarbonLib: in CarbonLib 1.0 and later
  2446. * Mac OS X: in version 10.0 and later
  2447. */
  2448. EXTERN_API_C( Boolean )
  2449. TXNIsObjectAttachedToWindow(TXNObject iTXNObject);
  2450. /*
  2451. ****************************************************************************************************************
  2452. TXNDragTracker
  2453. If you ask that Drag handling procs not be installed. Call this when your drag tracker is called
  2454. and you want Textension to take over
  2455. Input:
  2456. iTXNObject: opaque TXNObject obtained from TXNNewObject.
  2457. iTXNFrameID: TXNFrameID obtained from TXNNewObject
  2458. iMessage: drag message obtained from Drag Manager
  2459. iWindow : WindowRef obtained from Drag Manager
  2460. iDragReference: dragReference obtained from Drag Manager
  2461. iDifferentObjectSameWindow: Pass true if the drag is still in the same window
  2462. that it started in. False if the drag has moved into
  2463. a different window.
  2464. Output:
  2465. OSErr: function result. OSErr is used over
  2466. OSStatus so that it matches the Drag Manager definition of Tracking callback
  2467. ****************************************************************************************************************
  2468. */
  2469. /*
  2470. * TXNDragTracker()
  2471. *
  2472. * Availability:
  2473. * Non-Carbon CFM: in Textension 1.0 and later
  2474. * CarbonLib: in CarbonLib 1.0 and later
  2475. * Mac OS X: in version 10.0 and later
  2476. */
  2477. EXTERN_API_C( OSErr )
  2478. TXNDragTracker(
  2479. TXNObject iTXNObject,
  2480. TXNFrameID iTXNFrameID,
  2481. DragTrackingMessage iMessage,
  2482. WindowRef iWindow,
  2483. DragReference iDragReference,
  2484. Boolean iDifferentObjectSameWindow);
  2485. /*
  2486. ****************************************************************************************************************
  2487. TXNDragReceiver
  2488. If you ask that Drag handling procs not be installed. Call this when your drag receiver is called
  2489. and you want Textension to take over
  2490. Input:
  2491. iTXNObject: opaque TXNObject obtained from TXNNewObject.
  2492. iTXNFrameID TXNFrameID obtained from TXNNewObject
  2493. iWindow WindowRef obtained from Drag Manager
  2494. iDragReference dragReference obtained from Drag Manager
  2495. iDifferentObjectSameWindow: Pass true if the drag is still in the same window
  2496. that it started in. False if the drag has moved into
  2497. a different window.
  2498. Output:
  2499. OSErr: function result. OSErr is used over
  2500. OSStatus so that it matches the Drag Manager definition of Tracking callback
  2501. ****************************************************************************************************************
  2502. */
  2503. /*
  2504. * TXNDragReceiver()
  2505. *
  2506. * Availability:
  2507. * Non-Carbon CFM: in Textension 1.0 and later
  2508. * CarbonLib: in CarbonLib 1.0 and later
  2509. * Mac OS X: in version 10.0 and later
  2510. */
  2511. EXTERN_API_C( OSErr )
  2512. TXNDragReceiver(
  2513. TXNObject iTXNObject,
  2514. TXNFrameID iTXNFrameID,
  2515. WindowRef iWindow,
  2516. DragReference iDragReference,
  2517. Boolean iDifferentObjectSameWindow);
  2518. /*
  2519. ****************************************************************************************************************
  2520. TXNActivate
  2521. Make the TXNObject object active in the sense that it can be scrolled if it has scrollbars. If the TXNScrollBarState parameter
  2522. is true than the scrollbars will be active even when the TXNObject is not focused (i.e. insertion point not active)
  2523. This function should be used if you have multiple TXNObjects in a window, and you want them all to be scrollable
  2524. even though only one at a time can have the keyboard focus.
  2525. Input:
  2526. iTXNObject: opaque TXNObject obtained from TXNNewObject.
  2527. iTXNFrameID TXNFrameID obtained from TXNNewObject
  2528. iActiveState Boolean if true Scrollbars active even though TXNObject does not have the keyboard focus.
  2529. if false scrollbars are synced with active state (i.e. a focused object has an
  2530. active insertion point or selection and active scrollbars. An unfocused object has inactive
  2531. selection (grayed or framed selection) and inactive scrollbars. The latter state is the
  2532. default and usually the one you use if you have one TXNObject in a window.
  2533. Output:
  2534. OSStatus: function result. ParamErr if bad iTXNObject or frame ID.
  2535. ****************************************************************************************************************
  2536. */
  2537. /*
  2538. * TXNActivate()
  2539. *
  2540. * Availability:
  2541. * Non-Carbon CFM: in Textension 1.0 and later
  2542. * CarbonLib: in CarbonLib 1.0 and later
  2543. * Mac OS X: in version 10.0 and later
  2544. */
  2545. EXTERN_API_C( OSStatus )
  2546. TXNActivate(
  2547. TXNObject iTXNObject,
  2548. TXNFrameID iTXNFrameID,
  2549. TXNScrollBarState iActiveState);
  2550. /*
  2551. *****************************************************************************************************************
  2552. TXNSetBackgound
  2553. Set the type of background the TXNObject's text, etc. is drawn onto. At this point the background
  2554. can be a color or a picture.
  2555. Input:
  2556. iTXNObject: opaque TXNObject obtained from IncomingDataFilter callback.
  2557. iBackgroundInfo: struct containing information that describes the background
  2558. Output:
  2559. OSStatus: function result. paramErrs.
  2560. ********************************************************************************************************************
  2561. */
  2562. /*
  2563. * TXNSetBackground()
  2564. *
  2565. * Availability:
  2566. * Non-Carbon CFM: in Textension 1.0 and later
  2567. * CarbonLib: in CarbonLib 1.0 and later
  2568. * Mac OS X: in version 10.0 and later
  2569. */
  2570. EXTERN_API_C( OSStatus )
  2571. TXNSetBackground(
  2572. TXNObject iTXNObject,
  2573. const TXNBackground * iBackgroundInfo);
  2574. /*
  2575. *****************************************************************************************************************
  2576. TXNEchoMode
  2577. Put the TXNObject into echo mode. What that means is that all characters in the TXNObject have the character
  2578. 'echoCharacter' substituted for the actual glyph when drawing occurs. Note that the echoCharacter is typed
  2579. as a UniChar, but this is done merely to facilitate passing any 2 byte character. The encoding parameter
  2580. actually determines the encoding used to locate a font and display a character. Thus if you wanted to
  2581. display the diamond found in the Shift-JIS encoding for MacOS you would pass in 0x86A6 for the character
  2582. but an encoding that was built to represent the MacOS Japanese encoding.
  2583. Input:
  2584. iTXNObject: opaque TXNObject obtained from IncomingDataFilter callback.
  2585. iEchoCharacter: character to use in substitution
  2586. iEncoding: encoding from which character is drawn.
  2587. iOn: true if turning EchoMode on. False if turning it off.
  2588. Output:
  2589. OSStatus: function result. paramErrs.
  2590. ********************************************************************************************************************
  2591. */
  2592. /*
  2593. * TXNEchoMode()
  2594. *
  2595. * Availability:
  2596. * Non-Carbon CFM: in Textension 1.0 and later
  2597. * CarbonLib: in CarbonLib 1.0 and later
  2598. * Mac OS X: in version 10.0 and later
  2599. */
  2600. EXTERN_API_C( OSStatus )
  2601. TXNEchoMode(
  2602. TXNObject iTXNObject,
  2603. UniChar iEchoCharacter,
  2604. TextEncoding iEncoding,
  2605. Boolean iOn);
  2606. /*
  2607. ********************************************************************************************************************
  2608. TXNNewFontMenuObject
  2609. Get a FontMenuObject. Caller can extract a fontmenu from this object and pass this object to the active
  2610. TXNObject to handle events in the font menu.
  2611. Input:
  2612. iFontMenuHandle: An empty menu handle (well the title is there) that the caller created via
  2613. NewMenu or GetNewMenu. This menu handle should not be disposed before
  2614. the returned TXNFontMenuObject has been disposed via TXNDisposeFontMenuObject.
  2615. iMenuID: The MenuID for iFontMenuHandle.
  2616. iStartHierMenuID: The first MenuID to use if any hierarchical menus need to be created. TXNNewFontMenuObject
  2617. uses SetMenuItemHierarchicalID when creating hierarchial menus. The iStartHierMenuID must
  2618. therefor follow the rules for this function. On systems less than system 8.5 the submenuID
  2619. must be less than 255. For systems above system 8.5 the range can be as large can be as large
  2620. 32767. However, it is important to remember that TXNNewFontMenuObject only uses iStartHierMenuID
  2621. as a starting id when adding hierarchical menus. Therefore provide plenty of room to increment
  2622. this value. For example, on a system less than 8.5 it would be good to start at 175. On systems greater
  2623. than 8.5 it is probably a good idea to not use a value higher than 32000.
  2624. Output:
  2625. OSStatus: function result. memory, parameter errors.
  2626. TXNFontMenuObject: A font menu object
  2627. *********************************************************************************************************************
  2628. */
  2629. /*
  2630. * TXNNewFontMenuObject()
  2631. *
  2632. * Availability:
  2633. * Non-Carbon CFM: in Textension 1.0 and later
  2634. * CarbonLib: in CarbonLib 1.0 and later
  2635. * Mac OS X: in version 10.0 and later
  2636. */
  2637. EXTERN_API_C( OSStatus )
  2638. TXNNewFontMenuObject(
  2639. MenuRef iFontMenuHandle,
  2640. SInt16 iMenuID,
  2641. SInt16 iStartHierMenuID,
  2642. TXNFontMenuObject * oTXNFontMenuObject);
  2643. /*
  2644. *********************************************************************************************************************
  2645. TXNGetFontMenuHandle
  2646. Get the MenuRef from the TXNFontMenuObject.
  2647. Input:
  2648. iTXNFontMenuObject: A Font Menu Object obtained from TXNNewFontMenuObject.
  2649. Output:
  2650. OSStatus: function result. parameter errors.
  2651. oFontMenuHandle: The returned font menu. (returned value could be NULL)
  2652. *********************************************************************************************************************
  2653. */
  2654. /*
  2655. * TXNGetFontMenuHandle()
  2656. *
  2657. * Availability:
  2658. * Non-Carbon CFM: in Textension 1.0 and later
  2659. * CarbonLib: in CarbonLib 1.0 and later
  2660. * Mac OS X: in version 10.0 and later
  2661. */
  2662. EXTERN_API_C( OSStatus )
  2663. TXNGetFontMenuHandle(
  2664. TXNFontMenuObject iTXNFontMenuObject,
  2665. MenuRef * oFontMenuHandle);
  2666. #define TXNGetFontMenuRef TXNGetFontMenuHandle
  2667. /*
  2668. *********************************************************************************************************************
  2669. TXNDisposeFontMenuObject
  2670. Dispose a TXNFontMenuObject and its font menu handle
  2671. Input:
  2672. iTXNFontMenuObject: A Font Menu Object obtained from TXNNewFontMenuObject.
  2673. Output:
  2674. OSStatus: function result. parameter errors.
  2675. *********************************************************************************************************************
  2676. */
  2677. /*
  2678. * TXNDisposeFontMenuObject()
  2679. *
  2680. * Availability:
  2681. * Non-Carbon CFM: in Textension 1.0 and later
  2682. * CarbonLib: in CarbonLib 1.0 and later
  2683. * Mac OS X: in version 10.0 and later
  2684. */
  2685. EXTERN_API_C( OSStatus )
  2686. TXNDisposeFontMenuObject(TXNFontMenuObject iTXNFontMenuObject);
  2687. /*
  2688. *********************************************************************************************************************
  2689. TXNDoFontMenuSelection
  2690. Given the menuID and menu item returned by MenuSelect determine the selected font
  2691. and change the current selection to be that Font. If the input TXNObject is
  2692. not active a parameter error is returned.
  2693. Input:
  2694. iTXNObject: An opaque TXNObject obtained from TXNNewObject.
  2695. iTXNFontMenuObject: A Font Menu Object obtained from TXNNewFontMenuObject.
  2696. iMenuID: SInt16 the ID of the selected menu.
  2697. iMenuItem: The item that was selected.
  2698. Output:
  2699. OSStatus: ParamErr and memory errors are possible.
  2700. **********************************************************************************************************************
  2701. */
  2702. /*
  2703. * TXNDoFontMenuSelection()
  2704. *
  2705. * Availability:
  2706. * Non-Carbon CFM: in Textension 1.0 and later
  2707. * CarbonLib: in CarbonLib 1.0 and later
  2708. * Mac OS X: in version 10.0 and later
  2709. */
  2710. EXTERN_API_C( OSStatus )
  2711. TXNDoFontMenuSelection(
  2712. TXNObject iTXNObject,
  2713. TXNFontMenuObject iTXNFontMenuObject,
  2714. SInt16 iMenuID,
  2715. SInt16 iMenuItem);
  2716. /*
  2717. * TXNPrepareFontMenu()
  2718. *
  2719. * Summary:
  2720. * Prepares a Font menu for display.
  2721. *
  2722. * Discussion:
  2723. * You should call the TXNPrepareFontMenu function just before your
  2724. * application opens the Font menu for your user. If the text
  2725. * object's current selection is a single font, MLTE places a
  2726. * checkmark next to the menu item for that font.
  2727. *
  2728. * Parameters:
  2729. *
  2730. * iTXNObject:
  2731. * The text object that identifies the document with the Font menu
  2732. * you want to prepare. Pass NULL to display an inactive menu
  2733. * (dimmed).
  2734. *
  2735. * iTXNFontMenuObject:
  2736. * A Font menu object.
  2737. *
  2738. * Result:
  2739. * An operating system status code.
  2740. *
  2741. * Availability:
  2742. * Non-Carbon CFM: in Textension 1.0 and later
  2743. * CarbonLib: in CarbonLib 1.0 and later
  2744. * Mac OS X: in version 10.0 and later
  2745. */
  2746. EXTERN_API_C( OSStatus )
  2747. TXNPrepareFontMenu(
  2748. TXNObject iTXNObject, /* can be NULL */
  2749. TXNFontMenuObject iTXNFontMenuObject);
  2750. /*
  2751. **********************************************************************************************************************
  2752. TXNVersionValue
  2753. Get the version number and a set of feature bits. TXNVersionValue uses a NumVersion structure.
  2754. See MacTypes.h for the format of the version. Currently there are two feature bits: one for
  2755. ATSUI default, another one for CarbonEvent default.
  2756. Input:
  2757. NONE
  2758. Output:
  2759. TXNVersionValue: Current version.
  2760. TXNFeatureBits*: Pointer to a bit mask. See TXNFeatureMask enum above. If kTXNWillDefaultToATSUIBit
  2761. is set it means that by default MLTE will use ATSUI to image and measure text and will
  2762. default to using Unicode to store characters. If kTXNWillDefaultToCarbonEventBit is set,
  2763. then MLTE will use carbon events by default and apple event will not be supported.
  2764. **********************************************************************************************************************
  2765. */
  2766. /*
  2767. * TXNVersionInformation()
  2768. *
  2769. * Availability:
  2770. * Non-Carbon CFM: in Textension 1.0 and later
  2771. * CarbonLib: in CarbonLib 1.0 and later
  2772. * Mac OS X: in version 10.0 and later
  2773. */
  2774. EXTERN_API_C( TXNVersionValue )
  2775. TXNVersionInformation(TXNFeatureBits * oFeatureFlags);
  2776. /*
  2777. * TXNIsObjectAttachedToSpecificWindow()
  2778. *
  2779. * Summary:
  2780. * Determines whether the given object is attached to the given
  2781. * window.
  2782. *
  2783. * Parameters:
  2784. *
  2785. * iTXNObject:
  2786. * Opaque TXNObject obtained from TXNNewObject.
  2787. *
  2788. * iWindow:
  2789. * The window to check attachment against.
  2790. *
  2791. * oAttached:
  2792. * true if the object is attached to the given window, false
  2793. * otherwise.
  2794. *
  2795. * Result:
  2796. * An operating system status code.
  2797. *
  2798. * Availability:
  2799. * Non-Carbon CFM: in Textension 1.2 and later
  2800. * CarbonLib: in CarbonLib 1.3 and later
  2801. * Mac OS X: in version 10.0 and later
  2802. */
  2803. EXTERN_API_C( OSStatus )
  2804. TXNIsObjectAttachedToSpecificWindow(
  2805. TXNObject iTXNObject,
  2806. WindowRef iWindow,
  2807. Boolean * oAttached);
  2808. /*
  2809. * TXNSetRectBounds()
  2810. *
  2811. * Summary:
  2812. * Set the View rectangle and or the Destination rectangle.
  2813. *
  2814. * Discussion:
  2815. * The View rectangle controls the text you see. The Destination
  2816. * rectangle controls how text is laid out. The Scrollbar is drawn
  2817. * inside the View rectangle. You only need to pass in pointers for
  2818. * the rectangles you want to set.
  2819. *
  2820. * Parameters:
  2821. *
  2822. * iTXNObject:
  2823. * Opaque TXNObject obtained from TXNNewObject.
  2824. *
  2825. * iViewRect:
  2826. * The new view rectangle. If you do not want to change the view
  2827. * rectangle pass NULL.
  2828. *
  2829. * iDestinationRect:
  2830. * The new destination rectangle. Pass NULL if you don't want to
  2831. * change the destination retangle.
  2832. *
  2833. * iUpdate:
  2834. * If you would like the the text and where the scrollbars are
  2835. * placed recalculated and redrawn pass true. If you prefer to
  2836. * wait on this pass false.
  2837. *
  2838. * Availability:
  2839. * Non-Carbon CFM: not available
  2840. * CarbonLib: in CarbonLib 1.5 and later
  2841. * Mac OS X: in version 10.1 and later
  2842. */
  2843. EXTERN_API_C( void )
  2844. TXNSetRectBounds(
  2845. TXNObject iTXNObject,
  2846. const Rect * iViewRect, /* can be NULL */
  2847. const TXNLongRect * iDestinationRect, /* can be NULL */
  2848. Boolean iUpdate);
  2849. /*
  2850. * TXNGetRectBounds()
  2851. *
  2852. * Summary:
  2853. * Get the values for the current View rectangle, Destination
  2854. * rectangle and Text rectangle.
  2855. *
  2856. * Discussion:
  2857. * You only need to pass in pointers for the rectangles you're
  2858. * interested in.
  2859. *
  2860. * Parameters:
  2861. *
  2862. * iTXNObject:
  2863. * Opaque TXNObject obtained from TXNNewObject.
  2864. *
  2865. * oViewRect:
  2866. * The current view rectangle
  2867. *
  2868. * oDestinationRect:
  2869. * The current destination rectangle
  2870. *
  2871. * oTextRect:
  2872. * The smallest rectangle needed to contain the current text.
  2873. * This rectangle is calculated by walking the lines of text and
  2874. * measuring each line. So this can be expensive. The width of
  2875. * this rectangle will be the width of the longest line in the
  2876. * text.
  2877. *
  2878. * Result:
  2879. * An operating system status code.
  2880. *
  2881. * Availability:
  2882. * Non-Carbon CFM: not available
  2883. * CarbonLib: in CarbonLib 1.5 and later
  2884. * Mac OS X: in version 10.1 and later
  2885. */
  2886. EXTERN_API_C( OSStatus )
  2887. TXNGetRectBounds(
  2888. TXNObject iTXNObject,
  2889. Rect * oViewRect, /* can be NULL */
  2890. TXNLongRect * oDestinationRect, /* can be NULL */
  2891. TXNLongRect * oTextRect); /* can be NULL */
  2892. /*
  2893. * TXNRecalcTextLayout()
  2894. *
  2895. * Summary:
  2896. * Recalculates the text layout based on the new View and
  2897. * Destination rectangles.
  2898. *
  2899. * Discussion:
  2900. * Call this if you called TXNSetRectBounds with the iUpdate
  2901. * parameter set to false. It will also recalcuate where the
  2902. * scrollbars, if any, should be placed. Finally an update event
  2903. * will be generated so that the TXNObject is redrawn.
  2904. *
  2905. * Parameters:
  2906. *
  2907. * iTXNObject:
  2908. * Opaque TXNObject obtained from TXNNewObject.
  2909. *
  2910. * Availability:
  2911. * Non-Carbon CFM: not available
  2912. * CarbonLib: in CarbonLib 1.5 and later
  2913. * Mac OS X: in version 10.1 and later
  2914. */
  2915. EXTERN_API_C( void )
  2916. TXNRecalcTextLayout(TXNObject iTXNObject);
  2917. /*
  2918. * TXNScroll()
  2919. *
  2920. * Discussion:
  2921. * TXNScroll scrolls the text within a view rectangle of the
  2922. * specified object by the designated number of units. For example,
  2923. * you might want to scroll the text in an object in response to
  2924. * user input in a control other than the standard scrollbars that
  2925. * MLTE supplies.
  2926. *
  2927. * Parameters:
  2928. *
  2929. * iTXNObject:
  2930. * Opaque TXNObject obtained from TXNNewObject.
  2931. *
  2932. * iVerticalScrollUnit:
  2933. * Specifies what units the values in ioVerticalDelta are in. If
  2934. * iVerticalScrollUnit is equal to kTXNScrollUnitsArePixels the
  2935. * value is treated as pixels. If the value is
  2936. * kTXNScrollUnitsAreLines the value is treated as a count of
  2937. * lines. Note that using this value is the slowest because each
  2938. * line must be measured before it scrolls. Finally if
  2939. * kTXNScrollUnitsAreViewRects the value is treated as the height
  2940. * of the current viewRect.
  2941. *
  2942. * iHorizontalScrollUnit:
  2943. * Specifies what units the values in iDh are in. If
  2944. * iHorizontalScrollUnit is equal to kTXNScrollUnitsArePixels the
  2945. * value is treated as pixels. If the value is
  2946. * kTXNScrollUnitsAreLines the value is treated as a count of
  2947. * lines. Note that using this value for horizontal scrolling
  2948. * means that 16 pixels will be used to represent a line. Finally
  2949. * if kTXNScrollUnitsAreViewRects the value is treated as the
  2950. * width of the current viewRect.
  2951. *
  2952. * ioVerticalDelta:
  2953. * The vertical amount to scroll. The values in ioVerticalDelta
  2954. * can be treated as pixels, lines or viewrects. See the
  2955. * discussion of the TXNScrollUnit parameters for more information
  2956. * for this. On return this will contain the number of pixels
  2957. * actually scrolled in the vertical direction. A positive value
  2958. * moves the text down.
  2959. *
  2960. * ioHorizontalDelta:
  2961. * The horizontal amount to scroll. The values in
  2962. * ioHorizontalDelta can specify a scroll amount that is pixels,
  2963. * lines or view rects. Set TXNScrollUnit discussion for more
  2964. * information. On return this will contain the number of pixels
  2965. * actually scrolled in the horizontal direction. A positive value
  2966. * moves the text to the right.
  2967. *
  2968. * Availability:
  2969. * Non-Carbon CFM: in Textension not yet available
  2970. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  2971. * Mac OS X: in version 10.2 and later
  2972. */
  2973. EXTERN_API_C( OSStatus )
  2974. TXNScroll(
  2975. TXNObject iTXNObject,
  2976. TXNScrollUnit iVerticalScrollUnit,
  2977. TXNScrollUnit iHorizontalScrollUnit,
  2978. SInt32 * ioVerticalDelta,
  2979. SInt32 * ioHorizontalDelta);
  2980. /*
  2981. * TXNRegisterScrollInfoProc()
  2982. *
  2983. * Discussion:
  2984. * If your application is drawing and handling its own scrolling
  2985. * widgets use this function to register a TXNScrollInfoUPP. If you
  2986. * register a TXNScrollInfoUPP it will be called every time MLTE
  2987. * would normally update the values and maximum values of an MLTE
  2988. * scrollbar. For example when the user types the return key to add
  2989. * a new line at the end of their text MLTE will calculate a new
  2990. * maximum value. If you have registered a TXNScrollInfoUPP it will
  2991. * be called with this nex maximum value. To turn off the callbacks
  2992. * call TXNRegisterScrollInfoProc with a value of NULL for the
  2993. * iTXNScrollInfoUPP.
  2994. *
  2995. * Parameters:
  2996. *
  2997. * iTXNObject:
  2998. * Opaque TXNObject obtained from TXNNewObject.
  2999. *
  3000. * iTXNScrollInfoUPP:
  3001. * A universal procedure pointer.
  3002. *
  3003. * iRefCon:
  3004. * A refcon that is passed to the callback.
  3005. *
  3006. * Availability:
  3007. * Non-Carbon CFM: in Textension not yet available
  3008. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  3009. * Mac OS X: in version 10.2 and later
  3010. */
  3011. EXTERN_API_C( void )
  3012. TXNRegisterScrollInfoProc(
  3013. TXNObject iTXNObject,
  3014. TXNScrollInfoUPP iTXNScrollInfoUPP,
  3015. SInt32 iRefCon);
  3016. /*
  3017. * TXNClearUndo()
  3018. *
  3019. * Summary:
  3020. * Purge the undo stack
  3021. *
  3022. * Parameters:
  3023. *
  3024. * iTXNObject:
  3025. * Opaque TXNObject obtained from TXNNewObject.
  3026. *
  3027. * Availability:
  3028. * Non-Carbon CFM: in Textension not yet available
  3029. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  3030. * Mac OS X: in version 10.2 and later
  3031. */
  3032. EXTERN_API_C( OSStatus )
  3033. TXNClearUndo(TXNObject iTXNObject);
  3034. #if PRAGMA_STRUCT_ALIGN
  3035. #pragma options align=reset
  3036. #elif PRAGMA_STRUCT_PACKPUSH
  3037. #pragma pack(pop)
  3038. #elif PRAGMA_STRUCT_PACK
  3039. #pragma pack()
  3040. #endif
  3041. #ifdef PRAGMA_IMPORT_OFF
  3042. #pragma import off
  3043. #elif PRAGMA_IMPORT
  3044. #pragma import reset
  3045. #endif
  3046. #ifdef __cplusplus
  3047. }
  3048. #endif
  3049. #endif /* __MACTEXTEDITOR__ */