1 /* $XConsortium: Text.h,v 1.45 94/04/17 20:13:05 kaleb Exp $ */
2 
3 /*
4  * MODIFIED FOR N*XTSTEP LOOK by Carlos A M dos Santos - 1999
5  * <casantos@cpmet.ufpel.tche.br>
6 */
7 
8 /***********************************************************
9 
10 Copyright (c) 1987, 1988, 1994  X Consortium
11 
12 Permission is hereby granted, free of charge, to any person obtaining a copy
13 of this software and associated documentation files (the "Software"), to deal
14 in the Software without restriction, including without limitation the rights
15 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16 copies of the Software, and to permit persons to whom the Software is
17 furnished to do so, subject to the following conditions:
18 
19 The above copyright notice and this permission notice shall be included in
20 all copies or substantial portions of the Software.
21 
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
25 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
26 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 
29 Except as contained in this notice, the name of the X Consortium shall not be
30 used in advertising or otherwise to promote the sale, use or other dealings
31 in this Software without prior written authorization from the X Consortium.
32 
33 
34 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
35 
36                         All Rights Reserved
37 
38 Permission to use, copy, modify, and distribute this software and its
39 documentation for any purpose and without fee is hereby granted,
40 provided that the above copyright notice appear in all copies and that
41 both that copyright notice and this permission notice appear in
42 supporting documentation, and that the name of Digital not be
43 used in advertising or publicity pertaining to distribution of the
44 software without specific, written prior permission.
45 
46 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
47 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
48 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
49 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
50 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
51 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
52 SOFTWARE.
53 
54 ******************************************************************/
55 
56 #ifndef _XawText_h
57 #define _XawText_h
58 
59 #include <X11/neXtaw/Simple.h>
60 
61 /*
62  Text widget
63 
64  Class: 	textWidgetClass
65  Class Name:	Text
66  Superclass:	Simple
67 
68  Resources added by the Text widget:
69 
70  Name		     Class	     RepType		Default Value
71  ----		     -----	     -------		-------------
72  autoFill	    AutoFill	     Boolean		False
73  bottomMargin	    Margin	     Position		2
74  displayPosition    TextPosition     XawTextPosition	0
75  insertPosition	    TextPosition     XawTextPosition	0
76  leftMargin	    Margin	     Position		2
77  resize		    Resize	     XawTextResizeMode	XawTextResizeNever
78  rightMargin	    Margin	     Position		4
79  scrollHorizontal   Scroll	     XawTextScrollMode	XawtextScrollNever
80  scrollVertical     Scroll	     XawTextScrollMode  XawtextScrollNever
81  selectTypes        SelectTypes      Pointer            see documentation
82  textSink	    TextSink	     Widget		NULL
83  textSource	    TextSource	     Widget		NULL
84  topMargin	    Margin	     Position		2
85  unrealizeCallback  Callback	     Callback		NULL
86  wrap		    Wrap	     XawTextWrapMode	XawTextWrapNever
87 
88 */
89 
90 typedef long XawTextPosition;
91 
92 typedef enum { XawtextScrollNever,
93 	       XawtextScrollWhenNeeded, XawtextScrollAlways} XawTextScrollMode;
94 
95 typedef enum { XawtextWrapNever,
96 	       XawtextWrapLine, XawtextWrapWord} XawTextWrapMode;
97 
98 typedef enum { XawtextResizeNever, XawtextResizeWidth,
99 	       XawtextResizeHeight, XawtextResizeBoth} XawTextResizeMode;
100 
101 typedef enum {XawsdLeft, XawsdRight} XawTextScanDirection;
102 typedef enum {XawtextRead, XawtextAppend, XawtextEdit} XawTextEditType;
103 typedef enum {XawselectNull, XawselectPosition, XawselectChar, XawselectWord,
104     XawselectLine, XawselectParagraph, XawselectAll} XawTextSelectType;
105 
106 typedef struct {
107     int  firstPos;
108     int  length;
109     char *ptr;
110     unsigned long format;
111     } XawTextBlock, *XawTextBlockPtr;
112 
113 #include <X11/neXtaw/TextSink.h>
114 #include <X11/neXtaw/TextSrc.h>
115 
116 #define XtEtextScrollNever "never"
117 #define XtEtextScrollWhenNeeded "whenneeded"
118 #define XtEtextScrollAlways "always"
119 
120 #define XtEtextWrapNever "never"
121 #define XtEtextWrapLine "line"
122 #define XtEtextWrapWord "word"
123 
124 #define XtEtextResizeNever "never"
125 #define XtEtextResizeWidth "width"
126 #define XtEtextResizeHeight "height"
127 #define XtEtextResizeBoth "both"
128 
129 #define XtNautoFill "autoFill"
130 #define XtNbottomMargin "bottomMargin"
131 #define XtNdialogHOffset "dialogHOffset"
132 #define XtNdialogVOffset "dialogVOffset"
133 #define XtNdisplayCaret "displayCaret"
134 #define XtNdisplayPosition "displayPosition"
135 #define XtNleftMargin "leftMargin"
136 #define XtNrightMargin "rightMargin"
137 #define XtNscrollVertical "scrollVertical"
138 #define XtNscrollHorizontal "scrollHorizontal"
139 #define XtNselectTypes "selectTypes"
140 #define XtNtopMargin "topMargin"
141 #define XtNwrap "wrap"
142 
143 #define XtCAutoFill "AutoFill"
144 #define XtCScroll "Scroll"
145 #define XtCSelectTypes "SelectTypes"
146 #define XtCWrap "Wrap"
147 
148 #ifndef _XtStringDefs_h_
149 #define XtNinsertPosition "insertPosition"
150 #define XtNresize "resize"
151 #define XtNselection "selection"
152 #define XtCResize "Resize"
153 #endif
154 
155 /* Return Error code for XawTextSearch */
156 
157 #define XawTextSearchError      (-12345L)
158 
159 /* Return codes from XawTextReplace */
160 
161 #define XawReplaceError	       -1
162 #define XawEditDone		0
163 #define XawEditError		1
164 #define XawPositionError	2
165 
166 extern unsigned long FMT8BIT;
167 extern unsigned long XawFmt8Bit;
168 extern unsigned long XawFmtWide;
169 
170 /* Class record constants */
171 
172 extern WidgetClass textWidgetClass;
173 
174 typedef struct _TextClassRec *TextWidgetClass;
175 typedef struct _TextRec      *TextWidget;
176 
177 _XFUNCPROTOBEGIN
178 
179 extern XrmQuark _XawTextFormat(
180 #if NeedFunctionPrototypes
181     TextWidget		/* tw */
182 #endif
183 );
184 
185 extern void XawTextDisplay(
186 #if NeedFunctionPrototypes
187     Widget		/* w */
188 #endif
189 );
190 
191 extern void XawTextEnableRedisplay(
192 #if NeedFunctionPrototypes
193     Widget		/* w */
194 #endif
195 );
196 
197 extern void XawTextDisableRedisplay(
198 #if NeedFunctionPrototypes
199     Widget		/* w */
200 #endif
201 );
202 
203 extern void XawTextSetSelectionArray(
204 #if NeedFunctionPrototypes
205     Widget		/* w */,
206     XawTextSelectType*	/* sarray */
207 #endif
208 );
209 
210 extern void XawTextGetSelectionPos(
211 #if NeedFunctionPrototypes
212     Widget		/* w */,
213     XawTextPosition*	/* begin_return */,
214     XawTextPosition*	/* end_return */
215 #endif
216 );
217 
218 extern void XawTextSetSource(
219 #if NeedFunctionPrototypes
220     Widget		/* w */,
221     Widget		/* source */,
222     XawTextPosition	/* position */
223 #endif
224 );
225 
226 extern int XawTextReplace(
227 #if NeedFunctionPrototypes
228     Widget		/* w */,
229     XawTextPosition	/* start */,
230     XawTextPosition	/* end */,
231     XawTextBlock*	/* text */
232 #endif
233 );
234 
235 extern XawTextPosition XawTextTopPosition(
236 #if NeedFunctionPrototypes
237     Widget		/* w */
238 #endif
239 );
240 
241 extern void XawTextSetInsertionPoint(
242 #if NeedFunctionPrototypes
243     Widget		/* w */,
244     XawTextPosition	/* position */
245 #endif
246 );
247 
248 extern XawTextPosition XawTextGetInsertionPoint(
249 #if NeedFunctionPrototypes
250     Widget		/* w */
251 #endif
252 );
253 
254 extern void XawTextUnsetSelection(
255 #if NeedFunctionPrototypes
256     Widget		/* w */
257 #endif
258 );
259 
260 extern void XawTextSetSelection(
261 #if NeedFunctionPrototypes
262     Widget		/* w */,
263     XawTextPosition	/* left */,
264     XawTextPosition	/* right */
265 #endif
266 );
267 
268 extern void XawTextInvalidate(
269 #if NeedFunctionPrototypes
270     Widget		/* w */,
271     XawTextPosition	/* from */,
272     XawTextPosition	/* to */
273 #endif
274 );
275 
276 extern Widget XawTextGetSource(
277 #if NeedFunctionPrototypes
278     Widget		/* w */
279 #endif
280 );
281 
282 extern XawTextPosition XawTextSearch(
283 #if NeedFunctionPrototypes
284     Widget			/* w */,
285 #if NeedWidePrototypes
286     /* XawTextScanDirection */ int /* dir */,
287 #else
288     XawTextScanDirection	/* dir */,
289 #endif
290     XawTextBlock*		/* text */
291 #endif
292 );
293 
294 extern void XawTextDisplayCaret(
295 #if NeedFunctionPrototypes
296     Widget		/* w */,
297 #if NeedWidePrototypes
298     /* Boolean */ int	/* visible */
299 #else
300     Boolean		/* visible */
301 #endif
302 #endif
303 );
304 
305 _XFUNCPROTOEND
306 
307 /*
308  * For R3 compatability only.
309  */
310 
311 #include <X11/neXtaw/AsciiSrc.h>
312 #include <X11/neXtaw/AsciiSink.h>
313 
314 #endif /* _XawText_h */
315 /* DON'T ADD STUFF AFTER THIS #endif */
316