Text.h revision 5b16253f
1/*********************************************************** 2 3Copyright 1987, 1988, 1994, 1998 The Open Group 4 5Permission to use, copy, modify, distribute, and sell this software and its 6documentation for any purpose is hereby granted without fee, provided that 7the above copyright notice appear in all copies and that both that 8copyright notice and this permission notice appear in supporting 9documentation. 10 11The above copyright notice and this permission notice shall be included in 12all copies or substantial portions of the Software. 13 14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 21Except as contained in this notice, the name of The Open Group shall not be 22used in advertising or otherwise to promote the sale, use or other dealings 23in this Software without prior written authorization from The Open Group. 24 25 26Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. 27 28 All Rights Reserved 29 30Permission to use, copy, modify, and distribute this software and its 31documentation for any purpose and without fee is hereby granted, 32provided that the above copyright notice appear in all copies and that 33both that copyright notice and this permission notice appear in 34supporting documentation, and that the name of Digital not be 35used in advertising or publicity pertaining to distribution of the 36software without specific, written prior permission. 37 38DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 39ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 40DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 41ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 42WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 43ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 44SOFTWARE. 45 46******************************************************************/ 47 48#ifndef _XawText_h 49#define _XawText_h 50 51#include <X11/Xaw/Simple.h> 52 53/* 54 55 Class: textWidgetClass 56 Class Name: Text 57 Superclass: Simple 58 59 Resources added by the Text widget: 60 61 Name Class RepType Default Value 62 ---- ----- ------- ------------- 63 autoFill AutoFill Boolean False 64 bottomMargin Margin Position 2 65 displayPosition TextPosition XawTextPosition 0 66 insertPosition TextPosition XawTextPosition 0 67 justify JustifyMode JustifyMode left 68 leftColumn Column Column 0 69 rightColumn Column Column 0 70 leftMargin Margin Position 2 71 rightMargin Margin Position 4 72 positionCallback Callback Callback NULL 73 scrollHorizontal Scroll Boolean False 74 scrollVertical Scroll Boolean False 75 selectTypes SelectTypes Pointer see documentation 76 textSink TextSink Widget NULL 77 textSource TextSource Widget NULL 78 topMargin Margin Position 2 79 unrealizeCallback Callback Callback NULL 80 wrap Wrap XawTextWrapMode XawTextWrapNever 81 82*/ 83 84typedef long XawTextPosition; 85 86#ifndef notdef 87typedef enum { 88 XawtextScrollNever, 89 XawtextScrollWhenNeeded, 90 XawtextScrollAlways 91} XawTextScrollMode; 92 93typedef enum { 94 XawtextResizeNever, 95 XawtextResizeWidth, 96 XawtextResizeHeight, 97 XawtextResizeBoth 98} XawTextResizeMode; 99#endif 100 101typedef enum { 102 XawtextWrapNever, 103 XawtextWrapLine, 104 XawtextWrapWord 105} XawTextWrapMode; 106 107typedef enum { 108 XawsdLeft, 109 XawsdRight 110} XawTextScanDirection; 111 112typedef enum { 113 XawtextRead, 114 XawtextAppend, 115 XawtextEdit 116} XawTextEditType; 117 118typedef enum { 119 XawselectNull, 120 XawselectPosition, 121 XawselectChar, 122 XawselectWord, 123 XawselectLine, 124 XawselectParagraph, 125 XawselectAll, 126 XawselectAlphaNumeric 127} XawTextSelectType; 128 129typedef enum { 130 XawjustifyLeft, 131 XawjustifyRight, 132 XawjustifyCenter, 133 XawjustifyFull 134} XawTextJustifyMode; 135 136typedef struct { 137 int firstPos; 138 int length; 139 char *ptr; 140 unsigned long format; 141} XawTextBlock, *XawTextBlockPtr; 142 143#ifndef OLDXAW 144typedef struct { 145 int line_number; 146 int column_number; 147 XawTextPosition insert_position; 148 XawTextPosition last_position; 149 Boolean overwrite_mode; 150} XawTextPositionInfo; 151 152typedef struct { 153 XawTextPosition left, right; 154 XawTextBlock *block; 155} XawTextPropertyInfo; 156 157typedef struct _XawTextAnchor XawTextAnchor; 158typedef struct _XawTextEntity XawTextEntity; 159typedef struct _XawTextProperty XawTextProperty; 160typedef struct _XawTextPropertyList XawTextPropertyList; 161#endif 162 163#include <X11/Xaw/TextSink.h> 164#include <X11/Xaw/TextSrc.h> 165 166#define XtEtextScrollNever "never" 167#define XtEtextScrollWhenNeeded "whenneeded" 168#define XtEtextScrollAlways "always" 169#define XtEtextResizeNever "never" 170#define XtEtextResizeWidth "width" 171#define XtEtextResizeHeight "height" 172#define XtEtextResizeBoth "both" 173 174#define XtEtextWrapNever "never" 175#define XtEtextWrapLine "line" 176#define XtEtextWrapWord "word" 177 178#define XtNautoFill "autoFill" 179#define XtNbottomMargin "bottomMargin" 180#define XtNdialogHOffset "dialogHOffset" 181#define XtNdialogVOffset "dialogVOffset" 182#define XtNdisplayCaret "displayCaret" 183#define XtNdisplayPosition "displayPosition" 184#define XtNleftMargin "leftMargin" 185#define XtNrightMargin "rightMargin" 186#define XtNpositionCallback "positionCallback" 187#define XtNscrollVertical "scrollVertical" 188#define XtNscrollHorizontal "scrollHorizontal" 189#define XtNselectTypes "selectTypes" 190#define XtNtopMargin "topMargin" 191#define XtNwrap "wrap" 192 193#define XtCColumn "Column" 194#define XtNleftColumn "leftColumn" 195#define XtNrightColumn "rightColumn" 196 197#define XtCJustifyMode XtCJustify 198#define XtNjustifyMode XtNjustify 199#define XtEtextJustifyLeft "left" 200#define XtEtextJustifyRight "right" 201#define XtEtextJustifyCenter "center" 202#define XtEtextJustifyFull "full" 203 204#define XtCAutoFill "AutoFill" 205#define XtCSelectTypes "SelectTypes" 206#define XtCWrap "Wrap" 207#ifndef notdef 208#define XtCScroll "Scroll" 209#endif 210 211#ifndef _XtStringDefs_h_ 212#define XtNinsertPosition "insertPosition" 213#ifndef notdef 214#define XtNresize "resize" 215#define XtCResize "Resize" 216#endif 217#define XtNselection "selection" 218#endif 219 220/* return Error code for XawTextSearch */ 221#define XawTextSearchError (-12345L) 222 223/* return codes from XawTextReplace */ 224#define XawReplaceError -1 225#define XawEditDone 0 226#define XawEditError 1 227#define XawPositionError 2 228 229/* XrmQuark is not unsigned long */ 230#define XawTextFormat(tw,fmt) ((unsigned long)_XawTextFormat(tw) == (fmt)) 231 232extern unsigned long FMT8BIT; 233extern unsigned long XawFmt8Bit; 234extern unsigned long XawFmtWide; 235 236extern WidgetClass textWidgetClass; 237 238typedef struct _TextClassRec *TextWidgetClass; 239typedef struct _TextRec *TextWidget; 240 241_XFUNCPROTOBEGIN 242 243XrmQuark _XawTextFormat 244( 245 TextWidget tw 246 ); 247 248void XawTextDisplay 249( 250 Widget w 251 ); 252 253void XawTextEnableRedisplay 254( 255 Widget w 256 ); 257 258void XawTextDisableRedisplay 259( 260 Widget w 261 ); 262 263void XawTextSetSelectionArray 264( 265 Widget w, 266 XawTextSelectType *sarray 267 ); 268 269void XawTextGetSelectionPos 270( 271 Widget w, 272 XawTextPosition *begin_return, 273 XawTextPosition *end_return 274 ); 275 276void XawTextSetSource 277( 278 Widget w, 279 Widget source, 280 XawTextPosition top 281 ); 282 283int XawTextReplace 284( 285 Widget w, 286 XawTextPosition start, 287 XawTextPosition end, 288 XawTextBlock *text 289 ); 290 291XawTextPosition XawTextTopPosition 292( 293 Widget w 294 ); 295 296XawTextPosition XawTextLastPosition 297( 298 Widget w 299 ); 300 301void XawTextSetInsertionPoint 302( 303 Widget w, 304 XawTextPosition position 305 ); 306 307XawTextPosition XawTextGetInsertionPoint 308( 309 Widget w 310 ); 311 312void XawTextUnsetSelection 313( 314 Widget w 315 ); 316 317void XawTextSetSelection 318( 319 Widget w, 320 XawTextPosition left, 321 XawTextPosition right 322 ); 323 324void XawTextInvalidate 325( 326 Widget w, 327 XawTextPosition from, 328 XawTextPosition to 329); 330 331Widget XawTextGetSource 332( 333 Widget w 334 ); 335 336Widget XawTextGetSink 337( 338 Widget w 339 ); 340 341XawTextPosition XawTextSearch 342( 343 Widget w, 344#if NeedWidePrototypes 345 int dir, 346#else 347 XawTextScanDirection dir, 348#endif 349 XawTextBlock *text 350 ); 351 352void XawTextDisplayCaret 353( 354 Widget w, 355#if NeedWidePrototypes 356 int visible 357#else 358 Boolean visible 359#endif 360 ); 361 362_XFUNCPROTOEND 363 364/* 365 * For R3 compatibility only 366 */ 367#include <X11/Xaw/AsciiSrc.h> 368#include <X11/Xaw/AsciiSink.h> 369 370#endif /* _XawText_h */ 371