1 /* $XConsortium: Text.h,v 1.45 94/04/17 20:13:05 kaleb Exp $ */ 2 3 /*********************************************************** 4 5 Copyright (c) 1987, 1988, 1994 X Consortium 6 7 Permission is hereby granted, free of charge, to any person obtaining a copy 8 of this software and associated documentation files (the "Software"), to deal 9 in the Software without restriction, including without limitation the rights 10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 copies of the Software, and to permit persons to whom the Software is 12 furnished to do so, subject to the following conditions: 13 14 The above copyright notice and this permission notice shall be included in 15 all copies or substantial portions of the Software. 16 17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 21 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 24 Except as contained in this notice, the name of the X Consortium shall not be 25 used in advertising or otherwise to promote the sale, use or other dealings 26 in this Software without prior written authorization from the X Consortium. 27 28 29 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. 30 31 All Rights Reserved 32 33 Permission to use, copy, modify, and distribute this software and its 34 documentation for any purpose and without fee is hereby granted, 35 provided that the above copyright notice appear in all copies and that 36 both that copyright notice and this permission notice appear in 37 supporting documentation, and that the name of Digital not be 38 used in advertising or publicity pertaining to distribution of the 39 software without specific, written prior permission. 40 41 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 42 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 43 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 44 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 45 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 46 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 47 SOFTWARE. 48 49 ******************************************************************/ 50 51 #ifndef _XawText_h 52 #define _XawText_h 53 54 #include <X11/Xaw3d/Simple.h> 55 56 /* 57 Text widget 58 59 Class: textWidgetClass 60 Class Name: Text 61 Superclass: Simple 62 63 Resources added by the Text widget: 64 65 Name Class RepType Default Value 66 ---- ----- ------- ------------- 67 autoFill AutoFill Boolean False 68 bottomMargin Margin Position 2 69 displayPosition TextPosition XawTextPosition 0 70 insertPosition TextPosition XawTextPosition 0 71 leftMargin Margin Position 2 72 resize Resize XawTextResizeMode XawTextResizeNever 73 rightMargin Margin Position 4 74 scrollHorizontal Scroll XawTextScrollMode XawtextScrollNever 75 scrollVertical Scroll XawTextScrollMode XawtextScrollNever 76 selectTypes SelectTypes Pointer see documentation 77 textSink TextSink Widget NULL 78 textSource TextSource Widget NULL 79 topMargin Margin Position 2 80 unrealizeCallback Callback Callback NULL 81 wrap Wrap XawTextWrapMode XawTextWrapNever 82 83 */ 84 85 typedef long XawTextPosition; 86 87 typedef enum { XawtextScrollNever, 88 XawtextScrollWhenNeeded, XawtextScrollAlways} XawTextScrollMode; 89 90 typedef enum { XawtextWrapNever, 91 XawtextWrapLine, XawtextWrapWord} XawTextWrapMode; 92 93 typedef enum { XawtextResizeNever, XawtextResizeWidth, 94 XawtextResizeHeight, XawtextResizeBoth} XawTextResizeMode; 95 96 typedef enum {XawsdLeft, XawsdRight} XawTextScanDirection; 97 typedef enum {XawtextRead, XawtextAppend, XawtextEdit} XawTextEditType; 98 typedef enum {XawselectNull, XawselectPosition, XawselectChar, XawselectWord, 99 XawselectLine, XawselectParagraph, XawselectAll} XawTextSelectType; 100 101 typedef struct { 102 int firstPos; 103 int length; 104 char *ptr; 105 unsigned long format; 106 } XawTextBlock, *XawTextBlockPtr; 107 108 #include <X11/Xaw3d/TextSink.h> 109 #include <X11/Xaw3d/TextSrc.h> 110 111 #define XtEtextScrollNever "never" 112 #define XtEtextScrollWhenNeeded "whenneeded" 113 #define XtEtextScrollAlways "always" 114 115 #define XtEtextWrapNever "never" 116 #define XtEtextWrapLine "line" 117 #define XtEtextWrapWord "word" 118 119 #define XtEtextResizeNever "never" 120 #define XtEtextResizeWidth "width" 121 #define XtEtextResizeHeight "height" 122 #define XtEtextResizeBoth "both" 123 124 #define XtNautoFill "autoFill" 125 #define XtNbottomMargin "bottomMargin" 126 #define XtNdialogHOffset "dialogHOffset" 127 #define XtNdialogVOffset "dialogVOffset" 128 #define XtNdisplayCaret "displayCaret" 129 #define XtNdisplayPosition "displayPosition" 130 #define XtNleftMargin "leftMargin" 131 #define XtNrightMargin "rightMargin" 132 #define XtNscrollVertical "scrollVertical" 133 #define XtNscrollHorizontal "scrollHorizontal" 134 #define XtNselectTypes "selectTypes" 135 #define XtNtopMargin "topMargin" 136 #define XtNwrap "wrap" 137 138 #define XtCAutoFill "AutoFill" 139 #define XtCScroll "Scroll" 140 #define XtCSelectTypes "SelectTypes" 141 #define XtCWrap "Wrap" 142 143 #ifndef _XtStringDefs_h_ 144 #define XtNinsertPosition "insertPosition" 145 #define XtNresize "resize" 146 #define XtNselection "selection" 147 #define XtCResize "Resize" 148 #endif 149 150 /* Return Error code for XawTextSearch */ 151 152 #define XawTextSearchError (-12345L) 153 154 /* Return codes from XawTextReplace */ 155 156 #define XawReplaceError -1 157 #define XawEditDone 0 158 #define XawEditError 1 159 #define XawPositionError 2 160 161 extern unsigned long FMT8BIT; 162 extern unsigned long XawFmt8Bit; 163 extern unsigned long XawFmtWide; 164 165 /* Class record constants */ 166 167 extern WidgetClass textWidgetClass; 168 169 typedef struct _TextClassRec *TextWidgetClass; 170 typedef struct _TextRec *TextWidget; 171 172 _XFUNCPROTOBEGIN 173 174 extern XrmQuark _XawTextFormat( 175 #if NeedFunctionPrototypes 176 TextWidget /* tw */ 177 #endif 178 ); 179 180 extern void XawTextDisplay( 181 #if NeedFunctionPrototypes 182 Widget /* w */ 183 #endif 184 ); 185 186 extern void XawTextEnableRedisplay( 187 #if NeedFunctionPrototypes 188 Widget /* w */ 189 #endif 190 ); 191 192 extern void XawTextDisableRedisplay( 193 #if NeedFunctionPrototypes 194 Widget /* w */ 195 #endif 196 ); 197 198 extern void XawTextSetSelectionArray( 199 #if NeedFunctionPrototypes 200 Widget /* w */, 201 XawTextSelectType* /* sarray */ 202 #endif 203 ); 204 205 extern void XawTextGetSelectionPos( 206 #if NeedFunctionPrototypes 207 Widget /* w */, 208 XawTextPosition* /* begin_return */, 209 XawTextPosition* /* end_return */ 210 #endif 211 ); 212 213 extern void XawTextSetSource( 214 #if NeedFunctionPrototypes 215 Widget /* w */, 216 Widget /* source */, 217 XawTextPosition /* position */ 218 #endif 219 ); 220 221 extern int XawTextReplace( 222 #if NeedFunctionPrototypes 223 Widget /* w */, 224 XawTextPosition /* start */, 225 XawTextPosition /* end */, 226 XawTextBlock* /* text */ 227 #endif 228 ); 229 230 extern XawTextPosition XawTextTopPosition( 231 #if NeedFunctionPrototypes 232 Widget /* w */ 233 #endif 234 ); 235 236 extern void XawTextSetInsertionPoint( 237 #if NeedFunctionPrototypes 238 Widget /* w */, 239 XawTextPosition /* position */ 240 #endif 241 ); 242 243 extern XawTextPosition XawTextGetInsertionPoint( 244 #if NeedFunctionPrototypes 245 Widget /* w */ 246 #endif 247 ); 248 249 extern void XawTextUnsetSelection( 250 #if NeedFunctionPrototypes 251 Widget /* w */ 252 #endif 253 ); 254 255 extern void XawTextSetSelection( 256 #if NeedFunctionPrototypes 257 Widget /* w */, 258 XawTextPosition /* left */, 259 XawTextPosition /* right */ 260 #endif 261 ); 262 263 extern void XawTextInvalidate( 264 #if NeedFunctionPrototypes 265 Widget /* w */, 266 XawTextPosition /* from */, 267 XawTextPosition /* to */ 268 #endif 269 ); 270 271 extern Widget XawTextGetSource( 272 #if NeedFunctionPrototypes 273 Widget /* w */ 274 #endif 275 ); 276 277 extern XawTextPosition XawTextSearch( 278 #if NeedFunctionPrototypes 279 Widget /* w */, 280 #if NeedWidePrototypes 281 /* XawTextScanDirection */ int /* dir */, 282 #else 283 XawTextScanDirection /* dir */, 284 #endif 285 XawTextBlock* /* text */ 286 #endif 287 ); 288 289 extern void XawTextDisplayCaret( 290 #if NeedFunctionPrototypes 291 Widget /* w */, 292 #if NeedWidePrototypes 293 /* Boolean */ int /* visible */ 294 #else 295 Boolean /* visible */ 296 #endif 297 #endif 298 ); 299 300 _XFUNCPROTOEND 301 302 /* 303 * For R3 compatability only. 304 */ 305 306 #include <X11/Xaw3d/AsciiSrc.h> 307 #include <X11/Xaw3d/AsciiSink.h> 308 309 #endif /* _XawText_h */ 310 /* DON'T ADD STUFF AFTER THIS #endif */ 311