/[dtapublic]/projs/trunk/shared_source/tk_base/tktext.h
ViewVC logotype

Annotation of /projs/trunk/shared_source/tk_base/tktext.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 42 - (hide annotations) (download)
Fri Oct 14 01:50:00 2016 UTC (8 years, 2 months ago) by dashley
File MIME type: text/plain
File size: 36302 byte(s)
Move shared source code to commonize.
1 dashley 25 /* $Header: /cvsroot/esrg/sfesrg/esrgpcpj/shared/tk_base/tktext.h,v 1.1.1.1 2001/06/13 05:08:53 dtashley Exp $ */
2    
3     /*
4     * tkText.h --
5     *
6     * Declarations shared among the files that implement text
7     * widgets.
8     *
9     * Copyright (c) 1992-1994 The Regents of the University of California.
10     * Copyright (c) 1994-1995 Sun Microsystems, Inc.
11     *
12     * See the file "license.terms" for information on usage and redistribution
13     * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14     *
15     * RCS: @(#) $Id: tktext.h,v 1.1.1.1 2001/06/13 05:08:53 dtashley Exp $
16     */
17    
18     #ifndef _TKTEXT
19     #define _TKTEXT
20    
21     #ifndef _TK
22     #include "tk.h"
23     #endif
24    
25     #ifdef BUILD_tk
26     # undef TCL_STORAGE_CLASS
27     # define TCL_STORAGE_CLASS DLLEXPORT
28     #endif
29    
30     /*
31     * Opaque types for structures whose guts are only needed by a single
32     * file:
33     */
34    
35     typedef struct TkTextBTree *TkTextBTree;
36    
37     /*
38     * The data structure below defines a single line of text (from newline
39     * to newline, not necessarily what appears on one line of the screen).
40     */
41    
42     typedef struct TkTextLine {
43     struct Node *parentPtr; /* Pointer to parent node containing
44     * line. */
45     struct TkTextLine *nextPtr; /* Next in linked list of lines with
46     * same parent node in B-tree. NULL
47     * means end of list. */
48     struct TkTextSegment *segPtr; /* First in ordered list of segments
49     * that make up the line. */
50     } TkTextLine;
51    
52     /*
53     * -----------------------------------------------------------------------
54     * Segments: each line is divided into one or more segments, where each
55     * segment is one of several things, such as a group of characters, a
56     * tag toggle, a mark, or an embedded widget. Each segment starts with
57     * a standard header followed by a body that varies from type to type.
58     * -----------------------------------------------------------------------
59     */
60    
61     /*
62     * The data structure below defines the body of a segment that represents
63     * a tag toggle. There is one of these structures at both the beginning
64     * and end of each tagged range.
65     */
66    
67     typedef struct TkTextToggle {
68     struct TkTextTag *tagPtr; /* Tag that starts or ends here. */
69     int inNodeCounts; /* 1 means this toggle has been
70     * accounted for in node toggle
71     * counts; 0 means it hasn't, yet. */
72     } TkTextToggle;
73    
74     /*
75     * The data structure below defines line segments that represent
76     * marks. There is one of these for each mark in the text.
77     */
78    
79     typedef struct TkTextMark {
80     struct TkText *textPtr; /* Overall information about text
81     * widget. */
82     TkTextLine *linePtr; /* Line structure that contains the
83     * segment. */
84     Tcl_HashEntry *hPtr; /* Pointer to hash table entry for mark
85     * (in textPtr->markTable). */
86     } TkTextMark;
87    
88     /*
89     * A structure of the following type holds information for each window
90     * embedded in a text widget. This information is only used by the
91     * file tkTextWind.c
92     */
93    
94     typedef struct TkTextEmbWindow {
95     struct TkText *textPtr; /* Information about the overall text
96     * widget. */
97     TkTextLine *linePtr; /* Line structure that contains this
98     * window. */
99     Tk_Window tkwin; /* Window for this segment. NULL
100     * means that the window hasn't
101     * been created yet. */
102     char *create; /* Script to create window on-demand.
103     * NULL means no such script.
104     * Malloc-ed. */
105     int align; /* How to align window in vertical
106     * space. See definitions in
107     * tkTextWind.c. */
108     int padX, padY; /* Padding to leave around each side
109     * of window, in pixels. */
110     int stretch; /* Should window stretch to fill
111     * vertical space of line (except for
112     * pady)? 0 or 1. */
113     int chunkCount; /* Number of display chunks that
114     * refer to this window. */
115     int displayed; /* Non-zero means that the window
116     * has been displayed on the screen
117     * recently. */
118     } TkTextEmbWindow;
119    
120     /*
121     * A structure of the following type holds information for each image
122     * embedded in a text widget. This information is only used by the
123     * file tkTextImage.c
124     */
125    
126     typedef struct TkTextEmbImage {
127     struct TkText *textPtr; /* Information about the overall text
128     * widget. */
129     TkTextLine *linePtr; /* Line structure that contains this
130     * image. */
131     char *imageString; /* Name of the image for this segment */
132     char *imageName; /* Name used by text widget to identify
133     * this image. May be unique-ified */
134     char *name; /* Name used in the hash table.
135     * used by "image names" to identify
136     * this instance of the image */
137     Tk_Image image; /* Image for this segment. NULL
138     * means that the image hasn't
139     * been created yet. */
140     int align; /* How to align image in vertical
141     * space. See definitions in
142     * tkTextImage.c. */
143     int padX, padY; /* Padding to leave around each side
144     * of image, in pixels. */
145     int chunkCount; /* Number of display chunks that
146     * refer to this image. */
147     } TkTextEmbImage;
148    
149     /*
150     * The data structure below defines line segments.
151     */
152    
153     typedef struct TkTextSegment {
154     struct Tk_SegType *typePtr; /* Pointer to record describing
155     * segment's type. */
156     struct TkTextSegment *nextPtr; /* Next in list of segments for this
157     * line, or NULL for end of list. */
158     int size; /* Size of this segment (# of bytes
159     * of index space it occupies). */
160     union {
161     char chars[4]; /* Characters that make up character
162     * info. Actual length varies to
163     * hold as many characters as needed.*/
164     TkTextToggle toggle; /* Information about tag toggle. */
165     TkTextMark mark; /* Information about mark. */
166     TkTextEmbWindow ew; /* Information about embedded
167     * window. */
168     TkTextEmbImage ei; /* Information about embedded
169     * image. */
170     } body;
171     } TkTextSegment;
172    
173     /*
174     * Data structures of the type defined below are used during the
175     * execution of Tcl commands to keep track of various interesting
176     * places in a text. An index is only valid up until the next
177     * modification to the character structure of the b-tree so they
178     * can't be retained across Tcl commands. However, mods to marks
179     * or tags don't invalidate indices.
180     */
181    
182     typedef struct TkTextIndex {
183     TkTextBTree tree; /* Tree containing desired position. */
184     TkTextLine *linePtr; /* Pointer to line containing position
185     * of interest. */
186     int byteIndex; /* Index within line of desired
187     * character (0 means first one). */
188     } TkTextIndex;
189    
190     /*
191     * Types for procedure pointers stored in TkTextDispChunk strutures:
192     */
193    
194     typedef struct TkTextDispChunk TkTextDispChunk;
195    
196     typedef void Tk_ChunkDisplayProc _ANSI_ARGS_((
197     TkTextDispChunk *chunkPtr, int x, int y,
198     int height, int baseline, Display *display,
199     Drawable dst, int screenY));
200     typedef void Tk_ChunkUndisplayProc _ANSI_ARGS_((
201     struct TkText *textPtr,
202     TkTextDispChunk *chunkPtr));
203     typedef int Tk_ChunkMeasureProc _ANSI_ARGS_((
204     TkTextDispChunk *chunkPtr, int x));
205     typedef void Tk_ChunkBboxProc _ANSI_ARGS_((
206     TkTextDispChunk *chunkPtr, int index, int y,
207     int lineHeight, int baseline, int *xPtr,
208     int *yPtr, int *widthPtr, int *heightPtr));
209    
210     /*
211     * The structure below represents a chunk of stuff that is displayed
212     * together on the screen. This structure is allocated and freed by
213     * generic display code but most of its fields are filled in by
214     * segment-type-specific code.
215     */
216    
217     struct TkTextDispChunk {
218     /*
219     * The fields below are set by the type-independent code before
220     * calling the segment-type-specific layoutProc. They should not
221     * be modified by segment-type-specific code.
222     */
223    
224     int x; /* X position of chunk, in pixels.
225     * This position is measured from the
226     * left edge of the logical line,
227     * not from the left edge of the
228     * window (i.e. it doesn't change
229     * under horizontal scrolling). */
230     struct TkTextDispChunk *nextPtr; /* Next chunk in the display line
231     * or NULL for the end of the list. */
232     struct TextStyle *stylePtr; /* Display information, known only
233     * to tkTextDisp.c. */
234    
235     /*
236     * The fields below are set by the layoutProc that creates the
237     * chunk.
238     */
239    
240     Tk_ChunkDisplayProc *displayProc; /* Procedure to invoke to draw this
241     * chunk on the display or an
242     * off-screen pixmap. */
243     Tk_ChunkUndisplayProc *undisplayProc;
244     /* Procedure to invoke when segment
245     * ceases to be displayed on screen
246     * anymore. */
247     Tk_ChunkMeasureProc *measureProc; /* Procedure to find character under
248     * a given x-location. */
249     Tk_ChunkBboxProc *bboxProc; /* Procedure to find bounding box
250     * of character in chunk. */
251     int numBytes; /* Number of bytes that will be
252     * displayed in the chunk. */
253     int minAscent; /* Minimum space above the baseline
254     * needed by this chunk. */
255     int minDescent; /* Minimum space below the baseline
256     * needed by this chunk. */
257     int minHeight; /* Minimum total line height needed
258     * by this chunk. */
259     int width; /* Width of this chunk, in pixels.
260     * Initially set by chunk-specific
261     * code, but may be increased to
262     * include tab or extra space at end
263     * of line. */
264     int breakIndex; /* Index within chunk of last
265     * acceptable position for a line
266     * (break just before this byte index).
267     * <= 0 means don't break during or
268     * immediately after this chunk. */
269     ClientData clientData; /* Additional information for use
270     * of displayProc and undisplayProc. */
271     };
272    
273     /*
274     * One data structure of the following type is used for each tag in a
275     * text widget. These structures are kept in textPtr->tagTable and
276     * referred to in other structures.
277     */
278    
279     typedef enum { TEXT_WRAPMODE_NULL, TEXT_WRAPMODE_NONE,
280     TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_WORD
281     } TkWrapMode;
282    
283     extern Tk_CustomOption textWrapModeOption;
284    
285     typedef struct TkTextTag {
286     char *name; /* Name of this tag. This field is actually
287     * a pointer to the key from the entry in
288     * textPtr->tagTable, so it needn't be freed
289     * explicitly. */
290     int priority; /* Priority of this tag within widget. 0
291     * means lowest priority. Exactly one tag
292     * has each integer value between 0 and
293     * numTags-1. */
294     struct Node *tagRootPtr; /* Pointer into the B-Tree at the lowest
295     * node that completely dominates the ranges
296     * of text occupied by the tag. At this
297     * node there is no information about the
298     * tag. One or more children of the node
299     * do contain information about the tag. */
300     int toggleCount; /* Total number of tag toggles */
301    
302     /*
303     * Information for displaying text with this tag. The information
304     * belows acts as an override on information specified by lower-priority
305     * tags. If no value is specified, then the next-lower-priority tag
306     * on the text determins the value. The text widget itself provides
307     * defaults if no tag specifies an override.
308     */
309    
310     Tk_3DBorder border; /* Used for drawing background. NULL means
311     * no value specified here. */
312     char *bdString; /* -borderwidth option string (malloc-ed).
313     * NULL means option not specified. */
314     int borderWidth; /* Width of 3-D border for background. */
315     char *reliefString; /* -relief option string (malloc-ed).
316     * NULL means option not specified. */
317     int relief; /* 3-D relief for background. */
318     Pixmap bgStipple; /* Stipple bitmap for background. None
319     * means no value specified here. */
320     XColor *fgColor; /* Foreground color for text. NULL means
321     * no value specified here. */
322     Tk_Font tkfont; /* Font for displaying text. NULL means
323     * no value specified here. */
324     Pixmap fgStipple; /* Stipple bitmap for text and other
325     * foreground stuff. None means no value
326     * specified here.*/
327     char *justifyString; /* -justify option string (malloc-ed).
328     * NULL means option not specified. */
329     Tk_Justify justify; /* How to justify text: TK_JUSTIFY_LEFT,
330     * TK_JUSTIFY_RIGHT, or TK_JUSTIFY_CENTER.
331     * Only valid if justifyString is non-NULL. */
332     char *lMargin1String; /* -lmargin1 option string (malloc-ed).
333     * NULL means option not specified. */
334     int lMargin1; /* Left margin for first display line of
335     * each text line, in pixels. Only valid
336     * if lMargin1String is non-NULL. */
337     char *lMargin2String; /* -lmargin2 option string (malloc-ed).
338     * NULL means option not specified. */
339     int lMargin2; /* Left margin for second and later display
340     * lines of each text line, in pixels. Only
341     * valid if lMargin2String is non-NULL. */
342     char *offsetString; /* -offset option string (malloc-ed).
343     * NULL means option not specified. */
344     int offset; /* Vertical offset of text's baseline from
345     * baseline of line. Used for superscripts
346     * and subscripts. Only valid if
347     * offsetString is non-NULL. */
348     char *overstrikeString; /* -overstrike option string (malloc-ed).
349     * NULL means option not specified. */
350     int overstrike; /* Non-zero means draw horizontal line through
351     * middle of text. Only valid if
352     * overstrikeString is non-NULL. */
353     char *rMarginString; /* -rmargin option string (malloc-ed).
354     * NULL means option not specified. */
355     int rMargin; /* Right margin for text, in pixels. Only
356     * valid if rMarginString is non-NULL. */
357     char *spacing1String; /* -spacing1 option string (malloc-ed).
358     * NULL means option not specified. */
359     int spacing1; /* Extra spacing above first display
360     * line for text line. Only valid if
361     * spacing1String is non-NULL. */
362     char *spacing2String; /* -spacing2 option string (malloc-ed).
363     * NULL means option not specified. */
364     int spacing2; /* Extra spacing between display
365     * lines for the same text line. Only valid
366     * if spacing2String is non-NULL. */
367     char *spacing3String; /* -spacing2 option string (malloc-ed).
368     * NULL means option not specified. */
369     int spacing3; /* Extra spacing below last display
370     * line for text line. Only valid if
371     * spacing3String is non-NULL. */
372     char *tabString; /* -tabs option string (malloc-ed).
373     * NULL means option not specified. */
374     struct TkTextTabArray *tabArrayPtr;
375     /* Info about tabs for tag (malloc-ed)
376     * or NULL. Corresponds to tabString. */
377     char *underlineString; /* -underline option string (malloc-ed).
378     * NULL means option not specified. */
379     int underline; /* Non-zero means draw underline underneath
380     * text. Only valid if underlineString is
381     * non-NULL. */
382     TkWrapMode wrapMode; /* How to handle wrap-around for this tag.
383     * Must be TEXT_WRAPMODE_CHAR,
384     * TEXT_WRAPMODE_NONE, TEXT_WRAPMODE_WORD,
385     * or TEXT_WRAPMODE_NULL to use wrapmode for
386     * whole widget. */
387     char *elideString; /* -elide option string (malloc-ed).
388     * NULL means option not specified. */
389     int elide; /* Non-zero means that data under this tag
390     * should not be displayed. */
391     int affectsDisplay; /* Non-zero means that this tag affects the
392     * way information is displayed on the screen
393     * (so need to redisplay if tag changes). */
394     } TkTextTag;
395    
396     #define TK_TAG_AFFECTS_DISPLAY 0x1
397     #define TK_TAG_UNDERLINE 0x2
398     #define TK_TAG_JUSTIFY 0x4
399     #define TK_TAG_OFFSET 0x10
400    
401     /*
402     * The data structure below is used for searching a B-tree for transitions
403     * on a single tag (or for all tag transitions). No code outside of
404     * tkTextBTree.c should ever modify any of the fields in these structures,
405     * but it's OK to use them for read-only information.
406     */
407    
408     typedef struct TkTextSearch {
409     TkTextIndex curIndex; /* Position of last tag transition
410     * returned by TkBTreeNextTag, or
411     * index of start of segment
412     * containing starting position for
413     * search if TkBTreeNextTag hasn't
414     * been called yet, or same as
415     * stopIndex if search is over. */
416     TkTextSegment *segPtr; /* Actual tag segment returned by last
417     * call to TkBTreeNextTag, or NULL if
418     * TkBTreeNextTag hasn't returned
419     * anything yet. */
420     TkTextSegment *nextPtr; /* Where to resume search in next
421     * call to TkBTreeNextTag. */
422     TkTextSegment *lastPtr; /* Stop search before just before
423     * considering this segment. */
424     TkTextTag *tagPtr; /* Tag to search for (or tag found, if
425     * allTags is non-zero). */
426     int linesLeft; /* Lines left to search (including
427     * curIndex and stopIndex). When
428     * this becomes <= 0 the search is
429     * over. */
430     int allTags; /* Non-zero means ignore tag check:
431     * search for transitions on all
432     * tags. */
433     } TkTextSearch;
434    
435     /*
436     * The following data structure describes a single tab stop.
437     */
438    
439     typedef enum {LEFT, RIGHT, CENTER, NUMERIC} TkTextTabAlign;
440    
441     typedef struct TkTextTab {
442     int location; /* Offset in pixels of this tab stop
443     * from the left margin (lmargin2) of
444     * the text. */
445     TkTextTabAlign alignment; /* Where the tab stop appears relative
446     * to the text. */
447     } TkTextTab;
448    
449     typedef struct TkTextTabArray {
450     int numTabs; /* Number of tab stops. */
451     TkTextTab tabs[1]; /* Array of tabs. The actual size
452     * will be numTabs. THIS FIELD MUST
453     * BE THE LAST IN THE STRUCTURE. */
454     } TkTextTabArray;
455    
456     /*
457     * A data structure of the following type is kept for each text widget that
458     * currently exists for this process:
459     */
460    
461     typedef struct TkText {
462     Tk_Window tkwin; /* Window that embodies the text. NULL
463     * means that the window has been destroyed
464     * but the data structures haven't yet been
465     * cleaned up.*/
466     Display *display; /* Display for widget. Needed, among other
467     * things, to allow resources to be freed
468     * even after tkwin has gone away. */
469     Tcl_Interp *interp; /* Interpreter associated with widget. Used
470     * to delete widget command. */
471     Tcl_Command widgetCmd; /* Token for text's widget command. */
472     TkTextBTree tree; /* B-tree representation of text and tags for
473     * widget. */
474     Tcl_HashTable tagTable; /* Hash table that maps from tag names to
475     * pointers to TkTextTag structures. */
476     int numTags; /* Number of tags currently defined for
477     * widget; needed to keep track of
478     * priorities. */
479     Tcl_HashTable markTable; /* Hash table that maps from mark names to
480     * pointers to mark segments. */
481     Tcl_HashTable windowTable; /* Hash table that maps from window names
482     * to pointers to window segments. If a
483     * window segment doesn't yet have an
484     * associated window, there is no entry for
485     * it here. */
486     Tcl_HashTable imageTable; /* Hash table that maps from image names
487     * to pointers to image segments. If an
488     * image segment doesn't yet have an
489     * associated image, there is no entry for
490     * it here. */
491     int state; /* Either STATE_NORMAL or STATE_DISABLED. A
492     * text widget is read-only when disabled. */
493    
494     /*
495     * Default information for displaying (may be overridden by tags
496     * applied to ranges of characters).
497     */
498    
499     Tk_3DBorder border; /* Structure used to draw 3-D border and
500     * default background. */
501     int borderWidth; /* Width of 3-D border to draw around entire
502     * widget. */
503     int padX, padY; /* Padding between text and window border. */
504     int relief; /* 3-d effect for border around entire
505     * widget: TK_RELIEF_RAISED etc. */
506     int highlightWidth; /* Width in pixels of highlight to draw
507     * around widget when it has the focus.
508     * <= 0 means don't draw a highlight. */
509     XColor *highlightBgColorPtr;
510     /* Color for drawing traversal highlight
511     * area when highlight is off. */
512     XColor *highlightColorPtr; /* Color for drawing traversal highlight. */
513     Tk_Cursor cursor; /* Current cursor for window, or None. */
514     XColor *fgColor; /* Default foreground color for text. */
515     Tk_Font tkfont; /* Default font for displaying text. */
516     int charWidth; /* Width of average character in default
517     * font. */
518     int spacing1; /* Default extra spacing above first display
519     * line for each text line. */
520     int spacing2; /* Default extra spacing between display lines
521     * for the same text line. */
522     int spacing3; /* Default extra spacing below last display
523     * line for each text line. */
524     char *tabOptionString; /* Value of -tabs option string (malloc'ed). */
525     TkTextTabArray *tabArrayPtr;
526     /* Information about tab stops (malloc'ed).
527     * NULL means perform default tabbing
528     * behavior. */
529    
530     /*
531     * Additional information used for displaying:
532     */
533    
534     TkWrapMode wrapMode; /* How to handle wrap-around. Must be
535     * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
536     * TEXT_WRAPMODE_WORD. */
537     int width, height; /* Desired dimensions for window, measured
538     * in characters. */
539     int setGrid; /* Non-zero means pass gridding information
540     * to window manager. */
541     int prevWidth, prevHeight; /* Last known dimensions of window; used to
542     * detect changes in size. */
543     TkTextIndex topIndex; /* Identifies first character in top display
544     * line of window. */
545     struct TextDInfo *dInfoPtr; /* Information maintained by tkTextDisp.c. */
546    
547     /*
548     * Information related to selection.
549     */
550    
551     TkTextTag *selTagPtr; /* Pointer to "sel" tag. Used to tell when
552     * a new selection has been made. */
553     Tk_3DBorder selBorder; /* Border and background for selected
554     * characters. This is a copy of information
555     * in *cursorTagPtr, so it shouldn't be
556     * explicitly freed. */
557     char *selBdString; /* Value of -selectborderwidth option, or NULL
558     * if not specified (malloc'ed). */
559     XColor *selFgColorPtr; /* Foreground color for selected text.
560     * This is a copy of information in
561     * *cursorTagPtr, so it shouldn't be
562     * explicitly freed. */
563     int exportSelection; /* Non-zero means tie "sel" tag to X
564     * selection. */
565     TkTextIndex selIndex; /* Used during multi-pass selection retrievals.
566     * This index identifies the next character
567     * to be returned from the selection. */
568     int abortSelections; /* Set to 1 whenever the text is modified
569     * in a way that interferes with selection
570     * retrieval: used to abort incremental
571     * selection retrievals. */
572     int selOffset; /* Offset in selection corresponding to
573     * selLine and selCh. -1 means neither
574     * this information nor selIndex is of any
575     * use. */
576    
577     /*
578     * Information related to insertion cursor:
579     */
580    
581     TkTextSegment *insertMarkPtr;
582     /* Points to segment for "insert" mark. */
583     Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion
584     * cursor. */
585     int insertWidth; /* Total width of insert cursor. */
586     int insertBorderWidth; /* Width of 3-D border around insert cursor. */
587     int insertOnTime; /* Number of milliseconds cursor should spend
588     * in "on" state for each blink. */
589     int insertOffTime; /* Number of milliseconds cursor should spend
590     * in "off" state for each blink. */
591     Tcl_TimerToken insertBlinkHandler;
592     /* Timer handler used to blink cursor on and
593     * off. */
594    
595     /*
596     * Information used for event bindings associated with tags:
597     */
598    
599     Tk_BindingTable bindingTable;
600     /* Table of all bindings currently defined
601     * for this widget. NULL means that no
602     * bindings exist, so the table hasn't been
603     * created. Each "object" used for this
604     * table is the address of a tag. */
605     TkTextSegment *currentMarkPtr;
606     /* Pointer to segment for "current" mark,
607     * or NULL if none. */
608     XEvent pickEvent; /* The event from which the current character
609     * was chosen. Must be saved so that we
610     * can repick after modifications to the
611     * text. */
612     int numCurTags; /* Number of tags associated with character
613     * at current mark. */
614     TkTextTag **curTagArrayPtr; /* Pointer to array of tags for current
615     * mark, or NULL if none. */
616    
617     /*
618     * Miscellaneous additional information:
619     */
620    
621     char *takeFocus; /* Value of -takeFocus option; not used in
622     * the C code, but used by keyboard traversal
623     * scripts. Malloc'ed, but may be NULL. */
624     char *xScrollCmd; /* Prefix of command to issue to update
625     * horizontal scrollbar when view changes. */
626     char *yScrollCmd; /* Prefix of command to issue to update
627     * vertical scrollbar when view changes. */
628     int flags; /* Miscellaneous flags; see below for
629     * definitions. */
630     } TkText;
631    
632     /*
633     * Flag values for TkText records:
634     *
635     * GOT_SELECTION: Non-zero means we've already claimed the
636     * selection.
637     * INSERT_ON: Non-zero means insertion cursor should be
638     * displayed on screen.
639     * GOT_FOCUS: Non-zero means this window has the input
640     * focus.
641     * BUTTON_DOWN: 1 means that a mouse button is currently
642     * down; this is used to implement grabs
643     * for the duration of button presses.
644     * UPDATE_SCROLLBARS: Non-zero means scrollbar(s) should be updated
645     * during next redisplay operation.
646     */
647    
648     #define GOT_SELECTION 1
649     #define INSERT_ON 2
650     #define GOT_FOCUS 4
651     #define BUTTON_DOWN 8
652     #define UPDATE_SCROLLBARS 0x10
653     #define NEED_REPICK 0x20
654    
655     /*
656     * Records of the following type define segment types in terms of
657     * a collection of procedures that may be called to manipulate
658     * segments of that type.
659     */
660    
661     typedef TkTextSegment * Tk_SegSplitProc _ANSI_ARGS_((
662     struct TkTextSegment *segPtr, int index));
663     typedef int Tk_SegDeleteProc _ANSI_ARGS_((
664     struct TkTextSegment *segPtr,
665     TkTextLine *linePtr, int treeGone));
666     typedef TkTextSegment * Tk_SegCleanupProc _ANSI_ARGS_((
667     struct TkTextSegment *segPtr, TkTextLine *linePtr));
668     typedef void Tk_SegLineChangeProc _ANSI_ARGS_((
669     struct TkTextSegment *segPtr, TkTextLine *linePtr));
670     typedef int Tk_SegLayoutProc _ANSI_ARGS_((struct TkText *textPtr,
671     struct TkTextIndex *indexPtr, TkTextSegment *segPtr,
672     int offset, int maxX, int maxChars,
673     int noCharsYet, TkWrapMode wrapMode,
674     struct TkTextDispChunk *chunkPtr));
675     typedef void Tk_SegCheckProc _ANSI_ARGS_((TkTextSegment *segPtr,
676     TkTextLine *linePtr));
677    
678     typedef struct Tk_SegType {
679     char *name; /* Name of this kind of segment. */
680     int leftGravity; /* If a segment has zero size (e.g. a
681     * mark or tag toggle), does it
682     * attach to character to its left
683     * or right? 1 means left, 0 means
684     * right. */
685     Tk_SegSplitProc *splitProc; /* Procedure to split large segment
686     * into two smaller ones. */
687     Tk_SegDeleteProc *deleteProc; /* Procedure to call to delete
688     * segment. */
689     Tk_SegCleanupProc *cleanupProc; /* After any change to a line, this
690     * procedure is invoked for all
691     * segments left in the line to
692     * perform any cleanup they wish
693     * (e.g. joining neighboring
694     * segments). */
695     Tk_SegLineChangeProc *lineChangeProc;
696     /* Invoked when a segment is about
697     * to be moved from its current line
698     * to an earlier line because of
699     * a deletion. The linePtr is that
700     * for the segment's old line.
701     * CleanupProc will be invoked after
702     * the deletion is finished. */
703     Tk_SegLayoutProc *layoutProc; /* Returns size information when
704     * figuring out what to display in
705     * window. */
706     Tk_SegCheckProc *checkProc; /* Called during consistency checks
707     * to check internal consistency of
708     * segment. */
709     } Tk_SegType;
710    
711     /*
712     * The constant below is used to specify a line when what is really
713     * wanted is the entire text. For now, just use a very big number.
714     */
715    
716     #define TK_END_OF_TEXT 1000000
717    
718     /*
719     * The following definition specifies the maximum number of characters
720     * needed in a string to hold a position specifier.
721     */
722    
723     #define TK_POS_CHARS 30
724    
725     /*
726     * Declarations for variables shared among the text-related files:
727     */
728    
729     extern int tkBTreeDebug;
730     extern int tkTextDebug;
731     extern Tk_SegType tkTextCharType;
732     extern Tk_SegType tkTextLeftMarkType;
733     extern Tk_SegType tkTextRightMarkType;
734     extern Tk_SegType tkTextToggleOnType;
735     extern Tk_SegType tkTextToggleOffType;
736    
737     /*
738     * Declarations for procedures that are used by the text-related files
739     * but shouldn't be used anywhere else in Tk (or by Tk clients):
740     */
741    
742     extern int TkBTreeCharTagged _ANSI_ARGS_((TkTextIndex *indexPtr,
743     TkTextTag *tagPtr));
744     extern void TkBTreeCheck _ANSI_ARGS_((TkTextBTree tree));
745     extern int TkBTreeCharsInLine _ANSI_ARGS_((TkTextLine *linePtr));
746     extern int TkBTreeBytesInLine _ANSI_ARGS_((TkTextLine *linePtr));
747     extern TkTextBTree TkBTreeCreate _ANSI_ARGS_((TkText *textPtr));
748     extern void TkBTreeDestroy _ANSI_ARGS_((TkTextBTree tree));
749     extern void TkBTreeDeleteChars _ANSI_ARGS_((TkTextIndex *index1Ptr,
750     TkTextIndex *index2Ptr));
751     extern TkTextLine * TkBTreeFindLine _ANSI_ARGS_((TkTextBTree tree,
752     int line));
753     extern TkTextTag ** TkBTreeGetTags _ANSI_ARGS_((TkTextIndex *indexPtr,
754     int *numTagsPtr));
755     extern void TkBTreeInsertChars _ANSI_ARGS_((TkTextIndex *indexPtr,
756     char *string));
757     extern int TkBTreeLineIndex _ANSI_ARGS_((TkTextLine *linePtr));
758     extern void TkBTreeLinkSegment _ANSI_ARGS_((TkTextSegment *segPtr,
759     TkTextIndex *indexPtr));
760     extern TkTextLine * TkBTreeNextLine _ANSI_ARGS_((TkTextLine *linePtr));
761     extern int TkBTreeNextTag _ANSI_ARGS_((TkTextSearch *searchPtr));
762     extern int TkBTreeNumLines _ANSI_ARGS_((TkTextBTree tree));
763     extern TkTextLine * TkBTreePreviousLine _ANSI_ARGS_((TkTextLine *linePtr));
764     extern int TkBTreePrevTag _ANSI_ARGS_((TkTextSearch *searchPtr));
765     extern void TkBTreeStartSearch _ANSI_ARGS_((TkTextIndex *index1Ptr,
766     TkTextIndex *index2Ptr, TkTextTag *tagPtr,
767     TkTextSearch *searchPtr));
768     extern void TkBTreeStartSearchBack _ANSI_ARGS_((TkTextIndex *index1Ptr,
769     TkTextIndex *index2Ptr, TkTextTag *tagPtr,
770     TkTextSearch *searchPtr));
771     extern void TkBTreeTag _ANSI_ARGS_((TkTextIndex *index1Ptr,
772     TkTextIndex *index2Ptr, TkTextTag *tagPtr,
773     int add));
774     extern void TkBTreeUnlinkSegment _ANSI_ARGS_((TkTextBTree tree,
775     TkTextSegment *segPtr, TkTextLine *linePtr));
776     extern void TkTextBindProc _ANSI_ARGS_((ClientData clientData,
777     XEvent *eventPtr));
778     extern void TkTextChanged _ANSI_ARGS_((TkText *textPtr,
779     TkTextIndex *index1Ptr, TkTextIndex *index2Ptr));
780     extern int TkTextCharBbox _ANSI_ARGS_((TkText *textPtr,
781     TkTextIndex *indexPtr, int *xPtr, int *yPtr,
782     int *widthPtr, int *heightPtr));
783     extern int TkTextCharLayoutProc _ANSI_ARGS_((TkText *textPtr,
784     TkTextIndex *indexPtr, TkTextSegment *segPtr,
785     int offset, int maxX, int maxChars, int noBreakYet,
786     TkWrapMode wrapMode, TkTextDispChunk *chunkPtr));
787     extern void TkTextCreateDInfo _ANSI_ARGS_((TkText *textPtr));
788     extern int TkTextDLineInfo _ANSI_ARGS_((TkText *textPtr,
789     TkTextIndex *indexPtr, int *xPtr, int *yPtr,
790     int *widthPtr, int *heightPtr, int *basePtr));
791     extern TkTextTag * TkTextCreateTag _ANSI_ARGS_((TkText *textPtr,
792     char *tagName));
793     extern void TkTextFreeDInfo _ANSI_ARGS_((TkText *textPtr));
794     extern void TkTextFreeTag _ANSI_ARGS_((TkText *textPtr,
795     TkTextTag *tagPtr));
796     extern int TkTextGetIndex _ANSI_ARGS_((Tcl_Interp *interp,
797     TkText *textPtr, char *string,
798     TkTextIndex *indexPtr));
799     extern TkTextTabArray * TkTextGetTabs _ANSI_ARGS_((Tcl_Interp *interp,
800     Tk_Window tkwin, char *string));
801     extern void TkTextIndexBackBytes _ANSI_ARGS_((
802     CONST TkTextIndex *srcPtr, int count,
803     TkTextIndex *dstPtr));
804     extern void TkTextIndexBackChars _ANSI_ARGS_((
805     CONST TkTextIndex *srcPtr, int count,
806     TkTextIndex *dstPtr));
807     extern int TkTextIndexCmp _ANSI_ARGS_((
808     CONST TkTextIndex *index1Ptr,
809     CONST TkTextIndex *index2Ptr));
810     extern void TkTextIndexForwBytes _ANSI_ARGS_((
811     CONST TkTextIndex *srcPtr, int count,
812     TkTextIndex *dstPtr));
813     extern void TkTextIndexForwChars _ANSI_ARGS_((
814     CONST TkTextIndex *srcPtr, int count,
815     TkTextIndex *dstPtr));
816     extern TkTextSegment * TkTextIndexToSeg _ANSI_ARGS_((
817     CONST TkTextIndex *indexPtr, int *offsetPtr));
818     extern void TkTextInsertDisplayProc _ANSI_ARGS_((
819     TkTextDispChunk *chunkPtr, int x, int y, int height,
820     int baseline, Display *display, Drawable dst,
821     int screenY));
822     extern void TkTextLostSelection _ANSI_ARGS_((
823     ClientData clientData));
824     extern TkTextIndex * TkTextMakeCharIndex _ANSI_ARGS_((TkTextBTree tree,
825     int lineIndex, int charIndex,
826     TkTextIndex *indexPtr));
827     extern int TkTextIsElided _ANSI_ARGS_((TkText *textPtr,
828     TkTextIndex *indexPtr));
829     extern TkTextIndex * TkTextMakeByteIndex _ANSI_ARGS_((TkTextBTree tree,
830     int lineIndex, int byteIndex,
831     TkTextIndex *indexPtr));
832     extern int TkTextMarkCmd _ANSI_ARGS_((TkText *textPtr,
833     Tcl_Interp *interp, int argc, char **argv));
834     extern int TkTextMarkNameToIndex _ANSI_ARGS_((TkText *textPtr,
835     char *name, TkTextIndex *indexPtr));
836     extern void TkTextMarkSegToIndex _ANSI_ARGS_((TkText *textPtr,
837     TkTextSegment *markPtr, TkTextIndex *indexPtr));
838     extern void TkTextEventuallyRepick _ANSI_ARGS_((TkText *textPtr));
839     extern void TkTextPickCurrent _ANSI_ARGS_((TkText *textPtr,
840     XEvent *eventPtr));
841     extern void TkTextPixelIndex _ANSI_ARGS_((TkText *textPtr,
842     int x, int y, TkTextIndex *indexPtr));
843     extern void TkTextPrintIndex _ANSI_ARGS_((
844     CONST TkTextIndex *indexPtr, char *string));
845     extern void TkTextRedrawRegion _ANSI_ARGS_((TkText *textPtr,
846     int x, int y, int width, int height));
847     extern void TkTextRedrawTag _ANSI_ARGS_((TkText *textPtr,
848     TkTextIndex *index1Ptr, TkTextIndex *index2Ptr,
849     TkTextTag *tagPtr, int withTag));
850     extern void TkTextRelayoutWindow _ANSI_ARGS_((TkText *textPtr));
851     extern int TkTextScanCmd _ANSI_ARGS_((TkText *textPtr,
852     Tcl_Interp *interp, int argc, char **argv));
853     extern int TkTextSeeCmd _ANSI_ARGS_((TkText *textPtr,
854     Tcl_Interp *interp, int argc, char **argv));
855     extern int TkTextSegToOffset _ANSI_ARGS_((
856     CONST TkTextSegment *segPtr,
857     CONST TkTextLine *linePtr));
858     extern TkTextSegment * TkTextSetMark _ANSI_ARGS_((TkText *textPtr, char *name,
859     TkTextIndex *indexPtr));
860     extern void TkTextSetYView _ANSI_ARGS_((TkText *textPtr,
861     TkTextIndex *indexPtr, int pickPlace));
862     extern int TkTextTagCmd _ANSI_ARGS_((TkText *textPtr,
863     Tcl_Interp *interp, int argc, char **argv));
864     extern int TkTextImageCmd _ANSI_ARGS_((TkText *textPtr,
865     Tcl_Interp *interp, int argc, char **argv));
866     extern int TkTextImageIndex _ANSI_ARGS_((TkText *textPtr,
867     char *name, TkTextIndex *indexPtr));
868     extern int TkTextWindowCmd _ANSI_ARGS_((TkText *textPtr,
869     Tcl_Interp *interp, int argc, char **argv));
870     extern int TkTextWindowIndex _ANSI_ARGS_((TkText *textPtr,
871     char *name, TkTextIndex *indexPtr));
872     extern int TkTextXviewCmd _ANSI_ARGS_((TkText *textPtr,
873     Tcl_Interp *interp, int argc, char **argv));
874     extern int TkTextYviewCmd _ANSI_ARGS_((TkText *textPtr,
875     Tcl_Interp *interp, int argc, char **argv));
876    
877     # undef TCL_STORAGE_CLASS
878     # define TCL_STORAGE_CLASS DLLIMPORT
879    
880     #endif /* _TKTEXT */
881    
882    
883     /* $History: tkText.h $
884     *
885     * ***************** Version 1 *****************
886     * User: Dtashley Date: 1/02/01 Time: 3:08a
887     * Created in $/IjuScripter, IjuConsole/Source/Tk Base
888     * Initial check-in.
889     */
890    
891     /* End of TKTEXT.H */

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25