xref: /386bsd/usr/X386/include/X11/Xaw/TextSrc.h (revision a2142627)
1 /*
2  * $XConsortium: TextSrc.h,v 1.9 91/02/17 13:12:26 rws Exp $
3  */
4 
5 /***********************************************************
6 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
7 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
8 
9                         All Rights Reserved
10 
11 Permission to use, copy, modify, and distribute this software and its
12 documentation for any purpose and without fee is hereby granted,
13 provided that the above copyright notice appear in all copies and that
14 both that copyright notice and this permission notice appear in
15 supporting documentation, and that the names of Digital or MIT not be
16 used in advertising or publicity pertaining to distribution of the
17 software without specific, written prior permission.
18 
19 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
20 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
21 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
22 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
23 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
24 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
25 SOFTWARE.
26 
27 ******************************************************************/
28 
29 #ifndef _XawTextSrc_h
30 #define _XawTextSrc_h
31 
32 /***********************************************************************
33  *
34  * TextSrc Object
35  *
36  ***********************************************************************/
37 
38 #include <X11/Object.h>
39 #include <X11/Xfuncproto.h>
40 
41 /* Resources:
42 
43  Name		     Class		RepType		Default Value
44  ----		     -----		-------		-------------
45  editType	     EditType		XawTextEditType	XawtextRead
46 
47 */
48 
49 /* Class record constants */
50 
51 extern WidgetClass textSrcObjectClass;
52 
53 typedef struct _TextSrcClassRec *TextSrcObjectClass;
54 typedef struct _TextSrcRec      *TextSrcObject;
55 
56 typedef enum {XawstPositions, XawstWhiteSpace, XawstEOL, XawstParagraph,
57               XawstAll} XawTextScanType;
58 typedef enum {Normal, Selected }highlightType;
59 typedef enum {XawsmTextSelect, XawsmTextExtend} XawTextSelectionMode;
60 typedef enum {XawactionStart, XawactionAdjust, XawactionEnd}
61     XawTextSelectionAction;
62 
63 /*
64  * Error Conditions:
65  */
66 
67 #define XawTextReadError -1
68 #define XawTextScanError -1
69 
70 /************************************************************
71  *
72  * Public Functions.
73  *
74  ************************************************************/
75 
76 _XFUNCPROTOBEGIN
77 
78 /*	Function Name: XawTextSourceRead
79  *	Description: This function reads the source.
80  *	Arguments: w - the TextSrc Object.
81  *                 pos - position of the text to retreive.
82  * RETURNED        text - text block that will contain returned text.
83  *                 length - maximum number of characters to read.
84  *	Returns: The number of characters read into the buffer.
85  */
86 
87 extern XawTextPosition XawTextSourceRead(
88 #if NeedFunctionPrototypes
89     Widget		/* w */,
90     XawTextPosition	/* pos */,
91     XawTextBlock*	/* text_return */,
92     int			/* length */
93 #endif
94 );
95 
96 /*	Function Name: XawTextSourceReplace.
97  *	Description: Replaces a block of text with new text.
98  *	Arguments: src - the Text Source Object.
99  *                 startPos, endPos - ends of text that will be removed.
100  *                 text - new text to be inserted into buffer at startPos.
101  *	Returns: XawEditError or XawEditDone.
102  */
103 
104 extern int XawTextSourceReplace (
105 #if NeedFunctionPrototypes
106     Widget		/* w */,
107     XawTextPosition	/* start */,
108     XawTextPosition	/* end */,
109     XawTextBlock*	/* text */
110 #endif
111 );
112 
113 /*	Function Name: XawTextSourceScan
114  *	Description: Scans the text source for the number and type
115  *                   of item specified.
116  *	Arguments: w - the TextSrc Object.
117  *                 position - the position to start scanning.
118  *                 type - type of thing to scan for.
119  *                 dir - direction to scan.
120  *                 count - which occurance if this thing to search for.
121  *                 include - whether or not to include the character found in
122  *                           the position that is returned.
123  *	Returns: The position of the text.
124  *
125  */
126 
127 extern XawTextPosition XawTextSourceScan(
128 #if NeedFunctionPrototypes
129     Widget		/* w */,
130     XawTextPosition	/* position */,
131 #if NeedWidePrototypes
132     /* XawTextScanType */ int		/* type */,
133     /* XawTextScanDirection */ int	/* dir */,
134 #else
135     XawTextScanType	/* type */,
136     XawTextScanDirection /* dir */,
137 #endif
138     int			/* count */,
139 #if NeedWidePrototypes
140     /* Boolean */ int	/* include */
141 #else
142     Boolean		/* include */
143 #endif
144 #endif
145 );
146 
147 /*	Function Name: XawTextSourceSearch
148  *	Description: Searchs the text source for the text block passed
149  *	Arguments: w - the TextSource Object.
150  *                 position - the position to start scanning.
151  *                 dir - direction to scan.
152  *                 text - the text block to search for.
153  *	Returns: The position of the text we are searching for or
154  *               XawTextSearchError.
155  */
156 
157 extern XawTextPosition XawTextSourceSearch(
158 #if NeedFunctionPrototypes
159     Widget		/* w */,
160     XawTextPosition	/* position */,
161 #if NeedWidePrototypes
162     /* XawTextScanDirection */ int	/* dir */,
163 #else
164     XawTextScanDirection /* dir */,
165 #endif
166     XawTextBlock*	/* text */
167 #endif
168 );
169 
170 /*	Function Name: XawTextSourceConvertSelection
171  *	Description: Dummy selection converter.
172  *	Arguments: w - the TextSrc object.
173  *                 selection - the current selection atom.
174  *                 target    - the current target atom.
175  *                 type      - the type to conver the selection to.
176  * RETURNED        value, length - the return value that has been converted.
177  * RETURNED        format    - the format of the returned value.
178  *	Returns: TRUE if the selection has been converted.
179  *
180  */
181 
182 extern Boolean XawTextSourceConvertSelection(
183 #if NeedFunctionPrototypes
184     Widget		/* w */,
185     Atom*		/* selection */,
186     Atom*		/* target */,
187     Atom*		/* type */,
188     XtPointer*		/* value_return */,
189     unsigned long*	/* length_return */,
190     int*		/* format_return */
191 #endif
192 );
193 
194 /*	Function Name: XawTextSourceSetSelection
195  *	Description: allows special setting of the selection.
196  *	Arguments: w - the TextSrc object.
197  *                 left, right - bounds of the selection.
198  *                 selection - the selection atom.
199  *	Returns: none
200  */
201 
202 extern void XawTextSourceSetSelection(
203 #if NeedFunctionPrototypes
204     Widget		/* w */,
205     XawTextPosition	/* start */,
206     XawTextPosition	/* end */,
207     Atom		/* selection */
208 #endif
209 );
210 
211 _XFUNCPROTOEND
212 
213 #endif /* _XawTextSrc_h */
214 /* DON'T ADD STUFF AFTER THIS #endif */
215