Annotation of researchv9/X11/src/X.V11R1/lib/Xtk/TextP.h, revision 1.1.1.1

1.1       root        1: /*
                      2: * $Header: TextPrivate.h,v 1.2 87/09/11 21:24:59 haynes Rel $
                      3: */
                      4: 
                      5: /*
                      6:  * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
                      7:  * 
                      8:  *                         All Rights Reserved
                      9:  * 
                     10:  * Permission to use, copy, modify, and distribute this software and its 
                     11:  * documentation for any purpose and without fee is hereby granted, 
                     12:  * provided that the above copyright notice appear in all copies and that
                     13:  * both that copyright notice and this permission notice appear in 
                     14:  * supporting documentation, and that the name of Digital Equipment
                     15:  * Corporation not be used in advertising or publicity pertaining to
                     16:  * distribution of the software without specific, written prior permission.  
                     17:  * 
                     18:  * 
                     19:  * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
                     20:  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
                     21:  * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
                     22:  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
                     23:  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
                     24:  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
                     25:  * SOFTWARE.
                     26:  */
                     27: #ifndef _XtTextPrivate_h
                     28: #define _XtTextPrivate_h
                     29: 
                     30: 
                     31: /****************************************************************
                     32:  *
                     33:  * Text widget private
                     34:  *
                     35:  ****************************************************************/
                     36: #define MAXCUT 30000   /* Maximum number of characters that can be cut. */
                     37: 
                     38: #define LF     0x0a
                     39: #define CR     0x0d
                     40: #define TAB    0x09
                     41: #define BS     0x08
                     42: #define SP     0x20
                     43: #define DEL    0x7f
                     44: #define BSLASH '\\'
                     45: 
                     46: #define EDITDONE 0
                     47: #define EDITERROR 1
                     48: #define POSITIONERROR 2
                     49: 
                     50: typedef enum {XtsdLeft, XtsdRight} ScanDirection;
                     51: typedef enum {XtstPositions, XtstWhiteSpace, XtstEOL, XtstParagraph, XtstFile} ScanType;
                     52: 
                     53: typedef struct {
                     54:     int  firstPos;
                     55:     int  length;
                     56:     char *ptr;
                     57:     } XtTextBlock, *TextBlockPtr;
                     58: 
                     59: /* the data field is really a pointer to source info, see disk and 
                     60:    stream sources in TextKinds.c */
                     61: 
                     62: typedef struct {
                     63:     int                    (*read)();
                     64:     int                    (*replace)();
                     65:     XtTextPosition  (*getLastPos)();
                     66:     int                    (*setLastPos)();
                     67:     XtTextPosition  (*scan)();
                     68:     XtEditType      (*editType)();
                     69:     int                    *data;       
                     70:     } XtTextSource, *TextSourcePtr;
                     71: 
                     72: typedef struct {
                     73:     XFontStruct *font;
                     74:     int foreground;
                     75:     int (*display)();
                     76:     int (*insertCursor)();
                     77:     int (*clearToBackground)();
                     78:     int (*findPosition)();
                     79:     int (*findDistance)();
                     80:     int (*resolve)();
                     81:     int (*maxLines)();
                     82:     int (*maxHeight)();
                     83:     int *data;
                     84:     } XtTextSink, *TextSinkPtr;
                     85: 
                     86: /* displayable text management data structures */
                     87: 
                     88: typedef struct {
                     89:     XtTextPosition position;
                     90:     Position x, y, endX;
                     91:     } LineTableEntry, *LineTableEntryPtr;
                     92: 
                     93: /* Line Tables are n+1 long - last position displayed is in last lt entry */
                     94: typedef struct {
                     95:     XtTextPosition  top;       /* Top of the displayed text.           */
                     96:     int                    lines;      /* How many lines in this table.        */
                     97:     LineTableEntry  *info;     /* A dynamic array, one entry per line  */
                     98:     } LineTable, *LineTablePtr;
                     99: 
                    100: typedef enum {XtisOn, XtisOff} InsertState;
                    101: 
                    102: typedef enum {XtselectNull, XtselectPosition, XtselectChar, XtselectWord,
                    103:     XtselectLine, XtselectParagraph, XtselectAll} XtSelectType;
                    104: 
                    105: typedef enum {XtsmTextSelect, XtsmTextExtend} SelectionMode;
                    106: 
                    107: typedef enum {XtactionStart, XtactionAdjust, XtactionEnd} SelectionAction;
                    108: 
                    109: typedef struct {
                    110:     XtTextPosition left, right;
                    111:     XtSelectType  type;
                    112: } TextSelection;
                    113: 
                    114: #define IsPositionVisible(ctx, pos)    (pos >= ctx->text.lt.info[0].position && \
                    115:            pos <= ctx->text.lt.info[ctx->text.lt.lines].position)
                    116: 
                    117: /* Private Text Definitions */
                    118: 
                    119: typedef int (*ActionProc)();
                    120: 
                    121: typedef XtSelectType SelectionArray[20];
                    122: 
                    123: /* New fields for the Text widget class record */
                    124: 
                    125: typedef struct {int foo;} TextClassPart;
                    126: 
                    127: /* Full class record declaration */
                    128: typedef struct _TextClassRec {
                    129:     CoreClassPart      core_class;
                    130:     TextClassPart      text_class;
                    131: } TextClassRec;
                    132: 
                    133: extern TextClassRec textClassRec;
                    134: 
                    135: /* New fields for the Text widget record */
                    136: typedef struct {
                    137:     XtTextSource       *source;
                    138:     XtTextSink         *sink;
                    139:     LineTable       lt;
                    140:     XtTextPosition  insertPos;
                    141:     TextSelection   s;
                    142:     ScanDirection   extendDir;
                    143:     TextSelection   origSel;        /* the selection being modified */
                    144:     SelectionArray  sarray;         /* Array to cycle for selections. */
                    145:     Dimension       leftmargin;     /* Width of left margin. */
                    146:     int             options;        /* wordbreak, scroll, etc. */
                    147:     unsigned short  lasttime;       /* timestamp of last processed action */
                    148:     unsigned short  time;           /* timestamp of last key or button action */ 
                    149:     Position        ev_x, ev_y;     /* x, y coords for key or button action */
                    150:     Widget          sbar;           /* The vertical scroll bar (none = 0).  */
                    151:     Widget          outer;          /* Parent of scrollbar & text (if any) */
                    152:     XtTextPosition  *updateFrom;    /* Array of start positions for update. */
                    153:     XtTextPosition  *updateTo;      /* Array of end positions for update. */
                    154:     int             numranges;      /* How many update ranges there are. */
                    155:     int             maxranges;      /* How many update ranges we've space for */
                    156:     Boolean         showposition;   /* True if we need to show the position. */
                    157:     XtTextPosition  lastPos;        /* Last position of source. */
                    158:     Widget          dialog;         /* Window containing dialog, if any. */
                    159:     GC              gc;
                    160:     Boolean         hasfocus;   /* TRUE if we currently have input focus. */
                    161: } TextPart;
                    162: 
                    163: /****************************************************************
                    164:  *
                    165:  * Full instance record declaration
                    166:  *
                    167:  ****************************************************************/
                    168: 
                    169: typedef struct _TextRec {
                    170:     CorePart   core;
                    171:     TextPart   text;
                    172: } TextRec;
                    173: 
                    174: 
                    175: #endif _XtTextPrivate_h
                    176: /* DON'T ADD STUFF AFTER THIS #endif */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.