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