2 * $XConsortium: TextSrc.h,v 1.11 94/04/17 20:13:15 kaleb Exp $
5 /***********************************************************
7 Copyright (c) 1987, 1988, 1994 X Consortium
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 Except as contained in this notice, the name of the X Consortium shall not be
27 used in advertising or otherwise to promote the sale, use or other dealings
28 in this Software without prior written authorization from the X Consortium.
31 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
35 Permission to use, copy, modify, and distribute this software and its
36 documentation for any purpose and without fee is hereby granted,
37 provided that the above copyright notice appear in all copies and that
38 both that copyright notice and this permission notice appear in
39 supporting documentation, and that the name of Digital not be
40 used in advertising or publicity pertaining to distribution of the
41 software without specific, written prior permission.
43 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
44 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
45 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
46 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
47 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
48 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
51 ******************************************************************/
56 /***********************************************************************
60 ***********************************************************************/
62 #include <X11/Xaw/Text.h>
66 Name Class RepType Default Value
67 ---- ----- ------- -------------
68 editType EditType XawTextEditType XawtextRead
72 /* Class record constants */
74 extern WidgetClass textSrcObjectClass
;
76 typedef struct _TextSrcClassRec
*TextSrcObjectClass
;
77 typedef struct _TextSrcRec
*TextSrcObject
;
79 typedef enum {XawstPositions
, XawstWhiteSpace
, XawstEOL
, XawstParagraph
,
80 XawstAll
} XawTextScanType
;
81 typedef enum {Normal
, Selected
}highlightType
;
82 typedef enum {XawsmTextSelect
, XawsmTextExtend
} XawTextSelectionMode
;
83 typedef enum {XawactionStart
, XawactionAdjust
, XawactionEnd
}
84 XawTextSelectionAction
;
90 #define XawTextReadError -1
91 #define XawTextScanError -1
93 /************************************************************
97 ************************************************************/
101 /* Function Name: XawTextSourceRead
102 * Description: This function reads the source.
103 * Arguments: w - the TextSrc Object.
104 * pos - position of the text to retreive.
105 * RETURNED text - text block that will contain returned text.
106 * length - maximum number of characters to read.
107 * Returns: The number of characters read into the buffer.
110 extern XawTextPosition
XawTextSourceRead(
111 #if NeedFunctionPrototypes
113 XawTextPosition
/* pos */,
114 XawTextBlock
* /* text_return */,
119 /* Function Name: XawTextSourceReplace.
120 * Description: Replaces a block of text with new text.
121 * Arguments: src - the Text Source Object.
122 * startPos, endPos - ends of text that will be removed.
123 * text - new text to be inserted into buffer at startPos.
124 * Returns: XawEditError or XawEditDone.
127 extern int XawTextSourceReplace (
128 #if NeedFunctionPrototypes
130 XawTextPosition
/* start */,
131 XawTextPosition
/* end */,
132 XawTextBlock
* /* text */
136 /* Function Name: XawTextSourceScan
137 * Description: Scans the text source for the number and type
139 * Arguments: w - the TextSrc Object.
140 * position - the position to start scanning.
141 * type - type of thing to scan for.
142 * dir - direction to scan.
143 * count - which occurance if this thing to search for.
144 * include - whether or not to include the character found in
145 * the position that is returned.
146 * Returns: The position of the text.
150 extern XawTextPosition
XawTextSourceScan(
151 #if NeedFunctionPrototypes
153 XawTextPosition
/* position */,
154 #if NeedWidePrototypes
155 /* XawTextScanType */ int /* type */,
156 /* XawTextScanDirection */ int /* dir */,
158 XawTextScanType
/* type */,
159 XawTextScanDirection
/* dir */,
162 #if NeedWidePrototypes
163 /* Boolean */ int /* include */
165 Boolean
/* include */
170 /* Function Name: XawTextSourceSearch
171 * Description: Searchs the text source for the text block passed
172 * Arguments: w - the TextSource Object.
173 * position - the position to start scanning.
174 * dir - direction to scan.
175 * text - the text block to search for.
176 * Returns: The position of the text we are searching for or
177 * XawTextSearchError.
180 extern XawTextPosition
XawTextSourceSearch(
181 #if NeedFunctionPrototypes
183 XawTextPosition
/* position */,
184 #if NeedWidePrototypes
185 /* XawTextScanDirection */ int /* dir */,
187 XawTextScanDirection
/* dir */,
189 XawTextBlock
* /* text */
193 /* Function Name: XawTextSourceConvertSelection
194 * Description: Dummy selection converter.
195 * Arguments: w - the TextSrc object.
196 * selection - the current selection atom.
197 * target - the current target atom.
198 * type - the type to conver the selection to.
199 * RETURNED value, length - the return value that has been converted.
200 * RETURNED format - the format of the returned value.
201 * Returns: TRUE if the selection has been converted.
205 extern Boolean
XawTextSourceConvertSelection(
206 #if NeedFunctionPrototypes
208 Atom
* /* selection */,
211 XtPointer
* /* value_return */,
212 unsigned long* /* length_return */,
213 int* /* format_return */
217 /* Function Name: XawTextSourceSetSelection
218 * Description: allows special setting of the selection.
219 * Arguments: w - the TextSrc object.
220 * left, right - bounds of the selection.
221 * selection - the selection atom.
225 extern void XawTextSourceSetSelection(
226 #if NeedFunctionPrototypes
228 XawTextPosition
/* start */,
229 XawTextPosition
/* end */,
236 #endif /* _XawTextSrc_h */
237 /* DON'T ADD STUFF AFTER THIS #endif */