1 /*************************************<+>*************************************
2 *****************************************************************************
8 ** Description: TextEdit widget public include file
10 *****************************************************************************
12 ** Copyright (c) 1988 by Hewlett-Packard Company
13 ** Copyright (c) 1987, 1988 by Digital Equipment Corporation, Maynard,
14 ** Massachusetts, and the Massachusetts Institute of Technology,
15 ** Cambridge, Massachusetts
17 ** Permission to use, copy, modify, and distribute this software
18 ** and its documentation for any purpose and without fee is hereby
19 ** granted, provided that the above copyright notice appear in all
20 ** copies and that both that copyright notice and this permission
21 ** notice appear in supporting documentation, and that the names of
22 ** Hewlett-Packard, Digital or M.I.T. not be used in advertising or
23 ** publicity pertaining to distribution of the software without
24 ** written prior permission.
26 ** DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
27 ** ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
28 ** DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
29 ** ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30 ** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
31 ** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
34 *****************************************************************************
35 *************************************<+>*************************************/
40 #define XwSetArg(arg, n, v) \
41 { Arg *_XwSetArgTmp = &(arg) ;\
42 _XwSetArgTmp->name = (n) ;\
43 _XwSetArgTmp->value = (XtArgVal) (v) ;}
45 #include <X11/StringDefs.h>
49 /*************************************************************************
51 * Structures used in TextEdit function calls
53 *************************************************************************/
55 extern WidgetClass XwtexteditWidgetClass
;
56 /* synonym added for consistent naming conventions */
57 extern WidgetClass XwtextEditWidgetClass
;
59 typedef struct _XwTextEditClassRec
*XwTextEditWidgetClass
;
60 typedef struct _XwTextEditRec
*XwTextEditWidget
;
62 typedef long XwTextPosition
;
64 typedef enum {XwsdLeft
, XwsdRight
} XwScanDirection
;
66 {XwstPositions
, XwstWhiteSpace
, XwstEOL
, XwstLast
} XwScanType
;
72 } XwTextBlock
, *XwTextBlockPtr
;
74 typedef enum {XwtextRead
, XwtextAppend
, XwtextEdit
} XwEditType
;
76 {XweditDone
, XweditError
, XweditPosError
, XweditReject
} XwEditResult
;
79 XtResource
*resources
;
80 Cardinal resource_num
;
82 XwEditResult (*replace
)();
83 XwTextPosition (*getLastPos
)();
85 XwTextPosition (*scan
)();
86 XwEditType (*editType
)();
87 Boolean (*check_data
)();
90 } XwTextSource
, *XwTextSourcePtr
;
92 /* this wouldn't be here if source and display (still called
93 sink here) were properly separated, classed and subclassed
96 typedef short TextFit
;
98 #define tfIncludeTab 0x02
99 #define tfEndText 0x04
100 #define tfNewline 0x08
101 #define tfWrapWhiteSpace 0x10
102 #define tfWrapAny 0x20
105 XwTextEditWidget parent
;
108 XtResource
*resources
;
109 Cardinal resource_num
;
111 int (*insertCursor
)();
112 int (*clearToBackground
)();
113 int (*findPosition
)();
114 TextFit (*textFitFn
)();
115 int (*findDistance
)();
119 Boolean (*check_data
)();
122 XwTextPosition LineLastPosition
;
124 } XwTextSink
, *XwTextSinkPtr
;
126 /*************************************************************************
128 * Support for Verification Callbacks
130 *************************************************************************/
132 typedef enum {motionVerify
, modVerify
, leaveVerify
} XwVerifyOpType
;
136 XwVerifyOpType operation
;
138 XwTextPosition currInsert
, newInsert
;
139 XwTextPosition startPos
, endPos
;
141 } XwTextVerifyCD
, *XwTextVerifyPtr
;
144 /* Class record constants */
146 typedef enum {XwstringSrc
, XwdiskSrc
, XwprogDefinedSrc
} XwSourceType
;
150 #define wordBreak 0x01
151 #define scrollVertical 0x02
152 #define scrollHorizontal 0x04
153 #define scrollOnOverflow 0x08
154 #define resizeWidth 0x10
155 #define resizeHeight 0x20
156 #define editable 0x40
158 /****************************************************************************
160 * Display control (grow, wrap, scroll, visible cursor)
162 ****************************************************************************/
164 typedef enum {XwWrapOff
, XwSoftWrap
, XwHardWrap
} XwWrap
;
165 typedef enum {XwSourceForm
, XwDisplayForm
} XwWrapForm
;
166 typedef enum {XwWrapAny
, XwWrapWhiteSpace
} XwWrapBreak
;
169 typedef int XwScroll
;
174 /*************************************************************************
176 * External functions from TextEdit
178 *************************************************************************/
180 extern void XwTextClearBuffer();
181 /* XwTextEditWidget w; */
183 extern unsigned char *XwTextCopyBuffer();
184 /* XwTextEditWidget w */
186 extern unsigned char *XwTextCopySelection();
187 /* XwTextEditWidget w */
189 extern int XwTextReadSubString();
190 /* XwTextEditWidget w;
191 XwTextPosition startpos,
193 unsigned char *target; Memory to copy into
194 int targetsize, Memory size
195 targetused; Memory used by copy */
197 extern void XwTextUnsetSelection();
198 /* XwTextEditWidget w */
200 extern void XwTextSetSelection();
201 /* XwTextEditWidget w;
202 XwTextPosition left, right; */
204 extern XwEditResult
XwTextReplace();
205 /* XwTextEditWidget w;
206 XwTextPosition startPos, endPos;
207 unsigned char *string; */
209 extern void XwTextRedraw();
210 /* XwTextEditWidget w */
212 #define HAVE_XWTEXTRESIZE
213 extern void XwTextResize();
214 /* XwTextEditWidget w */
216 extern void XwTextUpdate();
217 /* XwTextEditWidget w;
220 extern void XwTextInsert();
221 /* XwTextEditWidget w */
222 /* unsigned char *string */
224 extern XwTextPosition
XwTextGetLastPos();
225 /* XwTextEditWidget w; */
227 extern void XwTextGetSelectionPos();
228 /* XwTextEditWidget w; */
229 /* XwTextPosition *left, *right; */
231 extern void XwTextSetInsertPos();
232 /* XwTextEditWidget w; */
233 /* XwTextPosition position */
235 extern XwTextPosition
XwTextGetInsertPos();
236 /* XwTextEditWidget widget */
238 extern void XwTextSetSource();
239 /* XwTextEditWidget w; */
240 /* XwTextSourcePtr source; */
241 /* XwTextPosition startpos */
243 /*************************************************************************
245 * Extern Source and Sink Create/Destroy functions
247 *************************************************************************/
249 extern XwTextSink
*XwAsciiSinkCreate();
252 /* Cardinal num_args */
254 extern XwTextSource
*XwStringSourceCreate();
259 extern void XwStringSourceDestroy();
260 /* XwTextSource *src */
263 /* DON'T ADD STUFF AFTER THIS #endif */