Modified the UGetCursor() routine to return a valid response if the
[xcircuit.git] / Xw / TextEdit.h
blobd9d4d2afe55464429d0b985941a102337a3f8a8d
1 /*************************************<+>*************************************
2 *****************************************************************************
3 **
4 ** File: TextEdit.h
5 **
6 ** Project: X Widgets
7 **
8 ** Description: TextEdit widget public include file
9 **
10 *****************************************************************************
11 **
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
16 **
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.
25 **
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
32 ** SOFTWARE.
33 **
34 *****************************************************************************
35 *************************************<+>*************************************/
37 #ifndef _XwTextEdit_h
38 #define _XwTextEdit_h
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;
65 typedef enum
66 {XwstPositions, XwstWhiteSpace, XwstEOL, XwstLast} XwScanType;
68 typedef struct {
69 int firstPos;
70 int length;
71 unsigned char *ptr;
72 } XwTextBlock, *XwTextBlockPtr;
74 typedef enum {XwtextRead, XwtextAppend, XwtextEdit} XwEditType;
75 typedef enum
76 {XweditDone, XweditError, XweditPosError, XweditReject} XwEditResult;
78 typedef struct {
79 XtResource *resources;
80 Cardinal resource_num;
81 int (*read)();
82 XwEditResult (*replace)();
83 XwTextPosition (*getLastPos)();
84 int (*setLastPos)();
85 XwTextPosition (*scan)();
86 XwEditType (*editType)();
87 Boolean (*check_data)();
88 void (*destroy)();
89 int *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 ;
97 #define tfNoFit 0x01
98 #define tfIncludeTab 0x02
99 #define tfEndText 0x04
100 #define tfNewline 0x08
101 #define tfWrapWhiteSpace 0x10
102 #define tfWrapAny 0x20
104 typedef struct {
105 XwTextEditWidget parent;
106 XFontStruct *font;
107 int foreground;
108 XtResource *resources;
109 Cardinal resource_num;
110 int (*display)();
111 int (*insertCursor)();
112 int (*clearToBackground)();
113 int (*findPosition)();
114 TextFit (*textFitFn)();
115 int (*findDistance)();
116 int (*resolve)();
117 int (*maxLines)();
118 int (*maxHeight)();
119 Boolean (*check_data)();
120 void (*destroy)();
121 int LineLastWidth ;
122 XwTextPosition LineLastPosition ;
123 int *data;
124 } XwTextSink, *XwTextSinkPtr;
126 /*************************************************************************
128 * Support for Verification Callbacks
130 *************************************************************************/
132 typedef enum {motionVerify, modVerify, leaveVerify} XwVerifyOpType;
134 typedef struct {
135 XEvent *xevent;
136 XwVerifyOpType operation;
137 Boolean doit;
138 XwTextPosition currInsert, newInsert;
139 XwTextPosition startPos, endPos;
140 XwTextBlock *text;
141 } XwTextVerifyCD, *XwTextVerifyPtr;
144 /* Class record constants */
146 typedef enum {XwstringSrc, XwdiskSrc, XwprogDefinedSrc} XwSourceType;
148 /* other stuff */
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 ;
168 /* Scroll options */
169 typedef int XwScroll ;
171 /* Grow options */
172 typedef int XwGrow ;
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,
192 endpos;
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;
218 Boolean status */
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();
250 /* Widget w */
251 /* ArgList args */
252 /* Cardinal num_args */
254 extern XwTextSource *XwStringSourceCreate();
255 /* Widget parent; */
256 /* ArgList args; */
257 /* int argCount; */
259 extern void XwStringSourceDestroy();
260 /* XwTextSource *src */
262 #endif
263 /* DON'T ADD STUFF AFTER THIS #endif */