TextSrcP.h revision 7a84e134
1/* 2* $Xorg: TextSrcP.h,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $ 3*/ 4 5 6/*********************************************************** 7 8Copyright 1987, 1988, 1994, 1998 The Open Group 9 10Permission to use, copy, modify, distribute, and sell this software and its 11documentation for any purpose is hereby granted without fee, provided that 12the above copyright notice appear in all copies and that both that 13copyright notice and this permission notice appear in supporting 14documentation. 15 16The above copyright notice and this permission notice shall be included in 17all copies or substantial portions of the Software. 18 19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 23AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 24CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 26Except as contained in this notice, the name of The Open Group shall not be 27used in advertising or otherwise to promote the sale, use or other dealings 28in this Software without prior written authorization from The Open Group. 29 30 31Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. 32 33 All Rights Reserved 34 35Permission to use, copy, modify, and distribute this software and its 36documentation for any purpose and without fee is hereby granted, 37provided that the above copyright notice appear in all copies and that 38both that copyright notice and this permission notice appear in 39supporting documentation, and that the name of Digital not be 40used in advertising or publicity pertaining to distribution of the 41software without specific, written prior permission. 42 43DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 44ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 45DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 46ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 47WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 48ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 49SOFTWARE. 50 51******************************************************************/ 52/* $XFree86: xc/lib/Xaw/TextSrcP.h,v 1.14 2001/12/14 19:54:45 dawes Exp $ */ 53 54#ifndef _XawTextSrcP_h 55#define _XawTextSrcP_h 56 57/* 58 * TextSrc Object Private Data 59 */ 60#include <X11/Xfuncproto.h> 61 62#include <X11/Xaw/TextSrc.h> 63#include <X11/Xaw/TextP.h> /* This source works with the Text widget */ 64 65_XFUNCPROTOBEGIN 66 67#ifndef OLDXAW 68struct _XawTextAnchor { 69 XawTextPosition position; 70 XawTextEntity *entities, *cache; 71}; 72 73#define XAW_TENTF_HIDE 0x0001 74#define XAW_TENTF_READ 0x0002 75#define XAW_TENTF_REPLACE 0x0004 76struct _XawTextEntity { 77 short type; 78 short flags; 79 XawTextEntity *next; 80 XtPointer data; 81 XawTextPosition offset; /* from the anchor */ 82 Cardinal length; 83 XrmQuark property; 84}; 85#endif 86 87#if 0 /* no longer used */ 88/* New fields for the TextSrc object class */ 89typedef struct { 90 XtPointer next_extension; 91 XrmQuark record_type; 92 long version; 93 Cardinal record_size; 94 int (*Input)(); 95} TextSrcExtRec, *TextSrcExt; 96#endif 97 98typedef XawTextPosition (*_XawSrcReadProc) 99 (Widget, XawTextPosition, XawTextBlock*, int); 100 101typedef int (*_XawSrcReplaceProc) 102 (Widget, XawTextPosition, XawTextPosition, XawTextBlock*); 103 104typedef XawTextPosition (*_XawSrcScanProc) 105 (Widget, XawTextPosition, XawTextScanType, XawTextScanDirection, 106 int, Bool); 107 108typedef XawTextPosition (*_XawSrcSearchProc) 109 (Widget, XawTextPosition, XawTextScanDirection, XawTextBlock*); 110 111typedef void (*_XawSrcSetSelectionProc) 112 (Widget, XawTextPosition, XawTextPosition, Atom); 113 114typedef Boolean (*_XawSrcConvertSelectionProc) 115 (Widget, Atom*, Atom*, Atom*, XtPointer*, unsigned long*, int*); 116 117typedef struct _TextSrcClassPart { 118 _XawSrcReadProc Read; 119 _XawSrcReplaceProc Replace; 120 _XawSrcScanProc Scan; 121 _XawSrcSearchProc Search; 122 _XawSrcSetSelectionProc SetSelection; 123 _XawSrcConvertSelectionProc ConvertSelection; 124#ifndef OLDXAW 125 XtPointer extension; 126#endif 127} TextSrcClassPart; 128 129/* Full class record */ 130typedef struct _TextSrcClassRec { 131 ObjectClassPart object_class; 132 TextSrcClassPart textSrc_class; 133} TextSrcClassRec; 134 135extern TextSrcClassRec textSrcClassRec; 136 137#ifndef OLDXAW 138typedef struct _XawTextUndo XawTextUndo; 139#endif 140 141/* New fields for the TextSrc object */ 142typedef struct { 143 /* resources */ 144 XawTextEditType edit_mode; 145 XrmQuark text_format; /* 2 formats: FMT8BIT for Ascii 146 FMTWIDE for ISO 10646 */ 147#ifndef OLDXAW 148 XtCallbackList callback; /* A callback list to call when the 149 source is changed */ 150 Boolean changed; 151 Boolean enable_undo; 152 153 /* private state */ 154 Boolean undo_state; /* to protect undo manipulation */ 155 XawTextUndo *undo; 156 WidgetList text; /* TextWidget's using this source */ 157 Cardinal num_text; 158 XtCallbackList property_callback; 159 XawTextAnchor **anchors; 160 int num_anchors; 161 XtPointer pad[1]; /* for future use and keep binary compatability */ 162#endif 163} TextSrcPart; 164 165/* Full instance record */ 166typedef struct _TextSrcRec { 167 ObjectPart object; 168 TextSrcPart textSrc; 169} TextSrcRec; 170 171/* 172 * Semiprivate declarations of functions used in other modules 173 */ 174char* _XawTextWCToMB 175( 176 Display *display, 177 wchar_t *wstr, 178 int *len_in_out 179 ); 180 181wchar_t* _XawTextMBToWC 182( 183 Display *display, 184 char *str, 185 int *len_in_out 186 ); 187 188#ifndef OLDXAW 189XawTextAnchor *XawTextSourceAddAnchor 190( 191 Widget source, 192 XawTextPosition position 193 ); 194 195XawTextAnchor *XawTextSourceFindAnchor 196( 197 Widget source, 198 XawTextPosition position 199 ); 200 201XawTextAnchor *XawTextSourceNextAnchor 202( 203 Widget source, 204 XawTextAnchor *anchor 205 ); 206 207XawTextAnchor *XawTextSourcePrevAnchor 208( 209 Widget source, 210 XawTextAnchor *anchor 211 ); 212 213XawTextAnchor *XawTextSourceRemoveAnchor 214( 215 Widget source, 216 XawTextAnchor *anchor 217 ); 218 219Bool XawTextSourceAnchorAndEntity 220( 221 Widget w, 222 XawTextPosition position, 223 XawTextAnchor **anchor_return, 224 XawTextEntity **entity_return 225 ); 226 227XawTextEntity *XawTextSourceAddEntity 228( 229 Widget source, 230 int type, 231 int flags, 232 XtPointer data, 233 XawTextPosition position, 234 Cardinal length, 235 XrmQuark property 236 ); 237 238void XawTextSourceClearEntities 239( 240 Widget w, 241 XawTextPosition left, 242 XawTextPosition right 243 ); 244#endif 245 246#if 0 /* no longer used */ 247typedef XawTextPosition (*_XawTextPositionFunc)(); 248#endif 249 250#define XtInheritInput ((_XawTextPositionFunc)_XtInherit) 251#define XtInheritRead ((_XawSrcReadProc)_XtInherit) 252#define XtInheritReplace ((_XawSrcReplaceProc)_XtInherit) 253#define XtInheritScan ((_XawSrcScanProc)_XtInherit) 254#define XtInheritSearch ((_XawSrcSearchProc)_XtInherit) 255#define XtInheritSetSelection ((_XawSrcSetSelectionProc)_XtInherit) 256#define XtInheritConvertSelection ((_XawSrcConvertSelectionProc)_XtInherit) 257#if 0 258#define XtTextSrcExtVersion 1 259#define XtTextSrcExtTypeString "XT_TEXTSRC_EXT" 260#endif 261 262_XFUNCPROTOEND 263 264#endif /* _XawTextSrcP_h */ 265