1 /***********************************************************
3 Copyright 1987, 1988, 1994, 1998 The Open Group
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in this Software without prior written authorization from The Open Group.
26 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
30 Permission to use, copy, modify, and distribute this software and its
31 documentation for any purpose and without fee is hereby granted,
32 provided that the above copyright notice appear in all copies and that
33 both that copyright notice and this permission notice appear in
34 supporting documentation, and that the name of Digital not be
35 used in advertising or publicity pertaining to distribution of the
36 software without specific, written prior permission.
38 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
46 ******************************************************************/
48 #ifndef _XawTextSinkP_h
49 #define _XawTextSinkP_h
52 * TextSink Object Private Data
54 #include <X11/Xaw/TextSink.h>
55 #include <X11/Xaw/TextP.h> /* This sink works with the Text widget */
56 #include <X11/Xaw/TextSrcP.h> /* This sink works with the Text Source */
57 #include <X11/Xmu/Xmu.h>
60 /* font/fontset defined? */
61 #define XAW_TPROP_FONT (1<<0)
62 #define XAW_TPROP_FONTSET (1<<1)
64 /* extra attributes */
65 #define XAW_TPROP_FOREGROUND (1<<2)
66 #define XAW_TPROP_BACKGROUND (1<<3)
67 #define XAW_TPROP_FPIXMAP (1<<4)
68 #define XAW_TPROP_BPIXMAP (1<<5)
69 #define XAW_TPROP_UNDERLINE (1<<6)
70 #define XAW_TPROP_OVERSTRIKE (1<<7)
71 #define XAW_TPROP_SUBSCRIPT (1<<8)
72 #define XAW_TPROP_SUPERSCRIPT (1<<9)
75 #define XAW_TPROP_FOUNDRY (1<<0)
76 #define XAW_TPROP_FAMILY (1<<1)
77 #define XAW_TPROP_WEIGHT (1<<2)
78 #define XAW_TPROP_SLANT (1<<3)
79 #define XAW_TPROP_SETWIDTH (1<<4)
80 #define XAW_TPROP_ADDSTYLE (1<<5)
81 #define XAW_TPROP_PIXELSIZE (1<<6)
82 #define XAW_TPROP_POINTSIZE (1<<7)
83 #define XAW_TPROP_RESX (1<<8)
84 #define XAW_TPROP_RESY (1<<9)
85 #define XAW_TPROP_SPACING (1<<10)
86 #define XAW_TPROP_AVGWIDTH (1<<11)
87 #define XAW_TPROP_REGISTRY (1<<12)
88 #define XAW_TPROP_ENCODING (1<<13)
89 struct _XawTextProperty { /* to be extended/modified */
90 XrmQuark identifier, code;
94 Pixel foreground, background;
95 Pixmap foreground_pixmap, background_pixmap;
98 unsigned long xlfd_mask;
99 XrmQuark foundry, family, weight, slant, setwidth, addstyle, pixel_size,
100 point_size, res_x, res_y, spacing, avgwidth, registry, encoding;
102 short underline_position, underline_thickness;
105 struct _XawTextPropertyList {
110 XawTextProperty **properties;
111 Cardinal num_properties;
112 XawTextPropertyList *next;
115 typedef struct _XawTextPaintStruct XawTextPaintStruct;
116 struct _XawTextPaintStruct {
117 XawTextPaintStruct *next;
119 char *text; /* formatted text */
120 Cardinal length; /* length of text */
121 XawTextProperty *property;
122 int max_ascent, max_descent;
128 XmuArea *clip, *hightabs; /* clip list */
129 XawTextPaintStruct *paint, *bearings; /* drawing information */
133 XtPointer next_extension;
134 XrmQuark record_type;
136 Cardinal record_size;
137 Bool (*BeginPaint)(Widget);
138 void (*PreparePaint)(Widget, int, int,
139 XawTextPosition, XawTextPosition, Bool);
140 void (*DoPaint)(Widget);
141 Bool (*EndPaint)(Widget);
142 } TextSinkExtRec, *TextSinkExt;
145 typedef void (*_XawSinkDisplayTextProc)
146 (Widget, int, int, XawTextPosition, XawTextPosition, Bool);
148 typedef void (*_XawSinkInsertCursorProc)
149 (Widget, int, int, XawTextInsertState);
151 typedef void (*_XawSinkClearToBackgroundProc)
152 (Widget, int, int, unsigned int, unsigned int);
154 typedef void (*_XawSinkFindPositionProc)
155 (Widget, XawTextPosition, int, int, Bool, XawTextPosition*, int*, int*);
157 typedef void (*_XawSinkFindDistanceProc)
158 (Widget, XawTextPosition, int, XawTextPosition, int*,
159 XawTextPosition*, int*);
161 typedef void (*_XawSinkResolveProc)
162 (Widget, XawTextPosition, int, int, XawTextPosition*);
164 typedef int (*_XawSinkMaxLinesProc)
165 (Widget, unsigned int);
167 typedef int (*_XawSinkMaxHeightProc)
170 typedef void (*_XawSinkSetTabsProc)
171 (Widget, int, short*);
173 typedef void (*_XawSinkGetCursorBoundsProc)
174 (Widget, XRectangle*);
176 typedef struct _TextSinkClassPart {
177 _XawSinkDisplayTextProc DisplayText;
178 _XawSinkInsertCursorProc InsertCursor;
179 _XawSinkClearToBackgroundProc ClearToBackground;
180 _XawSinkFindPositionProc FindPosition;
181 _XawSinkFindDistanceProc FindDistance;
182 _XawSinkResolveProc Resolve;
183 _XawSinkMaxLinesProc MaxLines;
184 _XawSinkMaxHeightProc MaxHeight;
185 _XawSinkSetTabsProc SetTabs;
186 _XawSinkGetCursorBoundsProc GetCursorBounds;
188 TextSinkExt extension;
192 /* Full class record */
193 typedef struct _TextSinkClassRec {
194 ObjectClassPart object_class;
195 TextSinkClassPart text_sink_class;
198 extern TextSinkClassRec textSinkClassRec;
200 /* New fields for the TextSink object */
203 Pixel foreground; /* Foreground color */
204 Pixel background; /* Background color */
207 Position *tabs; /* The tab stops as pixel values */
208 short *char_tabs; /* The tabs stops as character values */
209 int tab_count; /* number of items in tabs */
214 XawTextPropertyList *properties;
215 XawTextPaintList *paint;
216 XtPointer pad[2]; /* for future use and keep binary compatability */
220 /* Full instance record */
221 typedef struct _TextSinkRec {
223 TextSinkPart text_sink;
226 /* Semi private routines */
228 XawTextPropertyList *XawTextSinkConvertPropertyList
237 XawTextProperty *XawTextSinkGetProperty
243 XawTextProperty *XawTextSinkCopyProperty
249 XawTextProperty *XawTextSinkAddProperty
252 XawTextProperty *property
255 XawTextProperty *XawTextSinkCombineProperty
258 XawTextProperty *result_in_out,
259 XawTextProperty *property,
263 Bool XawTextSinkBeginPaint
268 void XawTextSinkPreparePaint
273 XawTextPosition from,
278 void XawTextSinkDoPaint
283 Bool XawTextSinkEndPaint
289 #define XtInheritDisplayText ((_XawSinkDisplayTextProc)_XtInherit)
290 #define XtInheritInsertCursor ((_XawSinkInsertCursorProc)_XtInherit)
291 #define XtInheritClearToBackground ((_XawSinkClearToBackgroundProc)_XtInherit)
292 #define XtInheritFindPosition ((_XawSinkFindPositionProc)_XtInherit)
293 #define XtInheritFindDistance ((_XawSinkFindDistanceProc)_XtInherit)
294 #define XtInheritResolve ((_XawSinkResolveProc)_XtInherit)
295 #define XtInheritMaxLines ((_XawSinkMaxLinesProc)_XtInherit)
296 #define XtInheritMaxHeight ((_XawSinkMaxHeightProc)_XtInherit)
297 #define XtInheritSetTabs ((_XawSinkSetTabsProc)_XtInherit)
298 #define XtInheritGetCursorBounds ((_XawSinkGetCursorBoundsProc)_XtInherit)
300 #endif /* _XawTextSinkP_h */