1 /*****
2 * XmHTMLP.h : XmHTML Widget private header file
3 *
4 * This file Version	$Revision$
5 *
6 * Creation date:		Tue Nov 19 23:18:41 GMT+0100 1996
7 * Last modification: 	$Date$
8 * By:					$Author$
9 * Current State:		$State$
10 *
11 * Author:				newt
12 * (C)Copyright 1995-1996 Ripley Software Development
13 * All Rights Reserved
14 *
15 * This file is part of the XmHTML Widget Library.
16 *
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Library General Public
19 * License as published by the Free Software Foundation; either
20 * version 2 of the License, or (at your option) any later version.
21 *
22 * This library is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25 * Library General Public License for more details.
26 *
27 * You should have received a copy of the GNU Library General Public
28 * License along with this library; if not, write to the Free
29 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 *
31 *****/
32 /*****
33 * $Source$
34 *****/
35 /*****
36 * ChangeLog
37 * $Log$
38 * Revision 1.1  2011/06/30 16:08:41  rwcox
39 * Cadd
40 *
41 * Revision 1.20  1998/04/27 06:57:28  newt
42 * Started initial work on a rewrite of the layout routines (XmHTMLSubDoc
43 * and XmHTMLLayer structures)
44 *
45 * Revision 1.19  1998/04/04 06:27:55  newt
46 * XmHTML Beta 1.1.3
47 *
48 * Revision 1.18  1997/10/26 23:50:04  newt
49 * Added internal symbol defines (_LIBRARY stuff)
50 *
51 * Revision 1.17  1997/10/23 00:24:47  newt
52 * XmHTML Beta 1.1.0 release
53 *
54 * Revision 1.16  1997/08/31 17:32:58  newt
55 * log edit
56 *
57 * Revision 1.15  1997/08/30 00:42:16  newt
58 * Reorganized a number of things and moved all private XmHTML functions to
59 * the XmHTMLI.h include file.
60 *
61 * Revision 1.14  1997/08/01 12:55:01  newt
62 * Progressive image loading changes.
63 *
64 * Revision 1.13  1997/05/28 01:43:05  newt
65 * Made all image options a long instead of a Byte. Additional protos for the
66 * XmNdecodeGIFProc resource.
67 *
68 * Revision 1.12  1997/04/29 14:23:03  newt
69 * Moved all XmHTML private functions in.
70 *
71 * Revision 1.11  1997/04/03 05:31:52  newt
72 * Added an additional base field to the XmHTMLWord structure.
73 *
74 * Revision 1.10  1997/03/28 07:06:26  newt
75 * Frame interface support.
76 *
77 * Revision 1.9  1997/03/20 08:06:11  newt
78 * XmNrepeatDelay, moved HTML enumeration table from XmHTML.h in here
79 *
80 * Revision 1.8  1997/03/11 19:50:50  newt
81 * Changes in XmHTMLImage, XmHTMLWord and XmHTMLObjectTable
82 *
83 * Revision 1.7  1997/03/04 18:46:42  newt
84 * XmHTMLImage changed for animation support; imagemap_fg and imagemap_draw added
85 *
86 * Revision 1.6  1997/03/04 00:56:58  newt
87 * Removed some obsolete fields
88 *
89 * Revision 1.5  1997/03/02 23:09:30  newt
90 * XmHTMLImage, XmHTMLImageMap, XmHTMLAnchor structs modified.
91 *
92 * Revision 1.4  1997/02/11 02:02:11  newt
93 * Removed obsolete fields from XmHTMLWord, XmHTMLObjectTable.
94 * Added stuff for new anchor treatment.
95 *
96 * Revision 1.3  1997/01/09 06:55:56  newt
97 * expanded copyright marker
98 *
99 * Revision 1.2  1997/01/09 06:48:29  newt
100 * changes in XmHTMLWord. Added all image structures and enums.
101 *
102 * Revision 1.1  1996/12/19 02:17:16  newt
103 * Initial Revision
104 *
105 *****/
106 
107 #ifndef _XmHTMLP_h_
108 #define _XmHTMLP_h_
109 
110 #include <X11/Xatom.h>		/* property defines */
111 #include <X11/IntrinsicP.h>	/* fast macros */
112 #include <X11/Xmu/Atoms.h>	/* must be below, it includes X11/Intrinsic.h */
113 
114 #include <Xm/XmP.h>		/* index defines & private motif functions */
115 #include <Xm/ManagerP.h>
116 
117 /* Required includes */
118 #include <XmHTML/XmHTML.h>
119 #if 0
120 #include <XmHTML/tka.h>
121 #endif
122 
123 /*****
124 * NEVER define VERSION *or* _LIBRARY yourself. These are defines required
125 * for compiling the library. When defined, they pull in a number of other
126 * header files which are normally *not* installed.
127 *****/
128 #ifdef VERSION
129 # ifndef _LIBRARY
130 #  define _LIBRARY
131 # endif
132 #endif/* VERSION */
133 
134 /*****
135 * prevent multiple decls when building the lib.
136 * zconf.h (which gets included by png.h) also typedefs Byte to unsigned char.
137 * The compiler warning is annoying, so just don't typedef it again.
138 * XCC is an opaque object defined in XCCP.h
139 *****/
140 #ifdef _LIBRARY
141 # include "XCC.h"		/* XColorContext definitions and protos */
142 # ifdef _ZCONF_H
143 #  ifndef BYTE_ALREADY_TYPEDEFED
144 #   define BYTE_ALREADY_TYPEDEFED
145 #  endif /* BYTE_ALREADY_TYPEDEFED */
146 # endif /* _ZCONF_H */
147 #else
148   typedef struct _XColorContext *XCC;
149 #endif /* _LIBRARY */
150 
151 #ifndef BYTE_ALREADY_TYPEDEFED
152 #define BYTE_ALREADY_TYPEDEFED
153 typedef unsigned char Byte;
154 #endif /* BYTE_ALREADY_TYPEDEFED */
155 
156 /*****
157 * Currently, the only supported method of form scrolling is by
158 * mapping/unmapping all form elements
159 *****/
160 #define UNMAP_FORMS	1
161 
162 _XFUNCPROTOBEGIN
163 
164 /*****
165 * Class pointer and extension record definition
166 *****/
167 typedef struct {
168   XtPointer		extension;	/* Pointer to extension record */
169 }XmHTMLClassPart;
170 
171 typedef struct _XmHTMLClassRec
172 {
173 	CoreClassPart		core_class;
174 	CompositeClassPart	composite_class;
175 	ConstraintClassPart	constraint_class;
176 	XmManagerClassPart	manager_class;
177 	XmHTMLClassPart		html_class;
178 }XmHTMLClassRec;
179 
180 /*****
181 * A whole slew of states for all kinds of internal objects.
182 *****/
183 
184 /*****
185 * Line styles
186 *****/
187 #define LINE_SOLID		(1<<1)	/* paint a solid line	*/
188 #define LINE_DASHED		(1<<2)	/* paint a dashed line	*/
189 #define LINE_SINGLE		(1<<3)	/* paint a single line	*/
190 #define LINE_DOUBLE		(1<<4)	/* paint a double line	*/
191 #define LINE_STRIKE		(1<<5)	/* render as strikeout	*/
192 #define LINE_UNDER		(1<<6)	/* render as underline	*/
193 #define NO_LINE			0		/* no lines at all		*/
194 
195 /*****
196 * Spacing and anchor text data bits
197 *****/
198 #define TEXT_SPACE_NONE			(1<<0)	/* no spacing at all			*/
199 #define TEXT_SPACE_LEAD			(1<<1)	/* add a leading space			*/
200 #define TEXT_SPACE_TRAIL 		(1<<2)	/* add a trailing space			*/
201 #define TEXT_ANCHOR				(1<<3)	/* a regular anchor				*/
202 #define TEXT_ANCHOR_INTERN		(1<<4)	/* internal anchor flag			*/
203 #define TEXT_IMAGE				(1<<5)	/* indicates an image member	*/
204 #define TEXT_FORM				(1<<6)	/* indicates a form member		*/
205 #define TEXT_BREAK				(1<<7)	/* indicates a linebreak		*/
206 
207 /*****
208 * HTML list marker enumeration type
209 *****/
210 typedef enum{
211 	XmMARKER_NONE = 0,
212 	XmMARKER_ARABIC = 10,
213 	XmMARKER_ALPHA_LOWER,
214 	XmMARKER_ALPHA_UPPER,
215 	XmMARKER_ROMAN_LOWER,
216 	XmMARKER_ROMAN_UPPER,
217 	XmMARKER_DISC = 15,
218 	XmMARKER_SQUARE,
219 	XmMARKER_CIRCLE
220 }Marker;
221 
222 /*****
223 * Horizontal/Vertical alignment data
224 *****/
225 typedef enum{
226 	XmHALIGN_NONE = 0,	/* horizontal alignment */
227 	XmHALIGN_LEFT,
228 	XmHALIGN_CENTER,
229 	XmHALIGN_RIGHT,
230 	XmHALIGN_JUSTIFY,	/* extension for fully justified text */
231 	XmVALIGN_NONE = 8,	/* vertical alignment */
232 	XmVALIGN_TOP,
233 	XmVALIGN_MIDDLE,
234 	XmVALIGN_BOTTOM,
235 	XmVALIGN_BASELINE
236 }Alignment;
237 
238 /*****
239 * Possible types of HTML objects.
240 * All text types are only used when computing the screen layout
241 *****/
242 typedef enum{
243 	OBJ_NONE = 0,
244 	OBJ_TEXT,			/* text element							*/
245 	OBJ_PRE_TEXT,		/* preformatted text					*/
246 	OBJ_BULLET,			/* all types of markers for lists		*/
247 	OBJ_HRULE,			/* horizontal rule						*/
248 	OBJ_TABLE,			/* table elements						*/
249 	OBJ_TABLE_FRAME,	/* table caption, row, cell elements	*/
250 	OBJ_IMG,			/* image elements						*/
251 	OBJ_FORM,			/* form elements						*/
252 	OBJ_APPLET,			/* applet elements						*/
253 	OBJ_BLOCK			/* other block level elements			*/
254 }ObjectType;
255 
256 /*****
257 * linefeed types
258 *****/
259 #define CLEAR_NONE			-1		/* stay on the same line				*/
260 #define CLEAR_SOFT			0		/* return + move single line downard	*/
261 #define CLEAR_HARD			1		/* return + move two lines downward		*/
262 #define CLEAR_ALL			2		/* return + move baseline fully down	*/
263 
264 /*****
265 * Server/client side and map type values
266 *****/
267 typedef enum{
268 	XmMAP_NONE = 1,
269 	XmMAP_SERVER,
270 	XmMAP_CLIENT
271 }Imagemap;
272 
273 /*****
274 * Image option bits.
275 * Each of these bits represents certain state information about an image.
276 *****/
277 #define IMG_ISBACKGROUND		(1L<<1)	/* is a background image			*/
278 #define IMG_ISINTERNAL			(1L<<2)	/* is an internal image				*/
279 #define IMG_ISCOPY				(1L<<3)	/* is a referential copy			*/
280 #define IMG_ISANIM				(1L<<4)	/* is an animation					*/
281 #define IMG_FRAMEREFRESH		(1L<<5)	/* set when running an animation	*/
282 #define IMG_HASDIMENSIONS		(1L<<6)	/* dimensions are given in <IMG>	*/
283 #define IMG_HASSTATE			(1L<<7)	/* current state pixmap present		*/
284 #define IMG_INFOFREED			(1L<<8)	/* imageinfo has been freed			*/
285 #define IMG_DELAYED_CREATION	(1L<<9)	/* create when needed				*/
286 #define IMG_ORPHANED			(1L<<10)/* indicates orphaned image			*/
287 #define IMG_PROGRESSIVE			(1L<<11)/* indicates image is being loaded	*/
288 
289 /*****
290 * Possible colorclass an image can have.
291 *****/
292 #define COLOR_CLASS_GRAYSCALE	0
293 #define COLOR_CLASS_INDEXED		1
294 #define COLOR_CLASS_RGB			2
295 
296 /*****
297 * What type of scrolling a frame should employ.
298 *****/
299 typedef enum{
300 	FRAME_SCROLL_NONE = 1,
301 	FRAME_SCROLL_AUTO,
302 	FRAME_SCROLL_YES
303 }FrameScrolling;
304 
305 /*****
306 * Possible types of frame sizes
307 *****/
308 typedef enum{
309 	FRAME_SIZE_FIXED = 1,			/* size specified in pixels	*/
310 	FRAME_SIZE_RELATIVE,			/* size is relative			*/
311 	FRAME_SIZE_OPTIONAL				/* size is optional			*/
312 }FrameSize;
313 
314 /*****
315 * Possible Frame layout policies
316 *****/
317 typedef enum{
318 	FRAMESET_LAYOUT_ROWS = 1,		/* rows	only					*/
319 	FRAMESET_LAYOUT_COLS = 2,		/* columns only					*/
320 	FRAMESET_LAYOUT_ROW_COLS = 4	/* left to right, top to bottom	*/
321 }FramesetLayout;
322 
323 /*****
324 * The three possible anchor selection states
325 *****/
326 #define ANCHOR_UNSELECTED	(Byte)0		/* default anchor state			*/
327 #define ANCHOR_INSELECT		(Byte)1		/* anchor is gaining selection	*/
328 #define ANCHOR_SELECTED		(Byte)2		/* anchor is selected			*/
329 
330 /*****
331 * XmHTML font style bits
332 *****/
333 #define FONT_BOLD		(1<<1)
334 #define FONT_MEDIUM		(1<<2)
335 #define FONT_ITALIC		(1<<3)
336 #define FONT_REGULAR	(1<<4)
337 #define FONT_FIXED		(1<<5)
338 #define FONT_SCALABLE	(1<<6)
339 
340 /*****
341 * Supported font types
342 *****/
343 #define XmHTML_FONT		(1<<1)
344 #define XmHTML_FONTSET	(1<<2)
345 
346 /*****
347 * A XmHTML font. XmHTML uses it's own font definition for performance
348 * reasons (the layout routines use a *lot* of font properties).
349 *****/
350 typedef struct _XmHTMLFont{
351 	Byte type;					/* font type, XFontStruct or XFontSet		*/
352 	Byte style;					/* this font's style						*/
353 	String font_name;			/* full XLFD								*/
354 	String font_family;			/* fontFamily (foundry-family-sw-spacing)	*/
355 	XtPointer xfont;			/* ptr to font definition					*/
356 								/* Can be a XFontSet when the library was	*/
357 								/* compiled with full I18N support.			*/
358 	/* font properties */
359 	int ptsize;					/* font pointsize							*/
360 	int height;					/* height of largest character				*/
361 	int lineheight;				/* suggested lineheight						*/
362 	Cardinal isp;				/* normal interword spacing					*/
363 	Cardinal eol_sp;			/* additional end-of-line spacing			*/
364 	int sup_xoffset;			/* additional superscript x-offset			*/
365 	int sup_yoffset;			/* additional superscript y-offset			*/
366 	int sub_xoffset;			/* additional subscript x-offset			*/
367 	int sub_yoffset;			/* additional subscript y-offset			*/
368 	int ul_offset;				/* additional underline offset				*/
369 	Cardinal ul_thickness;		/* underline thickness						*/
370 	int st_offset;				/* additional strikeout offset				*/
371 	Cardinal st_thickness;		/* strikeout thickness						*/
372 	short m_lbearing;			/* maximum character left bearing			*/
373 	short m_rbearing;			/* maximum character right bearing			*/
374 	short m_width;				/* maximum character width					*/
375 	short m_ascent;				/* maximum character ascent					*/
376 	short m_descent;			/* maximum character descent				*/
377 	short ascent;				/* average character ascent					*/
378 	short descent;				/* average character descent				*/
379 }XmHTMLfont;
380 
381 /**********
382 ****** Definition of all possible Objects
383 **********/
384 
385 /*****
386 * HTML4.0 Events
387 *****/
388 typedef struct _HTEvent{
389 	int			type;			/* HTML4.0 event type	*/
390 	XtPointer	data;			/* event user data		*/
391 }HTEvent;
392 
393 /*****
394 * All possible events that HTML4.0 defines
395 * All fields are ptrs into XmHTML HTEvent array.
396 *****/
397 typedef struct _AllEvents{
398 	/* Document/Frame specific events */
399 	HTEvent		*onLoad;
400 	HTEvent		*onUnload;
401 
402 	/* HTML Form specific events */
403 	HTEvent		*onSubmit;
404 	HTEvent		*onReset;
405 	HTEvent		*onFocus;
406 	HTEvent		*onBlur;
407 	HTEvent		*onSelect;
408 	HTEvent		*onChange;
409 
410 	/* object events */
411 	HTEvent		*onClick;
412 	HTEvent		*onDblClick;
413 	HTEvent		*onMouseDown;
414 	HTEvent		*onMouseUp;
415 	HTEvent		*onMouseOver;
416 	HTEvent		*onMouseMove;
417 	HTEvent		*onMouseOut;
418 	HTEvent		*onKeyPress;
419 	HTEvent		*onKeyDown;
420 	HTEvent		*onKeyUp;
421 }AllEvents;
422 
423 /*****
424 * event Bitmask values
425 *****/
426 #define EVENT_LOAD			(1L<<0)
427 #define EVENT_UNLOAD		(1L<<1)
428 #define EVENT_SUBMIT		(1L<<2)
429 #define EVENT_RESET			(1L<<3)
430 #define EVENT_FOCUS			(1L<<4)
431 #define EVENT_BLUR			(1L<<5)
432 #define EVENT_SELECT		(1L<<6)
433 #define EVENT_CHANGE		(1L<<7)
434 #define EVENT_CLICK			(1L<<8)
435 #define EVENT_DOUBLECLICK	(1L<<9)
436 #define EVENT_MOUSEDOWN		(1L<<10)
437 #define EVENT_MOUSEUP		(1L<<11)
438 #define EVENT_MOUSEOVER		(1L<<12)
439 #define EVENT_MOUSEMOVE		(1L<<13)
440 #define EVENT_MOUSEOUT		(1L<<14)
441 #define EVENT_KEYPRESS		(1L<<15)
442 #define EVENT_KEYDOWN		(1L<<16)
443 #define EVENT_KEYUP			(1L<<17)
444 
445 /*****
446 * Definition of an anchor
447 * URLType is an enumeration type defined in HTML.h
448 *****/
449 typedef struct _XmHTMLAnchor{
450 	URLType				url_type;		/* url type of anchor			*/
451 	String				name;			/* name if it's a named anchor	*/
452 	String				href;			/* referenced URL				*/
453 	String				target;			/* target spec					*/
454 	String				rel;			/* possible rel					*/
455 	String				rev;			/* possible rev					*/
456 	String				title;			/* possible title				*/
457 	unsigned long		event_mask;		/* defined events				*/
458 	AllEvents			*events;		/* events to be served			*/
459 	Cardinal 			line;			/* location of this anchor		*/
460 	Boolean				visited;		/* true when anchor is visited	*/
461 	struct _XmHTMLAnchor *next;			/* ptr to next anchor			*/
462 }XmHTMLAnchor;
463 
464 /*****
465 * Definition of a word (a word can be plain text, an image, a form member
466 * or a linebreak).
467 *****/
468 typedef struct _XmHTMLWord{
469 	int 				x;			/* x-position for this word				*/
470 	int					y;			/* y-position for this word				*/
471 	Dimension 			width;		/* pixel width of word					*/
472 	Dimension 			height;		/* pixel height of word					*/
473 	Cardinal 			line;		/* line for this word					*/
474 	ObjectType 			type;		/* type of word, used by <pre>,<img>	*/
475 	String 				word;		/* word to display						*/
476 	int 				len;		/* string length of word				*/
477 	XmHTMLfont	 		*font;		/* font to use							*/
478 	Byte 				line_data;	/* line data (underline/strikeout)		*/
479 	Byte				spacing;	/* leading/trailing/nospace allowed		*/
480 	Byte				posbits;	/* Position bits for anchors/lined		*/
481 	AllEvents			*events;	/* events to be served					*/
482 	struct _XmHTMLImage *image;		/* when this is an image				*/
483 	struct _XmHTMLForm	*form;		/* when this is a form element			*/
484 	struct _XmHTMLExtObj *embed;	/* when this is an embedded element		*/
485 	struct _XmHTMLWord	*base;		/* baseline word for a line				*/
486 	struct _XmHTMLWord	*self; 		/* ptr to itself, for anchor adjustment	*/
487 	struct _XmHTMLObjectTable *owner;	/* owner of this worddata			*/
488 }XmHTMLWord;
489 
490 /*****
491 * Definition of an embedded object to the parser.
492 *****/
493 typedef struct _XmHTMLParserTag{
494 	/* user-provided data fields */
495 	String			tag;			/* name of tag							*/
496 	Boolean			terminated;		/* tag has a terminating counterpart	*/
497 	unsigned long	flags;			/* defined attributes					*/
498 	XtPointer		user_data;		/* external tag data, unused internally	*/
499 
500 	/* internal fields */
501 	int				id;				/* internal id, -1 == unused 			*/
502 }XmHTMLParserTag;
503 
504 /*****
505 * Definition of an embedded object. This object allows programmers to
506 * dynamically extend XmHTML with private HTML tags.
507 *****/
508 typedef struct _XmHTMLExtObj{
509 	int 				x;			/* x-position for this object			*/
510 	int					y;			/* y-position for this object			*/
511 	Dimension 			width;		/* absolute width of object				*/
512 	Dimension 			height;		/* absolute height of object			*/
513 	int					id;			/* object identifier					*/
514 	String				name;		/* object identifier					*/
515 	Widget				w;			/* object container						*/
516 
517 	XmHTMLParserTag		*tag;		/* parser element defining this object	*/
518 	XmHTMLTagAttributes	*attributes;/* attributes for this element			*/
519 
520 	/*****
521 	* Possible attributes that can influence the layout of an embedded object.
522 	* They are derived from the HTML4.0 OBJECT element.
523 	*****/
524 	Alignment			halign;		/* horizontal alignment					*/
525 	Alignment			valign;		/* vertical alignment					*/
526 	Dimension			border;		/* border thickness						*/
527 	AllEvents			*events;	/* events to be served					*/
528 
529 	XtPointer			user_data;	/* user data, unused by XmHTML			*/
530 
531 	Boolean				scrollable;	/* true if object is anchored in doc.	*/
532 	Boolean				wrap;		/* wrap/don't wrap text around object	*/
533 	Boolean 			mapped;		/* True when displayed, false otherwise */
534 
535 	struct _XmHTMLObjectTable *data;/* owning data object					*/
536 	struct _XmHTMLExtObj *prev;		/* ptr to previous record				*/
537 	struct _XmHTMLExtObj *next;		/* ptr to next record					*/
538 }XmHTMLExtObj;
539 
540 /* area definition. See map.c for the full definition */
541 typedef struct _mapArea mapArea;
542 
543 /*****
544 * Client-side imagemap information
545 * mapArea is a transparent object and is defined in map.c
546 *****/
547 typedef struct _XmHTMLImageMap{
548 	String				name;		/* name of map			*/
549 	int					nareas;		/* no of areas			*/
550 	mapArea				*areas;		/* list of areas		*/
551 	struct _XmHTMLImageMap *next;	/* ptr to next imagemap */
552 }XmHTMLImageMap;
553 
554 /*****
555 * XmHTML's internal image format.
556 * One very important thing to note is that the meaning of the (width,height)
557 * and (swidth,sheight) members of this structure is exactly *OPPOSITE* to
558 * the members with the same name in the public structures (XmImageInfo and
559 * XmImage).
560 *****/
561 typedef struct _XmHTMLImage{
562 	/* Normal image data */
563 	Byte			magic;			/* structure identifier */
564 	String			url;			/* raw src specification */
565 	XmImageInfo		*html_image;	/* local image data */
566 	Pixmap			pixmap;			/* actual image */
567 	Pixmap			clip;			/* for transparant pixmaps */
568 	unsigned long	options;		/* image option bits */
569 	int				width;			/* resulting image width */
570 	int				height;			/* resulting image height */
571 	int				npixels;		/* no of allocated pixels */
572 	XCC             xcc;			/* a lot of visual info */
573 
574 	/* Possible <IMG> attributes */
575 	int				swidth;			/* requested image width */
576 	int				sheight;		/* requested image height */
577 	String			alt;			/* alternative image text */
578 	Alignment		align;			/* image alignment */
579 	Imagemap		map_type;		/* type of map to use */
580 	String			map_url;		/* image map url/name */
581 	Dimension		border;			/* image border thickness */
582 	Dimension		hspace;			/* horizontal spacing */
583 	Dimension		vspace;			/* vertical spacing */
584 
585 	struct _XmHTMLObjectTable *owner;	/* owner of this image */
586 	struct _XmHTMLImage *child;		/* ptr to copies of this image */
587 	struct _XmHTMLImage *next;		/* ptr to next image */
588 
589 	/* animation data */
590 	XmImageFrame 	*frames;		/* array of animation frames */
591 	int				nframes;		/* no of frames following */
592 	int				current_frame;	/* current frame count */
593 	int				current_loop;	/* current loop count */
594 	int				loop_count;		/* maximum loop count */
595 	XtIntervalId	proc_id;		/* timer id for animations */
596 	XmHTMLWidget	html;			/* image owner */
597 	XtAppContext	context;		/* Application context for animations */
598 
599 	/* other data */
600 	AllEvents			*events;	/* events to be served */
601 }XmHTMLImage;
602 
603 /*****
604 * The following structure is used to mimic file access in memory.
605 * It's only used for loading images, hence the name ImageBuffer.
606 *****/
607 typedef struct{
608 	char *file;					/* name of file */
609 	Byte *buffer;				/* memory buffer */
610 	Byte *curr_pos;				/* current position in buffer */
611 	size_t next;				/* current block count */
612 	size_t size;				/* total size of in-memory file */
613 	Boolean may_free;			/* True when we must free this block */
614 	unsigned char type;			/* type of image */
615 	int depth;					/* depth of this image */
616 }ImageBuffer;
617 
618 /*****
619 * Definition of HTML form components
620 *****/
621 typedef struct _XmHTMLForm{
622 	int	 			x;				/* x-position for this widget */
623 	int 			y;				/* y-position for this widget */
624 	Dimension 		width;			/* width of this widget */
625 	Dimension 		height;			/* height of this widget */
626 	Cardinal		line;			/* starting line number of this object */
627 	Widget 			w;				/* Widget ID */
628 	Widget			child;			/* child id for scrolled stuff */
629 	String 			name;			/* name for this widget */
630 	Byte 			type;			/* Widget type (see HTML.h) */
631 	int				size;			/* cols in text(field)/items in select */
632 	int				maxlength;		/* max chars to enter/rows in textarea */
633 	String 			value;			/* default text */
634 	String			content;		/* entered text(field) contents */
635 	Alignment		align;			/* image/file browse button position */
636 	Boolean			multiple;		/* multiple select flag */
637 	int				selected;		/* default state */
638 	Boolean 		checked;		/* check value for option/radio buttons. */
639 	Boolean 		mapped;			/* True when displayed, false otherwise */
640 	struct _XmHTMLForm *options;	/* option items for select */
641 	struct _XmHTMLObjectTable *data;/* owning data object */
642 	struct _XmHTMLFormData *parent;	/* parent form */
643 	struct _XmHTMLForm *prev;		/* ptr to previous record */
644 	struct _XmHTMLForm *next;		/* ptr to next record */
645 }XmHTMLForm;
646 
647 /*****
648 * Definition of form data
649 *****/
650 typedef struct _XmHTMLFormData{
651 	Widget		html;				/* owner of this form					*/
652 	Boolean		can_clip;			/* can we perform form clipping?		*/
653 	Pixmap		clip;				/* clipmask to use for scrolling		*/
654 	int			x;					/* absolute position of top-left corner	*/
655 	int			y;					/* absolute position of top-left corner	*/
656 	Dimension	width;				/* width of form						*/
657 	Dimension	height;				/* height of form						*/
658 	String		action;				/* destination url/cgi-bin				*/
659 	int			method;				/* XmHTML_FORM_GET,POST,PIPE			*/
660 	String		enctype;			/* form encoding						*/
661 	int			ncomponents;		/* no of items in this form				*/
662 	Widget		fileSB;				/* input == file						*/
663 	XmHTMLForm	*components;		/* list of form items					*/
664 	struct _XmHTMLFormData *prev;	/* ptr to previous form					*/
665 	struct _XmHTMLFormData *next;	/* ptr to next form						*/
666 }XmHTMLFormData;
667 
668 /*****
669 * Definition of XmHTML tables
670 *
671 * Dimensions:
672 * positive -> absolute number;
673 * negative -> relative number;
674 * 0        -> no dimension specified;
675 *
676 * Each component in a table has a set of core properties. Properties are
677 * inherited from top to bottom and can be overriden.
678 *
679 * Content containers render the contents of all objects between
680 * start (inclusive) and end (exclusive).
681 *****/
682 /* possible framing types */
683 typedef enum{
684 	TFRAME_VOID = 0,			/* no borders		*/
685 	TFRAME_ABOVE,				/* only top side	*/
686 	TFRAME_BELOW,				/* only bottom side	*/
687 	TFRAME_LEFT,				/* only left side	*/
688 	TFRAME_RIGHT,				/* only right side	*/
689 	TFRAME_HSIDES,				/* top & bottom		*/
690 	TFRAME_VSIDES,				/* left & right		*/
691 	TFRAME_BOX,					/* all sides		*/
692 	TFRAME_BORDER				/* all sides		*/
693 }TableFraming;
694 
695 /* possible ruling types */
696 typedef enum{
697 	TRULE_NONE = 0,				/* no rules			*/
698 	TRULE_GROUPS,				/* only colgroups	*/
699 	TRULE_ROWS,					/* only rows		*/
700 	TRULE_COLS,					/* only columns		*/
701 	TRULE_ALL					/* all cells		*/
702 }TableRuling;
703 
704 /* cell borders to be rendered */
705 #define CELL_TOP	(1<<1)
706 #define CELL_LEFT	(1<<2)
707 #define CELL_BOTTOM	(1<<3)
708 #define CELL_RIGHT	(1<<4)
709 #define CELL_BOX	(CELL_TOP|CELL_LEFT|CELL_BOTTOM|CELL_RIGHT)
710 #define CELL_NONE	~(CELL_BOX)
711 
712 /*****
713 * Properties shared by all table elements. These are inherited from top to
714 * bottom and can be overriden by the appropriate tag attributes.
715 *****/
716 typedef struct _TableProperties{
717 	int				border;				/* border width, 0 = noborder	*/
718 	Alignment		halign;				/* content horizontal alignment	*/
719 	Alignment		valign;				/* content vertical alignment	*/
720 	Pixel			bg;					/* content background color		*/
721 	XmHTMLImage		*bg_image;			/* content background image		*/
722 	TableFraming	framing;			/* what frame should we use?	*/
723 	TableRuling		ruling;				/* what rules should we draw?	*/
724 	Boolean			nowrap;				/* don't break lines			*/
725 }TableProperties;
726 
727 /*****
728 * a Cell, can be a header cell or a simple cell.
729 *****/
730 typedef struct _TableCell{
731 	Boolean			header;				/* True if a header cell	*/
732 	int				width;				/* suggested cell width		*/
733 	int				height;				/* suggested cell height	*/
734 	int				rowspan;			/* no of rows spanned		*/
735 	int				colspan;			/* no of cells spanned		*/
736 	TableProperties	*props;				/* properties for this cell	*/
737 	Byte			borders;			/* borders to render		*/
738 	struct _XmHTMLObjectTable *start;	/* first object to render	*/
739 	struct _XmHTMLObjectTable *end;		/* last object to render	*/
740 	struct _XmHTMLObjectTable *owner;	/* owning object			*/
741 	struct _TableRow *parent;			/* parent of this cell		*/
742 }TableCell;
743 
744 /* A row. A row consists of a number of Cells */
745 typedef struct _TableRow{
746 	TableCell		*cells;				/* all cells in this row	*/
747 	int				ncells;				/* no of cells in row		*/
748 	int				lastcell;			/* last used cell			*/
749 	TableProperties	*props;				/* properties for this row	*/
750 	struct _XmHTMLObjectTable *start;	/* first object to render	*/
751 	struct _XmHTMLObjectTable *end;		/* last object to render	*/
752 	struct _XmHTMLObjectTable *owner;	/* owning object			*/
753 	struct _XmHTMLTable *parent;		/* parent of this row		*/
754 }TableRow;
755 
756 /*****
757 * A table. A table consists of a Caption and a number of Rows
758 * The caption is a special row: it has only one cell that stretches
759 * across the entire table: itself.
760 *****/
761 typedef struct _XmHTMLTable{
762 	/* overall table properties */
763 	int				width;				/* suggested table width	*/
764 	int				hmargin;			/* horizontal cell margin	*/
765 	int				vmargin;			/* vertical cell margin		*/
766 	int				hpadding;			/* horizontal cell padding	*/
767 	int				vpadding;			/* vertical row padding		*/
768 	int				ncols;				/* no of columns			*/
769 	TableProperties *props;				/* master table properties	*/
770 
771 	TableRow		*caption;			/* table caption			*/
772 	TableRow		*rows;				/* all table rows			*/
773 	int				nrows;				/* no of rows in table		*/
774 	int				lastrow;			/* last used row			*/
775 
776 	struct _XmHTMLTable *parent;		/* parent table (for childs)*/
777 	struct _XmHTMLTable *childs;		/* table child				*/
778 	int				nchilds;			/* no of child tables		*/
779 	int				lastchild;			/* last used table			*/
780 
781 	struct _XmHTMLObjectTable *start;	/* first object in table	*/
782 	struct _XmHTMLObjectTable *end;		/* last object in table		*/
783 
784 	struct _XmHTMLObjectTable *owner;	/* owner of this table		*/
785 
786 	struct _XmHTMLTable *next;			/* ptr to next table		*/
787 }XmHTMLTable;
788 
789 /*****
790 * Definition of formatted HTML elements
791 *****/
792 typedef struct _XmHTMLObjectTable{
793 	int				x;				/* x position for this element		*/
794 	int				y;				/* y position for this element		*/
795 	Dimension		width;			/* width of this element			*/
796 	Dimension		height;			/* height of this element			*/
797 	Cardinal		line;			/* starting line number of this object */
798 	Cardinal		id;				/* object identifier (anchors only)	*/
799 	ObjectType		object_type;	/* element type						*/
800 	String			text;			/* cleaned text						*/
801 	Byte			text_data;		/* text/image/anchor data bits		*/
802 	int				len;			/* length of text or width of a rule*/
803 	int				y_offset;		/* offset for sub/sup, <hr> noshade flag */
804 	int				x_offset;		/* additional offset for sub/sup	*/
805 	XmHTMLObject	*object;		/* object data (raw text)			*/
806 	XmHTMLAnchor	*anchor;		/* ptr to anchor data				*/
807 	XmHTMLWord		*words;			/* words to be displayed			*/
808 	XmHTMLForm		*form;			/* form data						*/
809 	XmHTMLTable		*table;			/* table data						*/
810 	int				n_words;		/* number of words					*/
811 	Byte			anchor_state;	/* anchor selection state identifier*/
812 	Alignment		halign;			/* horizontal line alignment		*/
813 	int				linefeed;		/* linebreak type					*/
814 	Dimension		ident;			/* xoffset for list indentation		*/
815 	Marker			marker;			/* marker to use in lists			*/
816 	int				list_level;		/* current count of list element.	*/
817 	XmHTMLfont		*font;			/* font to be used for this object	*/
818 	Pixel			fg;				/* foreground color for this object	*/
819 	Pixel			bg;				/* background color for this object	*/
820 	struct _XmHTMLObjectTable *next;
821 	struct _XmHTMLObjectTable *prev;
822 }XmHTMLObjectTable, *XmHTMLObjectTableElement;
823 
824 /*****
825 * Line lookups
826 *****/
827 typedef struct{
828 	Boolean			used;			/* entry is being used				*/
829 	int				y;				/* first offset where line occurs	*/
830 	XmHTMLObjectTable *start;		/* first element on line			*/
831 	XmHTMLObjectTable *end;			/* last element on line				*/
832 }XmHTMLLineTable;
833 
834 /*****
835 * The following two structures are not yet used by XmHTML. They are intended
836 * to serve as the basis for layered HTML documents (including transparent
837 * layers), progressive document loading and rendering to non-display
838 * devices.
839 *****/
840 typedef struct _XmHTMLSubDoc{
841 	int				x;				/* document upper left corner		*/
842 	int				y;				/* document upper left corner		*/
843 	Dimension		width;			/* width of document				*/
844 	Dimension		height;			/* height of document				*/
845 	Cardinal		nlines;			/* no of lines occupied by doc		*/
846 	XmHTMLObject	*elements;		/* list of raw objects				*/
847 	XmHTMLObjectTable	*start;		/* first element in document		*/
848 	XmHTMLObjectTable	*end;		/* last element in document			*/
849 	struct sd_funcs{
850 		void (*parse)();			/* subdoc parser function			*/
851 		void (*format)();			/* subdoc formatter function		*/
852 		void (*layout)();			/* subdoc layout function			*/
853 		void (*paint)();			/* subdoc paint function			*/
854 	}sd;
855 	struct _XmHTMLSubDoc *child;	/* child documents					*/
856 	struct _XmHTMLSubDoc *prev;		/* ptr to previous document			*/
857 	struct _XmHTMLSubDoc *next;		/* ptr to next document				*/
858 	struct _ToolkitAbstraction *tka;
859 }XmHTMLSubDoc;
860 
861 #define LAY_SCROLLABLE		(1<<1)	/* layer is scrollable				*/
862 #define LAY_FIXED			(1<<2)	/* layer has fixed position			*/
863 #define LAY_FIXED_REL		(1<<3)	/* layer fixed to position in doc	*/
864 #define LAY_VISIBLE			(1<<4)	/* layer is visible					*/
865 #define LAY_RAISE			(1<<5)	/* layer can be raised				*/
866 #define LAY_LOWER			(1<<6)	/* layer can be lowered				*/
867 #define LAY_SEND_EVENTS		(1<<7)	/* layer can send events			*/
868 #define LAY_RECV_EVENTS		(1<<8)	/* layer can receive events			*/
869 #define LAY_BG_IMAGE		(1<<9)	/* layer has background image		*/
870 #define LAY_BG_COLOR		(1<<10)	/* layer has background color		*/
871 #define LAY_TRANSPARENT		(1<<11)	/* layer is transparent				*/
872 #define LAY_WINDOW			(1<<12)	/* layer has got a window			*/
873 #define LAY_INPUT_OUTPUT	(1<<13)	/* layer can do input and output	*/
874 #define LAY_INPUT_ONLY		(1<<14)	/* layer can only accept input		*/
875 #define LAY_OUTPUT_ONLY		(1<<15)	/* layer can only do output			*/
876 
877 typedef struct _XmHTMLLayer{
878 	struct _XmHTMLLayer *self;		/* ptr to self						*/
879 	int				x;				/* layer upper left corner			*/
880 	int				y;				/* layer upper left corner			*/
881 	Dimension		width;			/* width of layer					*/
882 	Dimension		height;			/* height of layer					*/
883 	unsigned long	flags;			/* layer flags						*/
884 	unsigned long	state;			/* current layer flags				*/
885 	Byte			zpos;			/* layer stacking position			*/
886 	XmHTMLImage		*background;	/* background image					*/
887 	Pixel			bg;				/* background color					*/
888 	Pixmap			mask;			/* transparency mask				*/
889 	Window			window;			/* layer's window					*/
890 	XmHTMLSubDoc	*subdoc;		/* layer document					*/
891 
892 	struct l_funcs{
893 		void (*send_event)();		/* layer send-event function		*/
894 		void (*read_event)();		/* layer read-event function		*/
895 		void (*pass_event)();		/* layer event passing function		*/
896 		void (*refresh)();			/* layer refresh function			*/
897 		void (*raise)();			/* layer raise function				*/
898 		void (*lower)();			/* layer lower function				*/
899 		void (*scroll)();			/* layer scroll function			*/
900 		void (*map)();				/* layer map function				*/
901 		void (*unmap)();			/* layer unmap function				*/
902 	}lf;
903 
904 	struct _XmHTMLLayer *parent;	/* parent of this layer				*/
905 	struct _XmHTMLLayer *upper;		/* layer on top of this layer		*/
906 	struct _XmHTMLLayer *lower;		/* layer below this layer			*/
907 	struct _XmHTMLLayer *prev;		/* ptr to previous layer			*/
908 	struct _XmHTMLLayer *next;		/* ptr to next layer				*/
909 }XmHTMLLayer;
910 
911 /*****
912 * A stripped down array of all words that are searchable. Contains enough
913 * information to search for text and provide information about the
914 * selection that should be made to display the text found.
915 *****/
916 struct _XmHTMLSearchableWord{
917 	String 				word;		/* word to display						*/
918 	int 				len;		/* string length of word				*/
919 	Byte				spacing;	/* leading/trailing/nospace allowed		*/
920 	XmHTMLObjectTable	*owner;		/* owner of this word					*/
921 	int					word_idx;	/* index of word in owner word array	*/
922 };
923 
924 /*****
925 * definition of frame childs
926 *****/
927 typedef struct _XmHTMLFrameWidget{
928 	int				x;				/* computed frame x-position			*/
929 	int				y;				/* computed frame y-position			*/
930 	Dimension		width;			/* computed frame width					*/
931 	Dimension		height;			/* computed frame height				*/
932 	Dimension		size_s;			/* saved frame size						*/
933 	FrameSize		size_type;		/* horizontal frame size specification	*/
934 	FrameScrolling	scroll_type;	/* frame scrolling						*/
935 	String			src;			/* source document						*/
936 	String			name;			/* internal frame name					*/
937 	Dimension		margin_width;	/* frame margin width					*/
938 	Dimension		margin_height;	/* frame margin height					*/
939 	Boolean			resize;			/* may we resize this frame?			*/
940 	int				border;			/* add a border around this frame?		*/
941 	Widget			frame;			/* XmHTMLWidget id for this frame		*/
942 
943 	/* Frame resizing */
944 	int				drag_x;			/* Amount dragged in x-direction		*/
945 	int				drag_y;			/* Amount dragged in y-direction		*/
946 
947 	/* Added June 11 by Eric Bello */
948 	Boolean			is_frameset;			/* true frame or frameset?		*/
949 	struct _XmHTMLFrameWidget *frameset;	/* parent frameset, if any		*/
950 	struct _XmHTMLFrameWidget *next;		/* next frame child, if any		*/
951 	struct _XmHTMLFrameWidget *prev;		/* prev. frame child, if any	*/
952 	struct _XmHTMLFrameWidget *children;	/* list of frames				*/
953 	FramesetLayout	layout;					/* frameset layout policy		*/
954 }XmHTMLFrameWidget;
955 
956 /*****
957 * Definition of page keywords
958 *****/
959 typedef struct _XmHTMLPageData{
960 	XmHTMLObject *data;					/* page contents			*/
961 
962 	/* display data */
963 	String window;						/* display type				*/
964 	String title;						/* page title				*/
965 
966 	/* index generation */
967 	int id;								/* id of current page		*/
968 	int depth;							/* toc depth				*/
969 	String name;						/* name of current page		*/
970 	Boolean noindex;					/* skip for index generation*/
971 
972 	/* Search data */
973 	Boolean nosearch;					/* skip from searching		*/
974 	String keywords;					/* searchable keywords		*/
975 	String desc;						/* page description			*/
976 
977 	/* References */
978 	int next_id;						/* id of next page			*/
979 	int prev_id;						/* id of previous page		*/
980 	int *seealso;						/* list of related pages	*/
981 
982 	struct _XmHTMLPageData *children;	/* page children			*/
983 	struct _XmHTMLPageData *next;		/* next page				*/
984 	struct _XmHTMLPageData *prev;		/* previous page			*/
985 
986 }XmHTMLPageHeader;
987 
988 /*****
989 * Definition of a Page
990 *****/
991 typedef struct _XmHTMLPage{
992 	XmHTMLObject		*start;			/* first object in page		*/
993 	XmHTMLObject		*end;			/* last object in page		*/
994 
995 	int					page_no;		/* page number				*/
996 	Boolean				redo_layout;	/* needs reformatting		*/
997 
998 	Boolean				input_complete;	/* True when input was completed */
999 
1000 	/* anchor colors */
1001 	Pixel				anchor_fg;
1002 	Pixel				anchor_visited_fg;
1003 	Pixel				anchor_target_fg;
1004 	Pixel				anchor_activated_fg;
1005 	Pixel				anchor_activated_bg;
1006 
1007 	/* background image/color and text color resources */
1008 	Pixel				body_bg;		/* current background color */
1009 	Pixel				body_fg;		/* current foreground color */
1010 	String				body_image_url;	/* background image location */
1011 	XmHTMLImage         *body_image;	/* background image data */
1012 
1013 	/* Formatted document resources */
1014 	int					formatted_width;	/* total width of document		*/
1015 	int					formatted_height;	/* total height of document		*/
1016 	int					num_named_anchors;	/* total no of named anchors	*/
1017 	int					anchor_words;	/* total no of anchor words			*/
1018 	XmHTMLWord			*anchors;		/* for quick anchor lookup			*/
1019 	XmHTMLObjectTable	*named_anchors; /* for quick named anchor lookup	*/
1020 	XmHTMLAnchor		*anchor_data;	/* parsed anchor data				*/
1021 	XmHTMLObjectTable	*formatted;		/* display object data				*/
1022 	Cardinal			top_line;		/* current topline					*/
1023 	Cardinal			nlines;			/* no of lines in document			*/
1024 
1025 	/* Table resources */
1026 	XmHTMLTable			*tables;		/* list of all tables */
1027 
1028 	/* HTML Form resources */
1029 	XmHTMLFormData		*form_data;		/* all forms in the current document */
1030 
1031 	/* All images */
1032 	XmHTMLImage			*images;		/* list of images in current doc */
1033 }XmHTMLPage;
1034 
1035 /*****
1036 * Parser state stack object
1037 *****/
1038 typedef struct _stateStack{
1039 	htmlEnum id;					/* current state id */
1040 	struct _stateStack *next;		/* ptr to next record */
1041 }stateStack;
1042 
1043 /*****
1044 * Progressive Loading Context. This is an opaque object fully defined in
1045 * plc.h. It's a rather complex thing for all objects than can be loaded
1046 * progressively. It maintains the state of each object (data as well as data
1047 * processing functions) and does a bunch of nifty things.
1048 *****/
1049 typedef struct _PLC *PLCPtr;
1050 
1051 /*****
1052 * This struct is required to properly perform alpha channel processing.
1053 * It contains information about the current background setting.
1054 *
1055 * Alpha channel processing is done for PNG images with (obviously) an alpha
1056 * channel. The data used for creating the pixmap is a merger of the original
1057 * image data with the current background setting (fixed color or an image).
1058 * When a document with such an image contains a background image, XmHTML needs
1059 * to redo this alpha processing whenever the document layout is changed: the
1060 * exact result of this merger depends on the position of the image. This can
1061 * be a rather slow process (alpha channels require floating point ops), and
1062 * by at least storing the current background info we can achieve some
1063 * performance increase.
1064 *****/
1065 typedef struct _AlphaChannelInfo{
1066 	int fb_maxsample;			/* frame buffer maximum sample value */
1067 	int background[3];			/* solid background color: R, G, B */
1068 	int ncolors;				/* size of background image colormap */
1069 	XColor *bg_cmap;			/* background image colormap */
1070 }AlphaChannelInfo, *AlphaPtr;
1071 
1072 /*****
1073 * HTML Parser data
1074 *****/
1075 typedef struct _Parser{
1076 	String source;				/* text being parsed					*/
1077 	int index;					/* last known position					*/
1078 	int len;					/* length of input text					*/
1079 	int num_lines;				/* current line count					*/
1080 	Dimension line_len;			/* maximum line length so far			*/
1081 	Dimension cnt;				/* current line length					*/
1082 
1083 	void (*store_text)(
1084 #ifdef NeedFunctionPrototypes
1085 		struct _Parser *parser, char *start, char *end
1086 #endif
1087 	);							/* text insertion function				*/
1088 
1089 	/* running list of inserted elements */
1090 	int num_elements;			/* no of tags inserted so far			*/
1091 	int num_text;				/* no of text elements inserted so far	*/
1092 	XmHTMLObject *head;			/* head of object list					*/
1093 	XmHTMLObject *current;		/* lastly inserted element				*/
1094 	XmHTMLObject *last;			/* last valid element (progressive mode)*/
1095 
1096 	stateStack state_base;		/* stack base point						*/
1097 	stateStack *state_stack;	/* actual stack							*/
1098 
1099 	int cstart;					/* current element start position		*/
1100 	int cend;					/* current element end position			*/
1101 	int inserted;				/* no of auto-inserted chars			*/
1102 
1103 	Cardinal err_count;			/* no of errors so far					*/
1104 	Cardinal loop_count;		/* no of loops made so far				*/
1105 	Boolean strict_checking;	/* HTML 3.2 looseness flag				*/
1106 	Boolean have_body;			/* indicates presence of <body> tag		*/
1107 	Boolean have_page;			/* indicates presence of <page> tag		*/
1108 	Byte warn;					/* warn about bad html constructs		*/
1109 	Boolean bad_html;			/* bad HTML document flag				*/
1110 	Boolean html32;				/* HTML32 conforming document flag		*/
1111 	Boolean	automatic;			/* when in automatic mode				*/
1112 	Boolean do_icons;			/* check for icon entities?				*/
1113 
1114 	Widget widget;				/* for the warning messages				*/
1115 }Parser;
1116 
1117 /*****
1118 * XmHTMLPart definition
1119 *****/
1120 typedef struct _XmHTMLPart {
1121 	/* Original document Resources */
1122 	String				value;		/* raw HTML text, copied to the parser */
1123 	String				source;		/* copy used by XmHTML */
1124 	String				mime_type;	/* mime type of this text/image (?) */
1125 	Byte				mime_id;	/* internal mime id */
1126 	Boolean				input_complete;	/* True when input was completed */
1127 
1128 	/* Anchor resources */
1129 	Cursor				anchor_cursor;
1130 	Boolean				anchor_display_cursor;
1131 	Boolean				anchor_buttons;
1132 
1133 	/* anchor colors */
1134 	Pixel				anchor_fg;
1135 	Pixel				anchor_visited_fg;
1136 	Pixel				anchor_target_fg;
1137 	Pixel				anchor_activated_fg;
1138 	Pixel				anchor_activated_bg;
1139 	Boolean				highlight_on_enter;		/* anchor highlighting */
1140 
1141 	/* anchor underlining styles */
1142 	Byte				anchor_underline_type;
1143 	Byte				anchor_visited_underline_type;
1144 	Byte				anchor_target_underline_type;
1145 
1146 	/* internal underlining styles, translated from above */
1147 	Byte				anchor_line;
1148 	Byte				anchor_target_line;
1149 	Byte				anchor_visited_line;
1150 
1151 	Position			anchor_position_x;	/* for server-side imagemaps */
1152 	Position			anchor_position_y;	/* for server-side imagemaps */
1153 	XmHTMLObjectTable	*armed_anchor;		/* current anchor */
1154 	XmHTMLAnchor		*anchor_current_cursor_element;
1155 	XmHTMLAnchorProc	anchor_visited_proc;
1156 
1157 	/* background image/color and text color resources */
1158 	Boolean				body_colors_enabled;
1159 	Boolean				body_images_enabled;
1160 	Boolean				allow_color_switching;
1161 	Boolean				allow_form_coloring;	/* body colors on HTML forms */
1162 	Boolean				freeze_animations;
1163 	Boolean				icon_entities_enabled;
1164 	Byte				icon_valign;
1165 	Pixel				body_bg;		/* current background color */
1166 	Pixel				body_fg;		/* current foreground color */
1167 	String				body_image_url;	/* background image location */
1168 	String				def_body_image_url;	/* default bg image location */
1169 	XmHTMLImage         *body_image;	/* background image data */
1170 	GC					bg_gc;			/* background render gc */
1171 
1172 	/* Font resources */
1173 	String				charset;
1174 	String				font_family;
1175 	String				font_family_fixed;
1176 	String				font_sizes;
1177 	String				font_sizes_fixed;
1178 	XmHTMLfont			*default_font;
1179 	Byte				string_direction;
1180 	Byte				alignment;
1181 	Alignment			default_halign;
1182 	Boolean				allow_font_switching;
1183 	int					tabwidth;
1184 	int					res_x;
1185 	int					res_y;
1186 
1187 	/* Image resources */
1188 	Boolean				images_enabled;	/* True -> show images */
1189 	int					max_image_colors; /* 0 -> as much as possible */
1190 	float				screen_gamma;	/* gamma correction for this display */
1191 	XmImageProc			image_proc;		/* external image loader */
1192 	XmImageGifProc		gif_proc;		/* external gif decoder */
1193 	String				zCmd;			/* uncompress command for LZWStream */
1194 	XmHTMLImage			*images;		/* list of images in current doc */
1195 	Boolean				delayed_creation;	/* delayed image creation */
1196 	XCC					xcc;			/* a lot of visual info */
1197 
1198 	Byte				map_to_palette;	/* if and how to map to palette */
1199 	String				palette;		/* palette to use */
1200 
1201 	/* Imagemap resources */
1202 	XmHTMLImageMap		*image_maps;	/* array of client-side imagemaps */
1203 	Pixel				imagemap_fg;	/* bounding box color */
1204 	Boolean				imagemap_draw;	/* draw imagemap bounding boxes */
1205 
1206 	/* Frame resources */
1207 	Boolean				is_frame;		/* true when this is a frame */
1208 	FrameScrolling		scroll_type;	/* frame scrolling */
1209 	int					frame_border;	/* add a border to the frames? */
1210 	int					nframes;		/* no of frames managed */
1211 	XmHTMLFrameWidget	**frames;		/* list of frame childs */
1212 
1213 	/* Document resources */
1214 	Boolean				strict_checking;
1215 	Boolean				enable_outlining;
1216 	Byte				bad_html_warnings;
1217 	XtPointer			client_data;	/* client_data for functional res. */
1218 
1219 	/* Private Resources */
1220 	Dimension			margin_width;	/* document margins */
1221 	Dimension			margin_height;
1222 	Widget				work_area;		/* render area */
1223 	Dimension			work_width;		/* render area dimensions */
1224 	Dimension			work_height;
1225 
1226 	Boolean				resize_height;	/* True -> autosize vertically */
1227 	Boolean				resize_width;	/* True -> autosize horizontally */
1228 
1229 	/* Progressive Loader Context buffer and interval */
1230 	PLCPtr				plc_buffer;		/* PLC ringbuffer */
1231 	int					num_plcs;		/* no of PLC's in ringbuffer */
1232 	int					plc_def_delay;	/* default PLC timeout delay */
1233 	int					plc_delay;		/* PLC timeout delay */
1234 	int					plc_min_delay;	/* PLC minimum timeout delay */
1235 	int					plc_max_delay;	/* PLC maximum timeout delay */
1236 	XtIntervalId		plc_proc_id;	/* timer id for main plc cycler */
1237 	XmHTMLGetDataProc	get_data;		/* PLC data request function */
1238 	XmHTMLEndDataProc	end_data;		/* PLC end signal function */
1239 	Boolean				plc_suspended;	/* Global PLC suspension flag */
1240 	GC					plc_gc;			/* gc used by all plc's */
1241 
1242 	Byte				load_type;		/* current loading method		*/
1243 
1244 	/* perform final dithering pass/use image colors */
1245 	Byte				perfect_colors;
1246 
1247 	/* Internal stuff for alpha channelled PNG images */
1248 	AlphaPtr			alpha_buffer;
1249 	Byte				rgb_conv_mode;	/* 24 to 8bit conversion method */
1250 	Byte				alpha_processing;	/* do alpha channel stuff? */
1251 
1252 	/*
1253 	* Fallback colors, required for proper color resetting between documents
1254 	* with and without a <body> color spec.
1255 	*/
1256 	Pixel				anchor_fg_save;
1257 	Pixel				anchor_visited_fg_save;
1258 	Pixel				anchor_target_fg_save;
1259 	Pixel				anchor_activated_fg_save;
1260 	Pixel				anchor_activated_bg_save;
1261 	Pixel				body_bg_save;
1262 	Pixel				body_fg_save;
1263 
1264 	/* Scrollbar resources */
1265 	Widget				hsb;			/* vertical scrollbar widget id */
1266 	Widget				vsb;			/* horizontal scrollbar widget id */
1267 	Byte				sb_policy;		/* scrollbar display policy */
1268 	Byte				sb_placement;	/* scrollbar placement policy */
1269 	int					scroll_x;		/* current horizontal position */
1270 	int					scroll_y;		/* current vertical position */
1271 	Boolean				needs_hsb;		/* True -> hsb required */
1272 	Boolean				needs_vsb;		/* True -> vsb required */
1273 
1274 	/* Callback resources */
1275 	XtCallbackList		activate_callback;
1276 	XtCallbackList		arm_callback;
1277 	XtCallbackList		anchor_track_callback;
1278 	XtCallbackList		frame_callback;
1279 	XtCallbackList		form_callback;
1280 	XtCallbackList		input_callback;
1281 	XtCallbackList		link_callback;
1282 	XtCallbackList		motion_track_callback;
1283 	XtCallbackList		imagemap_callback;
1284 	XtCallbackList		document_callback;
1285 	XtCallbackList		focus_callback;
1286 	XtCallbackList		losing_focus_callback;
1287 	XtCallbackList		event_callback;
1288 	XtCallbackList		object_callback;
1289 	XtCallbackList		page_callback;
1290 
1291 	Boolean				need_tracking;	/* serve mouse/focus tracking?		*/
1292 
1293 	XmHTMLEventProc		event_proc;		/* HTML4.0 event processing proc	*/
1294 	HTEvent				**events;		/* HTML4.0 event data				*/
1295 	int					nevents;		/* no of events watched				*/
1296 	unsigned long		event_mask;		/* Body events						*/
1297 	AllEvents			*body_events;	/* Body events: onLoad/unLoad		*/
1298 
1299 	XmHTMLScriptProc	script_proc;	/* <script> processing proc			*/
1300 
1301 	/* Formatted document resources */
1302 	int					formatted_width;	/* total width of document		*/
1303 	int					formatted_height;	/* total height of document		*/
1304 	int					num_named_anchors;	/* total no of named anchors	*/
1305 	int					anchor_words;	/* total no of anchor words			*/
1306 	XmHTMLWord			*anchors;		/* for quick anchor lookup			*/
1307 	XmHTMLObject		*elements;		/* unfiltered parser output			*/
1308 	XmHTMLObjectTable	*named_anchors; /* for quick named anchor lookup	*/
1309 	XmHTMLAnchor		*anchor_data;	/* parsed anchor data				*/
1310 	XmHTMLObjectTable	*formatted;		/* display object data				*/
1311 	XmHTMLObjectTable	*paint_start;	/* first paint command				*/
1312 	XmHTMLObjectTable	*paint_end;		/* last paint command				*/
1313 	int					paint_x;		/* horizontal paint start x-pos		*/
1314 	int					paint_y;		/* vertical paint start y-pos		*/
1315 	int					paint_width;	/* horizontal paint end x-pos		*/
1316 	int					paint_height;	/* vertical paint end y-pos			*/
1317 	Cardinal			top_line;		/* current topline					*/
1318 	Cardinal			nlines;			/* no of lines in document			*/
1319 	XmHTMLLineTable		*line_table;	/* line lookups						*/
1320 
1321 	/* Progressive document loading */
1322 	XmHTMLObject		*first_element;	/* first valid parser output		*/
1323 	XmHTMLObject		*last_element;	/* last valid parser output			*/
1324 	XmHTMLObjectTable	*first_formatted;/* first valid display object data	*/
1325 	XmHTMLObjectTable	*last_formatted;/* last valid display object data	*/
1326 
1327 	/* Table resources */
1328 	XmHTMLTable			*tables;		/* list of all tables */
1329 
1330 	/* Embedded object resources */
1331 	XmHTMLExtObj		*embedded;		/* list of embedded objects */
1332 
1333 	/* Anchor activation resources */
1334 	int					press_x;		/* ptr coordinates */
1335 	int					press_y;
1336 	Time				pressed_time;	/* time of anchor activation */
1337 	Time				selected_time;	/* unused for now */
1338 	XmHTMLAnchor		*selected;		/* selected anchor */
1339 	XmHTMLObjectTable	*current_anchor;/* selected object */
1340 
1341 	/* Text selection resources */
1342 	XmHTMLObjectTable	*selection;		/* reserved for future use */
1343 	int					select_start;	/* reserved for future use */
1344 	int					select_end;		/* reserved for future use */
1345 
1346 	/* HTML Form resources */
1347 	XmHTMLFormData		*form_data;		/* all forms in the current document */
1348 
1349 	/* Misc. resources */
1350 	int					repeat_delay;	/* keyboard and scrollbar delay */
1351 	Boolean				smooth_scroll;	/* do smooth scrolling			*/
1352 	GC					gc;				/* main rendering gc */
1353 	Boolean				in_layout;		/* layout blocking flag.
1354 										 * Also used as SetValues blocking
1355 										 * flag by the parser.
1356 										 */
1357 	int					visibility;		/* visibility state of work_area */
1358 
1359 	struct _ToolkitAbstraction	*tka;	/* toolkit abstraction	*/
1360 
1361 #ifdef DEBUG
1362 	Boolean				debug_disable_warnings;	/* warning msg blocking flag */
1363 	Boolean				debug_full_output;	/* allow output from FullDebug */
1364 	Boolean				debug_save_clipmasks; /* save clipmasks as bitmaps */
1365 	Boolean				debug_no_loopcount;	/* ignore loop_count in anims */
1366 	String				debug_prefix;		/* debug file prefix */
1367 	String				debug_levels;		/* debug levels to enable */
1368 #endif
1369 
1370 	unsigned char pad[60];				/* reserved for future use */
1371 
1372 }XmHTMLPart;
1373 
1374 typedef struct _XmHTMLRec
1375 {
1376 	CorePart		core;
1377 	CompositePart	composite;
1378 	ConstraintPart	constraint;
1379 	XmManagerPart	manager;
1380 	XmHTMLPart		html;
1381 } XmHTMLRec;
1382 
1383 /* Define subclassing level index to be used with ResolvePartOffset */
1384 #define XmHTMLIndex		(XmManagerIndex+1)
1385 
1386 externalref XmHTMLClassRec xmHTMLClassRec;
1387 
1388 /*****
1389 * Pull in other private headers (internal function proto's, warning message
1390 * table, compile-time configuration) when building the library.
1391 *****/
1392 #ifdef _LIBRARY
1393 #include "tka.h"
1394 #include "XmHTMLI.h"
1395 #include "HTMLWarnings.h"
1396 #include "XmHTMLfuncs.h"
1397 #include "XmHTMLconf.h"
1398 #include "debug.h"
1399 #endif
1400 
1401 _XFUNCPROTOEND
1402 
1403 /* Don't add anything after this endif! */
1404 #endif /* _XmHTMLP_h_ */
1405