home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Headers / appkit / Text.h < prev    next >
Text File  |  1992-07-21  |  23KB  |  708 lines

  1. /*
  2.     Text.h
  3.     Application Kit, Release 2.1J
  4.     Copyright (c) 1988, NeXT, Inc.  All rights reserved. 
  5. */
  6.  
  7. #ifndef TEXT_H
  8. #define TEXT_H
  9. #import "View.h"
  10. #import "chunk.h"
  11. #import "color.h"
  12. #import "FontManager.h"
  13. #import "readOnlyTextStream.h"
  14. #import "NXSpellChecker.h"
  15. #import "NXRTFDErrors.h"
  16.  
  17. #ifdef KANJI
  18. typedef wchar_t wchar;                // Basic character type
  19. #else KANJI
  20. typedef unsigned char wchar;            // Basic character type
  21. #endif KANJI
  22.  
  23. #define NX_TEXTPER 512
  24.  
  25. typedef struct _NXTextBlock {
  26.     struct _NXTextBlock *next;        /* next text block in link list */
  27.     struct _NXTextBlock *prior;        /* previous text block in link list */
  28.     struct _tbFlags {
  29.     unsigned int    malloced:1;    /* true if block was malloced */
  30.     unsigned int    PAD:15;
  31.     } tbFlags;
  32.     short           chars;        /* number of chars in this block */
  33.     wchar  *text;            /* the text */
  34. } NXTextBlock;
  35.  
  36. /*
  37.  *  NXRun represents a single run of text w/ a given format
  38.  */
  39.   
  40. typedef struct {
  41.     unsigned int underline:1;
  42.     unsigned int dummy:1;        /* unused */
  43.     unsigned int subclassWantsRTF:1;
  44.     unsigned int graphic:1;
  45.     unsigned int forcedSymbol:1;    /* did alt-char force use to use symbol */
  46.     unsigned int RESERVED:11;
  47. } NXRunFlags;
  48.  
  49. typedef struct _NXRun {
  50.     id   UEX       font;    /* Font id */
  51.     int             chars;    /* number of chars in run */
  52.     void           *paraStyle;    /* implementation dependent paraStyle
  53.                  * sheet info. */
  54.     float        textGray;    /* text gray of current run */
  55.     int            textRGBColor;    /* text color negative if not set */
  56.     unsigned char   superscript;/* superscript in points */
  57.     unsigned char   subscript;    /* subscript in points */
  58.     id          info;    /* available for subclasses of Text */
  59.     NXRunFlags rFlags;
  60. } NXRun;
  61.  
  62. /*
  63.  *  NXRunArray is a NXChunk that holds the set of formats for a Text object
  64.  */
  65.  
  66. typedef struct _NXRunArray {
  67.     NXChunk         chunk;
  68.     NXRun           runs[1];
  69. } NXRunArray;
  70.  
  71. /*
  72.  * NXBreakArray is a NXChunk that holds line break information for a Text
  73.  * Object. it is mostly an array of line descriptors.  each line
  74.  * descriptor contains 3 fields: 
  75.  *
  76.  *     1) line change bit (sign bit), set if this line defines a new height 
  77.  *     2) paragraph end bit (next to sign bit), set if the end of this 
  78.  *       line ends the paragraph 
  79.  *     3) numbers of characters in the line (low order 14 bits) 
  80.  *
  81.  * if the line change bit is set, the descriptor is the first field of a
  82.  * NXHeightChange. since this record is bracketed by negative short
  83.  * values, the breaks array can be sequentially accessed backwards and
  84.  * forwards. 
  85.  */
  86.  
  87. typedef short NXLineDesc;
  88.  
  89. typedef struct _NXHeightInfo {
  90.     NXCoord         newHeight;    /* line height from here forward */
  91.     NXCoord         oldHeight;    /* height before change */
  92.     NXLineDesc      lineDesc;    /* line descriptor */
  93. } NXHeightInfo;
  94.  
  95. typedef struct _NXHeightChange {
  96.     NXLineDesc      lineDesc;    /* line descriptor */
  97.     NXHeightInfo    heightInfo;
  98. } NXHeightChange;
  99.  
  100. typedef struct _NXBreakArray {
  101.     NXChunk         chunk;
  102.     NXLineDesc      breaks[1];
  103. } NXBreakArray;
  104.  
  105. /*
  106.  * NXLay represents a single run of text in a line and records
  107.  * everything needed to select or draw that piece.
  108.  */
  109.  
  110. typedef struct {
  111.     unsigned int mustMove:1;    /* unimplemented */
  112.     unsigned int isMoveChar:1;
  113.     unsigned int RESERVED:14;
  114. } NXLayFlags;
  115.  
  116. typedef struct _NXLay {
  117.     NXCoord         x;        /* x coordinate of moveto */
  118.     NXCoord         y;        /* y coordinate of moveto */
  119.     short           offset;    /* offset in line array for text */
  120.     short           chars;    /* number of characters in lay */
  121. UEYid              font;    /* font id */
  122.     void           *paraStyle;    /* implementation dependent fontStyle
  123.                  * sheet info. */
  124.     NXRun *run;            /* run for lay */
  125.     NXLayFlags        lFlags;
  126. } NXLay;
  127.  
  128. /*
  129.  *  NXLayArray is a NXChunk that holds the layout for the current line
  130.  */
  131.  
  132. typedef struct _NXLayArray {
  133.     NXChunk         chunk;
  134.     NXLay           lays[1];
  135. } NXLayArray;
  136.  
  137. /*
  138.  *  NXWidthArray is a NXChunk that holds the widths for the current line
  139.  */
  140.  
  141. typedef struct _NXWidthArray {
  142.     NXChunk         chunk;
  143.     NXCoord         widths[1];
  144. } NXWidthArray;
  145.  
  146. /*
  147.  *  NXCharArray is a NXChunk that holds the chars for the current line
  148.  */
  149.  
  150. typedef struct _NXCharArray {
  151.     NXChunk         chunk;
  152.     wchar       text[1];
  153. } NXCharArray;
  154.  
  155. /*
  156.  *  Word definition Finite State Machine transition struct
  157.  */
  158. typedef struct _NXFSM {
  159.     const struct _NXFSM  *next;    /* state to go to, NULL implies final state */
  160.     short           delta;    /* if final state, this undoes lookahead */
  161.     short           token;    /* if final state, < 0 word is newline,
  162.                  * = is dark, > is white space */
  163. } NXFSM;
  164.  
  165. /*
  166.  *  Represents one end of a selection
  167.  */
  168.  
  169. typedef struct _NXSelPt {
  170.     int             cp;        /* character position */
  171.     int             line;    /* offset of LineDesc in break table */
  172.     NXCoord         x;        /* x coordinate */
  173.     NXCoord         y;        /* y coordinate */
  174.     int             c1st;    /* character position of first character
  175.                  * on the line */
  176.     NXCoord         ht;        /* line height */
  177. } NXSelPt;
  178.  
  179. /*
  180.  *  describes tabstop
  181.  */
  182.  
  183. typedef struct _NXTabStop {
  184.     short           kind;    /* only NX_LEFTTAB implemented*/
  185.     NXCoord         x;        /* x coordinate for stop */
  186. } NXTabStop;
  187.  
  188. typedef struct _NXTextCache {
  189.     int curPos;            /* current position in text stream */
  190.     NXRun *curRun;        /* cache current block of text and */
  191.     int runFirstPos;        /* character pos that corresponds */
  192.     NXTextBlock *curBlock;    /* cache current block of text and */
  193.     int blockFirstPos;        /* character pos that corresponds */
  194. } NXTextCache;
  195.  
  196. typedef struct _NXLayInfo {
  197.     NXRect rect;        /* bounds rect for current line. */
  198.     NXCoord descent;        /* descent for current line, can be reset
  199.                  * by scanFunc */
  200.     NXCoord width;        /* width of line */
  201.     NXCoord left;        /* left side visible coordinate */
  202.     NXCoord right;        /* right side visible cooUE`ate */
  203.     NXCoord rightIndent;    /* how much white space is left at right
  204.                  * side of line */
  205.     NXLayArray *lays;        /* scanFunc fills with NXLay items */
  206.     NXWidthArray *widths;    /* scanFunc fills with character widths */
  207.     NXCharArray *chars;        /* scanFunc fills with characters */
  208.     NXTextCache cache;        /* cache of current block & run */
  209.     NXRect *textClipRect;    /* if non-nil, the current clip for drawing */
  210.     struct _lFlags {
  211.     unsigned int horizCanGrow:1;/* 1 if scanFunc should perform dynamic
  212.                  * growing of x margins */
  213.     unsigned int vertCanGrow:1;/* 1 if scanFunc should perform dynamic
  214.                  * growing of y margins */
  215.     unsigned int erase:1;    /* used to tell drawFunc to erase before
  216.                  * drawing line  */
  217.     unsigned int ping:1;    /* used to tell drawFunc to ping server */
  218.     unsigned int endsParagraph:1;/* true if line ends the paragraph, eg
  219.                  * ends in newline */
  220.     unsigned int resetCache:1;/* used in scanFunc to reset local caches */
  221.     unsigned int RESERVED:10;
  222.     } lFlags;
  223. } NXLayInfo;
  224.  
  225. /*
  226.  *  Gives a paragraph fontStyle
  227.  */
  228.  
  229. typedef struct _NXTextStyle {
  230.     NXCoord         indent1st;    /* how far first line in paragraph is
  231.                  * indented */
  232.     NXCoord         indent2nd;    /* how far second line is indented */
  233.     NXCoord         lineHt;    /* line height */
  234.     NXCoord         descentLine;/* distance to ascent line from bottom of
  235.                  * line */
  236.     short           alignment;    /* justification */
  237.     short           numTabs;    /* number of tab stops */
  238.     NXTabStop      *tabs;    /* array of tab stops */
  239. } NXTextStyle;
  240.  
  241. /* justification modes */
  242.  
  243. #define NX_LEFTALIGNED 0
  244. #define NX_RIGHTALIGNED 1
  245. #define NX_CENTERED 2
  246. #define NX_JUSTIFIED 3
  247.  
  248. /* tab stop fontStyles */
  249.  
  250. #define NX_LEFTTAB 0
  251.  
  252. #define NX_BACKSPACE  8
  253. #define NX_CR 13
  254. #define NX_DELETE ((unsigned short)0x7F)
  255. #define NX_BTAB 25
  256.  
  257. /* movement codes for movement between fields */
  258.  
  259. #define NX_ILLEGAL     0
  260. #define NX_RETURN     ((unsigned short)0x10)
  261. #define NX_TAB         ((unsigned short)0x11)
  262. #define NX_BACKTAB     ((unsigned short)0x12)
  263. #define NX_LEFT     ((unsigned short)0x13)
  264. #define NX_RIGHT     ((unsigned short)0x14)
  265. #define NX_UP         ((unsigned short)0x15)
  266. #define NX_DOWN     ((unsigned short)0x16)
  267.  
  268. typedef enum {
  269.     NX_LEFTALIGN = NX_LEFTALIGNED,
  270.     NX_RIGHTALIGN = NX_RIGHTALIGNED,
  271.     NX_CENTERALIGN = NX_CENTERED,
  272.     NX_JUSTALIGN = NX_JUSTIFIED,
  273.     NX_FIRSUEaENT,
  274.     NX_INDENT,
  275.     NX_ADDTAB,
  276.     NX_REMOVETAB,
  277.     NX_LEFTMARGIN,
  278.     NX_RIGHTMARGIN
  279. } NXParagraphProp;
  280.  
  281.  
  282. /* 
  283.     Word tables for various languages.  The SmartLeft and SmartRight arrays
  284.     are suitable as arguments for the messages setPreSelSmartTable: and
  285.     setPostSelSmartTable.  When doing a paste, if the character to the left
  286.     (right) of the new word is not in the left (right) table, an extra space
  287.     is added on that side.  The CharCats tables define the character classes
  288.     used in the word wrap or click tables.  The BreakTables are finite state
  289.     machines that determine word wrapping.  The ClickTables are finite state
  290.     machines that determine which characters are selected when the user
  291.     double clicks.
  292. */
  293.  
  294. extern const unsigned char * const NXEnglishSmartLeftChars;
  295. extern const unsigned char * const NXEnglishSmartRightChars;
  296. extern const unsigned char * const NXEnglishCharCatTable;
  297. extern const NXFSM * const NXEnglishBreakTable;
  298. extern const int NXEnglishBreakTableSize;
  299. extern const NXFSM * const NXEnglishNoBreakTable;
  300. extern const int NXEnglishNoBreakTableSize;
  301. extern const NXFSM * const NXEnglishClickTable;
  302. extern const int NXEnglishClickTableSize;
  303.  
  304. extern const unsigned char * const NXCSmartLeftChars;
  305. extern const unsigned char * const NXCSmartRightChars;
  306. extern const unsigned char * const NXCCharCatTable;
  307. extern const NXFSM * const NXCBreakTable;
  308. extern const int NXCBreakTableSize;
  309. extern const NXFSM * const NXCClickTable;
  310. extern const int NXCClickTableSize;
  311.  
  312. typedef int (*NXTextFunc) (id self, NXLayInfo *layInfo);
  313. typedef unsigned short (*NXCharFilterFunc) (
  314.     unsigned short charCode, int flags, unsigned short charSet);
  315. typedef char  *(*NXTextFilterFunc) (
  316.     id self, unsigned char * insertText, int *insertLength, int position);
  317. #ifdef KANJI
  318. typedef BOOL (*NXclickFunc) ( id self, int clickPos, NXSelPt * left, NXSelPt * right ) ;
  319. #endif
  320.  
  321. @interface Text : View <NXReadOnlyTextStream, NXSelectText, NXChangeSpelling, NXIgnoreMisspelledWords>
  322. {
  323.     const NXFSM        *breakTable;
  324.     const NXFSM        *clickTable;
  325.     const unsigned char *preSelSmartTable;
  326.     const unsigned char *postSelSmartTable;
  327.     const unsigned char *charCategoryTable;
  328.     char                delegateMethods;
  329.     NXCharFilterFunc    charFilterFunc;
  330.     NXTextFilterFunc    textFilterFunc;
  331.     char       UEb    *_compilerErrorSpacer;
  332.     NXTextFunc          scanFunc;
  333.     NXTextFunc          drawFunc;
  334.     id                  delegate;
  335.     int                 tag;
  336.     DPSTimedEntry       cursorTE;
  337.     NXTextBlock        *firstTextBlock;
  338.     NXTextBlock        *lastTextBlock;
  339.     NXRunArray         *theRuns;
  340.     NXRun               typingRun;
  341.     NXBreakArray       *theBreaks;
  342.     int                 growLine;
  343.     int                 textLength;
  344.     NXCoord             maxY;
  345.     NXCoord             maxX;
  346.     NXRect              bodyRect;
  347.     NXCoord             borderWidth;
  348.     char                clickCount;
  349.     NXSelPt             sp0;
  350.     NXSelPt             spN;
  351.     NXSelPt             anchorL;
  352.     NXSelPt             anchorR;
  353.     float               backgroundGray;
  354.     float               textGray;
  355.     float               selectionGray;
  356.     NXSize              maxSize;
  357.     NXSize              minSize;
  358.     struct _tFlags {
  359.     unsigned int        _editMode:2;
  360.     unsigned int        _selectMode:2;
  361.     unsigned int        _caretState:2;
  362.     unsigned int        changeState:1;
  363.     unsigned int        charWrap:1;
  364.     unsigned int        haveDown:1;
  365.     unsigned int        anchorIs0:1;
  366.     unsigned int        horizResizable:1;
  367.     unsigned int        vertResizable:1;
  368.     unsigned int        overstrikeDiacriticals:1;
  369.     unsigned int        monoFont:1;
  370.     unsigned int        disableFontPanel:1;
  371.     unsigned int        inClipView:1;
  372.     }                   tFlags;
  373.     void               *_info;
  374.     NXStream           *textStream;
  375.     unsigned int        _reservedText1;
  376.     unsigned int        _reservedText2;
  377. }
  378.  
  379. + initialize;
  380. + excludeFromServicesMenu:(BOOL)flag;
  381. + getDefaultFont;
  382. + setDefaultFont:anObject;
  383.  
  384. - initFrame:(const NXRect *)frameRect text:(const char *)theText alignment:(int)mode;
  385. - initFrame:(const NXRect *)frameRect;
  386. - free;
  387. - renewRuns:(NXRunArray *)newRuns text:(const char *)newText frame:(const NXRect *)newFrame tag:(int)newTag;
  388. - renewFont:newFontId text:(const char *)newText frame:(const NXRect *)newFrame tag:(int)newTag;
  389. - renewFont:(const char *)newFontName size:(float)newFontSize style:(int)newFontStyle text:(const char *)newText frame:(const NXRect *)newFrame tag:(int)newTag;
  390. - setEditable:(BOOL)flag;
  391. - (BOOL)isEditable;
  392. - adjustPageHeightNew:(float *)newBottom top:(float)oldTop bottom:(float)oldBottom limit:(float)bottomLimit;
  393. - gUEcragraph:(int)prNumber start:(int *)startPos end:(int *)endPos rect:(NXRect *)paragraphRect;
  394. - (int)textLength;
  395. - (int)byteLength;
  396. - (int)getSubstring:(char *)buf start:(int)startPos length:(int)numChars;
  397. - setText:(const char *)aString;
  398. - readText:(NXStream *)stream;
  399. - readRichText:(NXStream *)stream;
  400. - writeText:(NXStream *)stream;
  401. - writeRichText:(NXStream *)stream;
  402. - writeRichText:(NXStream *)stream from:(int)start to:(int)end;
  403. - setCharFilter:(NXCharFilterFunc)aFunc;
  404. - (NXCharFilterFunc)charFilter;
  405. - setTextFilter:(NXTextFilterFunc)aFunc;
  406. - (NXTextFilterFunc)textFilter;
  407. - (const unsigned char *)preSelSmartTable;
  408. - setPreSelSmartTable:(const unsigned char *)aTable;
  409. - (const unsigned char *)postSelSmartTable;
  410. - setPostSelSmartTable:(const unsigned char *)aTable;
  411. - (const unsigned char *)charCategoryTable;
  412. - setCharCategoryTable:(const unsigned char *)aTable;
  413. - (const NXFSM *)breakTable;
  414. - setBreakTable:(const NXFSM *)aTable;
  415. - (const NXFSM *)clickTable;
  416. - setClickTable:(const NXFSM *)aTable;
  417. - setTag:(int)anInt;
  418. - (int)tag;
  419. - setDelegate:anObject;
  420. - delegate;
  421. - setBackgroundGray:(float)value;
  422. - (float)backgroundGray;
  423. - setBackgroundColor:(NXColor)color;
  424. - (NXColor)backgroundColor;
  425. - setTextGray:(float)value;
  426. - setTextColor:(NXColor)color;
  427. - (float)textGray;
  428. - (NXColor)textColor;
  429. - (float)selGray;
  430. - (float)runGray: (NXRun *)run;
  431. - (NXColor)runColor: (NXRun *)run;
  432. - (NXColor)selColor;
  433. - windowChanged:newWindow;
  434. - (NXStream *)stream;
  435. - write:(NXTypedStream *)stream;
  436. - read:(NXTypedStream *)stream;
  437. - readRichText:(NXStream *)stream atPosition:(int)position;
  438. - finishReadingRichText;
  439. - startReadingRichText;
  440. - setRetainedWhileDrawing:(BOOL)aFlag;
  441. - (BOOL) isRetainedWhileDrawing;
  442. #ifndef KANJI
  443. - (NXTextBlock *)firstTextBlock;
  444. - setScanFunc:(NXTextFunc)aFunc;
  445. - (NXTextFunc)scanFunc;
  446. - setDrawFunc:(NXTextFunc)aFunc;
  447. - (NXTextFunc)drawFunc;
  448. #endif
  449.  
  450. - (int)offsetFromPosition: (int)charPos;
  451. - (int)positionFromOffset:(int)offset;
  452. - (int)charLength;
  453.  
  454. #ifdef KANJI
  455. - setClickFunc: (NXclickFunc) clickFunc ;
  456. - (NXclickFunc) clickFunc ;
  457. - (NXStream *) wstream ;
  458. - disableStream ;
  459. #endif
  460.  
  461. /*
  462.  * These methods are now obsolete.  The NeXTstep encoding supports diacritical
  463.  * marks directly (and these methods were never implemented anyway).
  464.  */
  465. - setOverstrikeDiacriticals:(BOOL)flag;
  466. - (int)overstrikeDiacriticals;
  467.  
  468. /*
  469.  * This methUEds now obsolete.
  470.  * Use writeRichText: and writeRichText:from:to:.
  471.  */
  472. - writeRichText:(NXStream *)stream forRun:(NXRun *)run atPosition:(int)runPosition emitDefaultRichText:(BOOL *)writeDefaultRTF;
  473.  
  474. /* 
  475.  * The following new... methods are now obsolete.  They remain in this  
  476.  * interface file for backward compatibility only.  Use Object's alloc method  
  477.  * and the init... methods defined in this class instead.
  478.  */
  479. + newFrame:(const NXRect *)frameRect text:(const char *)theText alignment:(int)mode;
  480. + new;
  481. + newFrame:(const NXRect *)frameRect;
  482.  
  483. @end
  484.  
  485. @interface Text(FrameRect)
  486. - getMaxSize:(NXSize *)theSize;
  487. - getMinSize:(NXSize *)theSize;
  488. - (BOOL)isHorizResizable;
  489. - (BOOL)isVertResizable;
  490. - moveTo:(NXCoord)x :(NXCoord)y;
  491. - resizeText:(const NXRect *)oldBounds :(const NXRect *)maxRect;
  492. - setMaxSize:(const NXSize *)newMaxSize;
  493. - setMinSize:(const NXSize *)newMinSize;
  494. - setHorizResizable:(BOOL)flag;
  495. - setVertResizable:(BOOL)flag;
  496. - sizeTo:(NXCoord)width :(NXCoord)height;
  497. - sizeToFit;
  498. @end
  499.  
  500. @interface Text(Layout)
  501. - (int)alignment;
  502. - (int)calcLine;
  503. - (void *)calcParagraphStyle:fontId:(int)alignment;
  504. - (BOOL)charWrap;
  505. - (NXCoord)descentLine;
  506. - getMarginLeft:(NXCoord *)leftMargin right:(NXCoord *)rightMargin top:(NXCoord *)topMargin bottom:(NXCoord *)bottomMargin;
  507. - getMinWidth:(NXCoord *)width minHeight:(NXCoord *)height maxWidth:(NXCoord)widthMax maxHeight:(NXCoord)heightMax;
  508. - (void *)defaultParaStyle;
  509. - (NXCoord)lineHeight;
  510. - setAlignment:(int)mode;
  511. - setCharWrap:(BOOL)flag;
  512. - setDescentLine:(NXCoord)value;
  513. - setLineHeight:(NXCoord)value;
  514. - setMarginLeft:(NXCoord)leftMargin right:(NXCoord)rightMargin top:(NXCoord)topMargin bottom:(NXCoord)bottomMargin;
  515. - setNoWrap;
  516. - setParaStyle:(void *)paraStyle;
  517. @end
  518.  
  519. @interface Text(LinePosition)
  520. - (int)lineFromPosition:(int)position;
  521. - (int)positionFromLine:(int)line;
  522. @end
  523.  
  524. @interface Text(Drawing)
  525. - drawSelf:(const NXRect *)rects:(int)rectCount;
  526. @end
  527.  
  528. @interface Text(Event)
  529. - (BOOL)acceptsFirstResponder;
  530. - becomeFirstResponder;
  531. - becomeKeyWindow;
  532. - clear:sender;
  533. - copy:sender;
  534. - cut:sender;
  535. - delete:sender;
  536. - keyDown:(NXEvent *)theEvent;
  537. - mouseDown:(NXEvent *)theEvent;
  538. - moveCaret:(unsigned short)theKey;
  539. - paste:sender;
  540. - pasteRuler:sender;
  541. - pasteFont:sender;
  542. - resignFirstResponder;
  543. - resignKeyWindow;
  544. - selectAll:sender;
  545. - selectText:sender;
  546. - copyRuler:sender;
  547. - copyFUEesender;
  548. @end
  549.  
  550. @interface Text(Ruler)
  551. - toggleRuler:sender;
  552. -(BOOL)isRulerVisible;
  553. @end
  554.  
  555. @interface Text(Selection)
  556. - getSel:(NXSelPt *)start :(NXSelPt *)end;
  557. - hideCaret;
  558. - (BOOL)isSelectable;
  559. - replaceSel:(const char *)aString;
  560. - replaceSel:(const char *)aString length:(int)length;
  561. - replaceSel:(const char *)aString length:(int)length runs:(NXRunArray *)insertRuns;
  562. - replaceSelWithRichText:(NXStream *)stream;
  563. - scrollSelToVisible;
  564. - selectError;
  565. - selectNull;
  566. - setSel:(int)start :(int)end;
  567. - setSelectable:(BOOL)flag;
  568. - setSelGray:(float)value;
  569. - setSelColor:(NXColor) color;
  570. - showCaret;
  571. - subscript:sender;
  572. - superscript:sender;
  573. - underline:sender;
  574. - unscript:sender;
  575. - validRequestorForSendType:(NXAtom)sendType andReturnType:(NXAtom)returnType;
  576. - readSelectionFromPasteboard:pboard;
  577. - (BOOL)writeSelectionToPasteboard:pboard types:(NXAtom *)types;
  578. @end
  579.  
  580. @interface Text(Font)
  581. - changeFont:sender;
  582. - font;
  583. - (BOOL)isFontPanelEnabled;
  584. - (BOOL)isMonoFont;
  585. - setFont:fontObj;
  586. - setFont:fontObj paraStyle:(void *)paraStyle;
  587. - setSelFontFamily:(const char *)fontName;
  588. - setSelFontSize:(float)size;
  589. - setSelFontStyle:(NXFontTraitMask)traits;
  590. - setSelFont:fontId;
  591. - setSelFont:fontId paraStyle:(void *)paraStyle;
  592. - setFontPanelEnabled:(BOOL)flag;
  593. - setMonoFont:(BOOL)flag;
  594. - changeTabStopAt:(NXCoord)oldX to:(NXCoord)newX;
  595. - setSelProp:(NXParagraphProp)prop to:(NXCoord)val;
  596. - alignSelLeft:sender;
  597. - alignSelRight:sender;
  598. - alignSelCenter:sender;
  599. @end
  600.  
  601. @interface Text(SpellChecking)
  602. - showGuessPanel:sender;
  603. - checkSpelling:sender;
  604. @end
  605.  
  606. @interface Text(Graphics)
  607. - replaceSelWithCell:cell;
  608. - replaceSelWithView:view;
  609. - getLocation:(NXPoint *)origin ofCell:cell;
  610. - setLocation:(NXPoint *)origin ofCell:cell;
  611. - getLocation:(NXPoint *)origin ofView:view;
  612. + registerDirective:(const char *)directive forClass:class;
  613. @end
  614.  
  615. @interface Text(Find)
  616. - (BOOL)findText:(const char *)textPattern
  617.     ignoreCase:(BOOL) ignoreCase
  618.     backwards:(BOOL) backwards
  619.     wrap:(BOOL) wrap;
  620. @end
  621.  
  622. @interface Text (RTFD)
  623. - (NXRTFDError) saveRTFDTo:(const char *)path removeBackup:(BOOL)removeBackup errorHandler: errorHandler;
  624. - (NXRTFDError) openRTFDFrom:(const char *)path;
  625. - writeRTFDTo:(NXStream *)stream;
  626. - readRTFDFrom:(NXStream *)stream;
  627. - writeRTFDSelectionTo:(NXStream *)stream;
  628. - replaceSelWithRTFD:(NXStream *)stream;
  629. - setGraphicsImportEnabled:(BOOL) flagUEf(BOOL) isGraphicsImportEnabled;
  630.  
  631. @end
  632.  
  633. @interface Object(TextDelegate)
  634. - textWillResize:textObject;
  635. - textDidResize:textObject oldBounds:(const NXRect *)oldBounds invalid:(NXRect *)invalidRect;
  636. - (BOOL)textWillChange:textObject;
  637. - textDidChange:textObject;
  638. - (BOOL)textWillEnd:textObject;
  639. - textDidEnd:textObject endChar:(unsigned short)whyEnd;
  640. - textDidGetKeys:textObject isEmpty:(BOOL)flag;
  641. - textWillSetSel:textObject toFont:font;
  642. - textWillConvert:textObject fromFont:from toFont:to;
  643. - textWillStartReadingRichText:textObject;
  644. - textWillFinishReadingRichText:textObject;
  645. - textWillWrite:textObject paperSize:(NXSize *)paperSize;
  646. - textDidRead:textObject paperSize:(NXSize *)paperSize;
  647.  
  648. /* The following delegate methods are obsolete and should not be used. */
  649.  
  650. - textWillWriteRichText:textObject stream:(NXStream *)stream forRun:(NXRun *)run atPosition:(int)runPosition emitDefaultRichText:(BOOL *)writeDefaultRichText;
  651. - textWillReadRichText:textObject stream:(NXStream *)stream atPosition:(int)runPosition;
  652. - textPath:(char *)path forText:textObject maxLength:(int)maxLength;
  653.  
  654. @end
  655.  
  656. @interface Object(TextCell)
  657. /*
  658.  * Any object added to the Text object via replaceSelWithCell: must
  659.  * respond to all of the following messages:
  660.  */
  661. - highlight:(const NXRect *)cellFrame inView:controlView lit:(BOOL)flag;
  662. - drawSelf:(const NXRect *)cellFrame inView:controlView;
  663. - (BOOL)trackMouse:(NXEvent *)theEvent inRect:(const NXRect *)cellFrame ofView:controlView;
  664. - calcCellSize:(NXSize *)theSize;
  665. - readRichText:(NXStream *)stream forView:view;
  666. - writeRichText:(NXStream *)stream forView:view;
  667. @end
  668.  
  669.  
  670. extern void NXTextFontInfo(
  671.     id fid, NXCoord *ascender, NXCoord *descender, NXCoord *lineHt);
  672. extern int NXScanALine(id self, NXLayInfo *layInfo);
  673. extern int NXDrawALine(id self, NXLayInfo *layInfo);
  674. extern unsigned short NXFieldFilter(
  675.     unsigned short theChar, int flags, unsigned short charSet);
  676. extern unsigned short NXEditorFilter(
  677.     unsigned short theChar, int flags, unsigned short charSet);
  678. extern void NXSetTextCache(id self, NXTextCache *cache, int pos);
  679. extern int NXAdjustTextCache(id self, NXTextCache *cache, int pos);
  680. extern void NXFlushTextCache(id self, NXTextCache *cache);
  681. extern void NXWriteWordTable(NXStream *st, const unsigned char *smartLeft,
  682.         const unsigned char *smartRight,
  683.         const unsigned char *charClasses,
  684.         consUEgFSM *wrapBreaks, int wrapBreaksCount,
  685.         const NXFSM *clickBreaks, int clickBreaksCount, BOOL charWrap);
  686. extern void NXReadWordTable(NXZone *zone, NXStream *st,
  687.         unsigned char **smartLeft, unsigned char **smartRight,
  688.         unsigned char **charClasses,
  689.         NXFSM **wrapBreaks, int *wrapBreaksCount,
  690.         NXFSM **clickBreaks, int *clickBreaksCount,
  691.         BOOL *charWrap);
  692. #ifdef KANJI
  693. extern BOOL NXClick ( id self, int clickPos, NXSelPt * left, NXSelPt * right );
  694. #endif
  695.  
  696. typedef struct {
  697.     unsigned char primary[256];
  698.     unsigned char secondary[256];
  699.     unsigned char primaryCI[256];
  700.     unsigned char secondaryCI[256];
  701. } NXStringOrderTable;
  702.  
  703. extern int NXOrderStrings(const unsigned char *s1, const unsigned char *s2, BOOL caseSensitive, int length, NXStringOrderTable *table);
  704. extern NXStringOrderTable *NXDefaultStringOrderTable(void);
  705.  
  706. #endif TEXT_H
  707.  
  708.