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