TextSinkP.h revision 7a84e134
1/* 2* $Xorg: TextSinkP.h,v 1.4 2001/02/09 02:03:46 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/TextSinkP.h,v 1.11 2001/01/17 19:42:35 dawes Exp $ */ 53 54#ifndef _XawTextSinkP_h 55#define _XawTextSinkP_h 56 57/* 58 * TextSink Object Private Data 59 */ 60#include <X11/Xaw/TextSink.h> 61#include <X11/Xaw/TextP.h> /* This sink works with the Text widget */ 62#include <X11/Xaw/TextSrcP.h> /* This sink works with the Text Source */ 63#include <X11/Xmu/Xmu.h> 64 65#ifndef OLDXAW 66/* font/fontset defined? */ 67#define XAW_TPROP_FONT (1<<0) 68#define XAW_TPROP_FONTSET (1<<1) 69 70/* extra attributes */ 71#define XAW_TPROP_FOREGROUND (1<<2) 72#define XAW_TPROP_BACKGROUND (1<<3) 73#define XAW_TPROP_FPIXMAP (1<<4) 74#define XAW_TPROP_BPIXMAP (1<<5) 75#define XAW_TPROP_UNDERLINE (1<<6) 76#define XAW_TPROP_OVERSTRIKE (1<<7) 77#define XAW_TPROP_SUBSCRIPT (1<<8) 78#define XAW_TPROP_SUPERSCRIPT (1<<9) 79 80/* xlfd attributes */ 81#define XAW_TPROP_FOUNDRY (1<<0) 82#define XAW_TPROP_FAMILY (1<<1) 83#define XAW_TPROP_WEIGHT (1<<2) 84#define XAW_TPROP_SLANT (1<<3) 85#define XAW_TPROP_SETWIDTH (1<<4) 86#define XAW_TPROP_ADDSTYLE (1<<5) 87#define XAW_TPROP_PIXELSIZE (1<<6) 88#define XAW_TPROP_POINTSIZE (1<<7) 89#define XAW_TPROP_RESX (1<<8) 90#define XAW_TPROP_RESY (1<<9) 91#define XAW_TPROP_SPACING (1<<10) 92#define XAW_TPROP_AVGWIDTH (1<<11) 93#define XAW_TPROP_REGISTRY (1<<12) 94#define XAW_TPROP_ENCODING (1<<13) 95struct _XawTextProperty { /* to be extended/modified */ 96 XrmQuark identifier, code; 97 unsigned long mask; 98 XFontStruct *font; 99 XFontSet fontset; 100 Pixel foreground, background; 101 Pixmap foreground_pixmap, background_pixmap; 102 XrmQuark xlfd; 103 104 unsigned long xlfd_mask; 105 XrmQuark foundry, family, weight, slant, setwidth, addstyle, pixel_size, 106 point_size, res_x, res_y, spacing, avgwidth, registry, encoding; 107 108 short underline_position, underline_thickness; 109}; 110 111struct _XawTextPropertyList { 112 XrmQuark identifier; 113 Screen *screen; 114 Colormap colormap; 115 int depth; 116 XawTextProperty **properties; 117 Cardinal num_properties; 118 XawTextPropertyList *next; 119}; 120 121typedef struct _XawTextPaintStruct XawTextPaintStruct; 122struct _XawTextPaintStruct { 123 XawTextPaintStruct *next; 124 int x, y, width; 125 char *text; /* formatted text */ 126 Cardinal length; /* length of text */ 127 XawTextProperty *property; 128 int max_ascent, max_descent; 129 XmuArea *backtabs; 130 Boolean highlight; 131}; 132 133typedef struct { 134 XmuArea *clip, *hightabs; /* clip list */ 135 XawTextPaintStruct *paint, *bearings; /* drawing information */ 136} XawTextPaintList; 137 138typedef struct { 139 XtPointer next_extension; 140 XrmQuark record_type; 141 long version; 142 Cardinal record_size; 143 Bool (*BeginPaint)(Widget); 144 void (*PreparePaint)(Widget, int, int, 145 XawTextPosition, XawTextPosition, Bool); 146 void (*DoPaint)(Widget); 147 Bool (*EndPaint)(Widget); 148} TextSinkExtRec, *TextSinkExt; 149#endif 150 151typedef void (*_XawSinkDisplayTextProc) 152 (Widget, int, int, XawTextPosition, XawTextPosition, Bool); 153 154typedef void (*_XawSinkInsertCursorProc) 155 (Widget, int, int, XawTextInsertState); 156 157typedef void (*_XawSinkClearToBackgroundProc) 158 (Widget, int, int, unsigned int, unsigned int); 159 160typedef void (*_XawSinkFindPositionProc) 161 (Widget, XawTextPosition, int, int, Bool, XawTextPosition*, int*, int*); 162 163typedef void (*_XawSinkFindDistanceProc) 164 (Widget, XawTextPosition, int, XawTextPosition, int*, 165 XawTextPosition*, int*); 166 167typedef void (*_XawSinkResolveProc) 168 (Widget, XawTextPosition, int, int, XawTextPosition*); 169 170typedef int (*_XawSinkMaxLinesProc) 171 (Widget, unsigned int); 172 173typedef int (*_XawSinkMaxHeightProc) 174 (Widget, int); 175 176typedef void (*_XawSinkSetTabsProc) 177 (Widget, int, short*); 178 179typedef void (*_XawSinkGetCursorBoundsProc) 180 (Widget, XRectangle*); 181 182typedef struct _TextSinkClassPart { 183 _XawSinkDisplayTextProc DisplayText; 184 _XawSinkInsertCursorProc InsertCursor; 185 _XawSinkClearToBackgroundProc ClearToBackground; 186 _XawSinkFindPositionProc FindPosition; 187 _XawSinkFindDistanceProc FindDistance; 188 _XawSinkResolveProc Resolve; 189 _XawSinkMaxLinesProc MaxLines; 190 _XawSinkMaxHeightProc MaxHeight; 191 _XawSinkSetTabsProc SetTabs; 192 _XawSinkGetCursorBoundsProc GetCursorBounds; 193#ifndef OLDXAW 194 TextSinkExt extension; 195#endif 196} TextSinkClassPart; 197 198/* Full class record */ 199typedef struct _TextSinkClassRec { 200 ObjectClassPart object_class; 201 TextSinkClassPart text_sink_class; 202} TextSinkClassRec; 203 204extern TextSinkClassRec textSinkClassRec; 205 206/* New fields for the TextSink object */ 207typedef struct { 208 /* resources */ 209 Pixel foreground; /* Foreground color */ 210 Pixel background; /* Background color */ 211 212 /* private */ 213 Position *tabs; /* The tab stops as pixel values */ 214 short *char_tabs; /* The tabs stops as character values */ 215 int tab_count; /* number of items in tabs */ 216 217#ifndef OLDXAW 218 /* more resources */ 219 Pixel cursor_color; 220 XawTextPropertyList *properties; 221 XawTextPaintList *paint; 222 XtPointer pad[2]; /* for future use and keep binary compatability */ 223#endif 224} TextSinkPart; 225 226/* Full instance record */ 227typedef struct _TextSinkRec { 228 ObjectPart object; 229 TextSinkPart text_sink; 230} TextSinkRec; 231 232/* Semi private routines */ 233#ifndef OLDXAW 234XawTextPropertyList *XawTextSinkConvertPropertyList 235( 236 String name, 237 String spec, 238 Screen *screen, 239 Colormap Colormap, 240 int depth 241 ); 242 243XawTextProperty *XawTextSinkGetProperty 244( 245 Widget w, 246 XrmQuark property 247 ); 248 249XawTextProperty *XawTextSinkCopyProperty 250( 251 Widget w, 252 XrmQuark property 253 ); 254 255XawTextProperty *XawTextSinkAddProperty 256( 257 Widget w, 258 XawTextProperty *property 259 ); 260 261XawTextProperty *XawTextSinkCombineProperty 262( 263 Widget w, 264 XawTextProperty *result_in_out, 265 XawTextProperty *property, 266 Bool override 267 ); 268 269Bool XawTextSinkBeginPaint 270( 271 Widget w 272 ); 273 274void XawTextSinkPreparePaint 275( 276 Widget w, 277 int y, 278 int line, 279 XawTextPosition from, 280 XawTextPosition to, 281 Bool highlight 282); 283 284void XawTextSinkDoPaint 285( 286 Widget w 287 ); 288 289Bool XawTextSinkEndPaint 290( 291 Widget w 292 ); 293#endif 294 295#define XtInheritDisplayText ((_XawSinkDisplayTextProc)_XtInherit) 296#define XtInheritInsertCursor ((_XawSinkInsertCursorProc)_XtInherit) 297#define XtInheritClearToBackground ((_XawSinkClearToBackgroundProc)_XtInherit) 298#define XtInheritFindPosition ((_XawSinkFindPositionProc)_XtInherit) 299#define XtInheritFindDistance ((_XawSinkFindDistanceProc)_XtInherit) 300#define XtInheritResolve ((_XawSinkResolveProc)_XtInherit) 301#define XtInheritMaxLines ((_XawSinkMaxLinesProc)_XtInherit) 302#define XtInheritMaxHeight ((_XawSinkMaxHeightProc)_XtInherit) 303#define XtInheritSetTabs ((_XawSinkSetTabsProc)_XtInherit) 304#define XtInheritGetCursorBounds ((_XawSinkGetCursorBoundsProc)_XtInherit) 305 306#endif /* _XawTextSinkP_h */ 307