add janet package
[oi-userland.git] / components / x11 / libXaw4 / src / Xaw3_1TextP.h
blob8a1e2de44893576c6515ee0206a194bfe262faee
1 /*
2 * $XConsortium: TextP.h,v 1.42 89/11/21 15:48:03 swick Exp $
3 */
6 /***********************************************************
7 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
8 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
10 All Rights Reserved
12 Permission to use, copy, modify, and distribute this software and its
13 documentation for any purpose and without fee is hereby granted,
14 provided that the above copyright notice appear in all copies and that
15 both that copyright notice and this permission notice appear in
16 supporting documentation, and that the names of Digital or MIT not be
17 used in advertising or publicity pertaining to distribution of the
18 software without specific, written prior permission.
20 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
21 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
22 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
23 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
24 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
25 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
26 SOFTWARE.
28 ******************************************************************/
30 #ifndef _XawTextP_h
31 #define _XawTextP_h
33 #include <./Xaw3_1Text.h>
34 #include <./Xaw3_1SimpleP.h>
36 /****************************************************************
38 * Text widget private
40 ****************************************************************/
41 #define MAXCUT 30000 /* Maximum number of characters that can be cut. */
43 #define abs(x) (((x) < 0) ? (-(x)) : (x))
45 #define GETLASTPOS XawTextSourceScan(ctx->text.source, 0, \
46 XawstAll, XawsdRight, 1, TRUE)
48 #define zeroPosition ((XawTextPosition) 0)
50 extern XtActionsRec textActionsTable[];
51 extern Cardinal textActionsTableCount;
53 #define LF 0x0a
54 #define CR 0x0d
55 #define TAB 0x09
56 #define BS 0x08
57 #define SP 0x20
58 #define DEL 0x7f
59 #define BSLASH '\\'
61 /* constants that subclasses may want to know */
62 #define DEFAULT_TEXT_HEIGHT ((Dimension)~0)
64 /* displayable text management data structures */
66 typedef struct {
67 XawTextPosition position;
68 Position y;
69 Dimension textWidth;
70 } XawTextLineTableEntry, *XawTextLineTableEntryPtr;
72 typedef struct {
73 XawTextPosition left, right;
74 XawTextSelectType type;
75 Atom* selections;
76 int atom_count;
77 int array_size;
78 } XawTextSelection;
80 /* Line Tables are n+1 long - last position displayed is in last lt entry */
81 typedef struct {
82 XawTextPosition top; /* Top of the displayed text. */
83 int lines; /* How many lines in this table. */
84 XawTextLineTableEntry *info; /* A dynamic array, one entry per line */
85 } XawTextLineTable, *XawTextLineTablePtr;
88 typedef struct _XawTextMargin {
89 Position left, right, top, bottom;
90 } XawTextMargin;
92 #define VMargins(ctx) ( (ctx)->text.margin.top + (ctx)->text.margin.bottom )
93 #define HMargins(ctx) ( (ctx)->text.margin.left + (ctx)->text.margin.right )
95 #define IsPositionVisible(ctx, pos) \
96 (pos >= ctx->text.lt.info[0].position && \
97 pos < ctx->text.lt.info[ctx->text.lt.lines].position)
100 * Search & Replace data structure.
103 struct SearchAndReplace {
104 Boolean selection_changed; /* flag so that the selection cannot be
105 changed out from underneath query-replace.*/
106 Widget search_popup; /* The poppup widget that allows searches.*/
107 Widget label1; /* The label widgets for the search window. */
108 Widget label2;
109 Widget left_toggle; /* The left search toggle radioGroup. */
110 Widget right_toggle; /* The right search toggle radioGroup. */
111 Widget rep_label; /* The Replace label string. */
112 Widget rep_text; /* The Replace text field. */
113 Widget search_text; /* The Search text field. */
114 Widget rep_one; /* The Replace one button. */
115 Widget rep_all; /* The Replace all button. */
118 /* Private Text Definitions */
120 typedef int (*ActionProc)();
122 /* New fields for the Text widget class record */
124 typedef struct {int empty;} TextClassPart;
126 /* Full class record declaration */
127 typedef struct _TextClassRec {
128 CoreClassPart core_class;
129 SimpleClassPart simple_class;
130 TextClassPart text_class;
131 } TextClassRec;
133 extern TextClassRec textClassRec;
135 /* New fields for the Text widget record */
136 typedef struct _TextPart {
137 /* resources */
139 Widget source, sink;
140 XawTextPosition insertPos;
141 XawTextSelection s;
142 XawTextSelectType *sarray; /* Array to cycle for selections. */
143 int options; /* wordbreak, scroll, etc. */
144 int dialog_horiz_offset; /* position for popup dialog */
145 int dialog_vert_offset; /* position for popup dialog */
146 Boolean display_caret; /* insertion pt visible iff T */
147 Boolean auto_fill; /* Auto fill mode? */
148 XawTextScrollMode scroll_vert, scroll_horiz; /*what type of scrollbars.*/
149 XawTextWrapMode wrap; /* The type of wrapping. */
150 XawTextResizeMode resize; /* what to resize */
151 XawTextMargin r_margin; /* The real margins. */
153 /* private state */
155 XawTextMargin margin; /* The current margins. */
156 XawTextLineTable lt;
157 XawTextScanDirection extendDir;
158 XawTextSelection origSel; /* the selection being modified */
159 Time lasttime; /* timestamp of last processed action */
160 Time time; /* time of last key or button action */
161 Position ev_x, ev_y; /* x, y coords for key or button action */
162 Widget vbar, hbar; /* The scroll bars (none = NULL). */
163 struct SearchAndReplace * search;/* Search and replace structure. */
164 Widget file_insert; /* The file insert popup widget. */
165 XawTextPosition *updateFrom; /* Array of start positions for update. */
166 XawTextPosition *updateTo; /* Array of end positions for update. */
167 int numranges; /* How many update ranges there are. */
168 int maxranges; /* How many ranges we have space for */
169 XawTextPosition lastPos; /* Last position of source. */
170 GC gc;
171 Boolean showposition; /* True if we need to show the position. */
172 Boolean hasfocus; /* TRUE if we currently have input focus.*/
173 Boolean update_disabled; /* TRUE if display updating turned off */
174 Boolean single_char; /* Single character replaced. */
175 XawTextPosition old_insert; /* Last insertPos for batched updates */
176 short mult; /* Multiplier. */
178 /* private state, shared w/Source and Sink */
179 Boolean redisplay_needed; /* in SetValues */
181 } TextPart;
183 /*************************************************************
185 * Resource types private to Text widget.
187 *************************************************************/
189 #define XtRScrollMode "ScrollMode"
190 #define XtRWrapMode "WrapMode"
191 #define XtRResizeMode "ResizeMode"
193 /****************************************************************
195 * Full instance record declaration
197 ****************************************************************/
199 typedef struct _TextRec {
200 CorePart core;
201 SimplePart simple;
202 TextPart text;
203 } TextRec;
205 #ifdef XAW_BC
206 /*************************************************************
207 * For Compatibility only. */
209 #define XtTextLineTable XawTextLineTable
210 #define XtTextLineTablePtr XawTextLineTablePtr
211 #define XtTextLineTableEntry XawTextLineTableEntry
212 #define XtTextLineTableEntryPtr XawTextLineTableEntryPtr
214 /*************************************************************/
215 #endif /* XAW_BC */
217 #endif /* _XawTextP_h */