Debian Codegraph @

include/X11/Xaw/TextSinkP.h

raw
1 /***********************************************************
2
3 Copyright 1987, 1988, 1994, 1998 The Open Group
4
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
9 documentation.
10
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13
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.
20
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.
24
25
26 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
27
28 All Rights Reserved
29
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.
37
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
44 SOFTWARE.
45
46 ******************************************************************/
47
48 #ifndef _XawTextSinkP_h
49 #define _XawTextSinkP_h
50
51 /*
52 * TextSink Object Private Data
53 */
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>
58
59 #ifndef OLDXAW
60 /* font/fontset defined? */
61 #define XAW_TPROP_FONT (1<<0)
62 #define XAW_TPROP_FONTSET (1<<1)
63
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)
73
74 /* xlfd attributes */
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;
91 unsigned long mask;
92 XFontStruct *font;
93 XFontSet fontset;
94 Pixel foreground, background;
95 Pixmap foreground_pixmap, background_pixmap;
96 XrmQuark xlfd;
97
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;
101
102 short underline_position, underline_thickness;
103 };
104
105 struct _XawTextPropertyList {
106 XrmQuark identifier;
107 Screen *screen;
108 Colormap colormap;
109 int depth;
110 XawTextProperty **properties;
111 Cardinal num_properties;
112 XawTextPropertyList *next;
113 };
114
115 typedef struct _XawTextPaintStruct XawTextPaintStruct;
116 struct _XawTextPaintStruct {
117 XawTextPaintStruct *next;
118 int x, y, width;
119 char *text; /* formatted text */
120 Cardinal length; /* length of text */
121 XawTextProperty *property;
122 int max_ascent, max_descent;
123 XmuArea *backtabs;
124 Boolean highlight;
125 };
126
127 typedef struct {
128 XmuArea *clip, *hightabs; /* clip list */
129 XawTextPaintStruct *paint, *bearings; /* drawing information */
130 } XawTextPaintList;
131
132 typedef struct {
133 XtPointer next_extension;
134 XrmQuark record_type;
135 long version;
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;
143 #endif
144
145 typedef void (*_XawSinkDisplayTextProc)
146 (Widget, int, int, XawTextPosition, XawTextPosition, Bool);
147
148 typedef void (*_XawSinkInsertCursorProc)
149 (Widget, int, int, XawTextInsertState);
150
151 typedef void (*_XawSinkClearToBackgroundProc)
152 (Widget, int, int, unsigned int, unsigned int);
153
154 typedef void (*_XawSinkFindPositionProc)
155 (Widget, XawTextPosition, int, int, Bool, XawTextPosition*, int*, int*);
156
157 typedef void (*_XawSinkFindDistanceProc)
158 (Widget, XawTextPosition, int, XawTextPosition, int*,
159 XawTextPosition*, int*);
160
161 typedef void (*_XawSinkResolveProc)
162 (Widget, XawTextPosition, int, int, XawTextPosition*);
163
164 typedef int (*_XawSinkMaxLinesProc)
165 (Widget, unsigned int);
166
167 typedef int (*_XawSinkMaxHeightProc)
168 (Widget, int);
169
170 typedef void (*_XawSinkSetTabsProc)
171 (Widget, int, short*);
172
173 typedef void (*_XawSinkGetCursorBoundsProc)
174 (Widget, XRectangle*);
175
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;
187 #ifndef OLDXAW
188 TextSinkExt extension;
189 #endif
190 } TextSinkClassPart;
191
192 /* Full class record */
193 typedef struct _TextSinkClassRec {
194 ObjectClassPart object_class;
195 TextSinkClassPart text_sink_class;
196 } TextSinkClassRec;
197
198 extern TextSinkClassRec textSinkClassRec;
199
200 /* New fields for the TextSink object */
201 typedef struct {
202 /* resources */
203 Pixel foreground; /* Foreground color */
204 Pixel background; /* Background color */
205
206 /* private */
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 */
210
211 #ifndef OLDXAW
212 /* more resources */
213 Pixel cursor_color;
214 XawTextPropertyList *properties;
215 XawTextPaintList *paint;
216 XtPointer pad[2]; /* for future use and keep binary compatibility */
217 #endif
218 } TextSinkPart;
219
220 /* Full instance record */
221 typedef struct _TextSinkRec {
222 ObjectPart object;
223 TextSinkPart text_sink;
224 } TextSinkRec;
225
226 /* Semi private routines */
227 #ifndef OLDXAW
228 XawTextPropertyList *XawTextSinkConvertPropertyList
229 (
230 String name,
231 String spec,
232 Screen *screen,
233 Colormap Colormap,
234 int depth
235 );
236
237 XawTextProperty *XawTextSinkGetProperty
238 (
239 Widget w,
240 XrmQuark property
241 );
242
243 XawTextProperty *XawTextSinkCopyProperty
244 (
245 Widget w,
246 XrmQuark property
247 );
248
249 XawTextProperty *XawTextSinkAddProperty
250 (
251 Widget w,
252 XawTextProperty *property
253 );
254
255 XawTextProperty *XawTextSinkCombineProperty
256 (
257 Widget w,
258 XawTextProperty *result_in_out,
259 XawTextProperty *property,
260 Bool override
261 );
262
263 Bool XawTextSinkBeginPaint
264 (
265 Widget w
266 );
267
268 void XawTextSinkPreparePaint
269 (
270 Widget w,
271 int y,
272 int line,
273 XawTextPosition from,
274 XawTextPosition to,
275 Bool highlight
276 );
277
278 void XawTextSinkDoPaint
279 (
280 Widget w
281 );
282
283 Bool XawTextSinkEndPaint
284 (
285 Widget w
286 );
287 #endif
288
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)
299
300 #endif /* _XawTextSinkP_h */