1/***** 2* HTML.h : XmHTML Widget public header file. 3* Resource defines, enumerations and structures. 4* 5* This file Version $Revision: 1.8 $ 6* 7* Creation date: Tue Apr 15 23:39:26 GMT+0100 1997 8* Last modification: $Date: 1998/04/27 06:54:30 $ 9* By: $Author: newt $ 10* Current State: $State: Exp $ 11* 12* Author: newt 13* 14* Copyright (C) 1994-1997 by Ripley Software Development 15* All Rights Reserved 16* 17* This file is part of the XmHTML Widget Library 18* 19* This library is free software; you can redistribute it and/or 20* modify it under the terms of the GNU Library General Public 21* License as published by the Free Software Foundation; either 22* version 2 of the License, or (at your option) any later version. 23* 24* This library is distributed in the hope that it will be useful, 25* but WITHOUT ANY WARRANTY; without even the implied warranty of 26* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27* Library General Public License for more details. 28* 29* You should have received a copy of the GNU Library General Public 30* License along with this library; if not, write to the Free 31* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 32* 33*****/ 34/***** 35* $Source: /usr/local/rcs/Newt/XmHTML/RCS/HTML.h,v $ 36*****/ 37/***** 38* ChangeLog 39* $Log: HTML.h,v $ 40* Revision 1.8 1998/04/27 06:54:30 newt 41* Changed XmImageProc proto 42* 43* Revision 1.7 1998/04/04 06:27:46 newt 44* XmHTML Beta 1.1.3 45* 46* Revision 1.6 1997/10/23 00:24:27 newt 47* XmHTML Beta 1.1.0 release 48* 49* Revision 1.5 1997/08/31 17:30:39 newt 50* Removed HT_TEXTFLOW 51* 52* Revision 1.4 1997/08/30 00:22:46 newt 53* Alpha channel resources: XmNalphaChannelProcessing and 54* XmNimageRGBConversion. Updated comments and reorganized a bunch of things. 55* 56* Revision 1.3 1997/08/01 12:52:11 newt 57* Progressive image loading changes 58* 59* Revision 1.2 1997/05/28 01:29:28 newt 60* XmImage changes: added the XmImageConfig structure and configuration flags. 61* Added support for the XmNdecodeGIFProc resource. 62* 63* Revision 1.1 1997/04/29 14:19:18 newt 64* Initial Revision 65* 66*****/ 67 68#ifndef _HTML_h_ 69#define _HTML_h_ 70 71/* include our new resources */ 72#include <XmHTML/HTMLStrings.h> 73 74/****************************************************************************** 75* Enumerations and other constants 76******************************************************************************/ 77 78/***** 79* HTML Elements internal id's 80* This list is alphabetically sorted to speed up the searching process. 81* DO NOT MODIFY 82*****/ 83typedef enum{ 84HT_DOCTYPE, HT_A, HT_ADDRESS, HT_APPLET, HT_AREA, HT_B, HT_BASE, HT_BASEFONT, 85HT_BIG, HT_BLOCKQUOTE, HT_BODY, HT_BR, HT_CAPTION, HT_CENTER, HT_CITE, HT_CODE, 86HT_DD, HT_DFN, HT_DIR, HT_DIV, HT_DL, HT_DT, HT_EM, HT_FONT, HT_FORM, HT_FRAME, 87HT_FRAMESET, HT_H1, HT_H2, HT_H3, HT_H4, HT_H5, HT_H6, HT_HEAD, HT_HR, HT_HTML, 88HT_I, HT_IMG, HT_INPUT, HT_ISINDEX, HT_KBD, HT_LI, HT_LINK, HT_MAP, HT_MENU, 89HT_META, HT_NOFRAMES, HT_OL, HT_OPTION, HT_P, HT_PAGE, HT_PARAM, HT_PRE, 90HT_SAMP, HT_SCRIPT, HT_SELECT, HT_SMALL, HT_STRIKE, HT_STRONG, HT_STYLE, HT_SUB, 91HT_SUP, HT_TAB, HT_TABLE, HT_TD, HT_TEXTAREA, HT_TH, HT_TITLE, 92HT_TR, HT_TT, HT_U, HT_UL, HT_VAR, HT_ZTEXT 93}htmlEnum; 94 95/***** 96* Corresponding HTML element name table. Indexing with the above enumeration 97* will give the corresponding element name. 98*****/ 99extern String *html_tokens; 100 101/***** 102* XmHTML defines the following callback reasons. This might produce strange 103* results once Motif decides to uses enum values above 16383. 104* Send us a mail at ripley@xs4all.nl if you get problems that are due to 105* these enumeration values. 106*****/ 107enum{ 108 XmCR_HTML_ANCHORTRACK = 16384, /* XmNanchorTrackCallback */ 109 XmCR_HTML_DOCUMENT, /* XmNdocumentCallback */ 110 XmCR_HTML_FORM, /* XmNformCallback */ 111 XmCR_HTML_FRAME, /* XmNframeCallback */ 112 XmCR_HTML_FRAMECREATE, /* XmNframeCallback */ 113 XmCR_HTML_FRAMEDESTROY, /* XmNframeCallback */ 114 XmCR_HTML_IMAGEMAPACTIVATE, /* XmNimagemapCallback */ 115 XmCR_HTML_IMAGEMAP, /* XmNimagemapCallback */ 116 XmCR_HTML_LINK, /* XmNlinkCallback */ 117 XmCR_HTML_MODIFYING_TEXT_VALUE, /* XmNmodifyVerifyCallback */ 118 XmCR_HTML_MOTIONTRACK, /* XmNmotionTrackCallback */ 119 XmCR_HTML_PARSER, /* XmNparserCallback */ 120 XmCR_HTML_EVENT, /* XmNeventCallback */ 121 XmCR_HTML_EVENTDESTROY, /* XmNeventCallback */ 122 XmCR_HTML_OBJECT, /* XmNobjectCallback */ 123 XmCR_HTML_OBJECTCREATE, /* XmNobjectCallback */ 124 XmCR_HTML_OBJECTDESTROY, /* XmNobjectCallback */ 125 XmCR_HTML_LANGUAGE /* XmNlanguageCallback */ 126}; 127 128/***** 129* XmNeventCallback sub event types 130*****/ 131enum{ 132 /* Document/Frame specific events */ 133 XmCR_HTML_LOAD = 0, /* onLoad */ 134 XmCR_HTML_UNLOAD, /* onUnLoad */ 135 136 /* HTML Form specific events */ 137 XmCR_HTML_SUBMIT, /* onSubmit */ 138 XmCR_HTML_RESET, /* onReset */ 139 XmCR_HTML_FOCUS, /* onFocus */ 140 XmCR_HTML_BLUR, /* onBlur */ 141 XmCR_HTML_SELECT, /* onSelect */ 142 XmCR_HTML_CHANGE, /* onChange */ 143 144 /* object events */ 145 XmCR_HTML_CLICK, /* onClick */ 146 XmCR_HTML_DOUBLE_CLICK, /* onDblClick */ 147 XmCR_HTML_MOUSEDOWN, /* onMouseDown */ 148 XmCR_HTML_MOUSEUP, /* onMouseUp */ 149 XmCR_HTML_MOUSEOVER, /* onMouseOver */ 150 XmCR_HTML_MOUSEMOVE, /* onMouseMove */ 151 XmCR_HTML_MOUSEOUT, /* onMouseOut */ 152 XmCR_HTML_KEYPRESS, /* onKeyPress */ 153 XmCR_HTML_KEYDOWN, /* onKeyDown */ 154 XmCR_HTML_KEYUP, /* onKeyUp */ 155 XmCR_HTML_USEREVENT /* must always be last */ 156}; 157 158/***** 159* URL types XmHTML knows of. 160* The hostnames, files and port numbers are only shown for demonstration 161* purposes, XmHTML doesn't care whether they are present or not. 162* The first 16 elements are alphabetically sorted to speed up URL 163* translations. 164*****/ 165typedef enum{ 166 ANCHOR_ABOUT = 0, /* href="about:..." */ 167 ANCHOR_EXEC, /* href="exec:foo_bar" */ 168 ANCHOR_FILE_REMOTE, /* href="file://foo.bar/file.html" */ 169 ANCHOR_FTP, /* href="ftp://foo.bar/file" */ 170 ANCHOR_GOPHER, /* href="gopher://foo.bar:70" */ 171 ANCHOR_HELP, /* href="help:..." */ 172 ANCHOR_HTTP, /* href="http://foo.bar/file.html" */ 173 ANCHOR_SECURE_HTTP, /* href="https://foo.bar/file.html" */ 174 ANCHOR_INFO, /* href="info:.." */ 175 ANCHOR_MAILTO, /* href="mailto:foo@bar" */ 176 ANCHOR_MAN, /* href="man:..." */ 177 ANCHOR_NEWS, /* href="news://foo.bar" */ 178 ANCHOR_PIPE, /* href="pipe:foo_bar" */ 179 ANCHOR_TELNET, /* href="telnet://foo.bar:23" */ 180 ANCHOR_WAIS, /* href="wais://foo.bar" */ 181 ANCHOR_XEXEC, /* href="xexec:foo_bar" */ 182 ANCHOR_UNKNOWN, /* unknown href */ 183 ANCHOR_FILE_LOCAL, /* href="file.html" */ 184 ANCHOR_FORM_IMAGE, /* <input type=image>, only used internally */ 185 ANCHOR_JUMP, /* href="#..." */ 186 ANCHOR_NAMED /* name="...." */ 187}URLType; 188 189/***** 190* Various methods of loading documents. 191* LOAD_NORMAL 192* The entire document is provided. This is the default method of loading 193* documents. 194* LOAD_PROGRESSIVE 195* Progressive document load. A complete source is provided each time: 196* caller takes care of appending new text to th current buffer before 197* flushing it to XmHTML. 198* LOAD_INCREMENTAL 199* Progressive document load. A new chunk is provided each time: XmHTML 200* takes care of appending new text to the already existing text. 201* LOAD_SUSPEND 202* Suspend progressive or incremental loading. XmHTML display the document 203* upto the last valid combination of tokens. 204* LOAD_ABORT 205* Abort progressive or icremental loading. XmHTML will flush it's 206* buffers and display all the data (including any constructs it 207* requires to close the document). 208*****/ 209enum{ 210 XmLOAD_NORMAL = 0, /* normal load, all data at once */ 211 XmLOAD_PROGRESSIVE, /* progressive load, use new text */ 212 XmLOAD_INCREMENTAL, /* progressive load, append new text */ 213 XmLOAD_SUSPEND, /* suspend load */ 214 XmLOAD_ABORT /* abort load */ 215}; 216 217/***** 218* Procedure to be called whenever a script is encountered 219* Arguments: 220* Widget: XmHTMLWidget id 221* String: script source text 222* XtPointer: XmNclientData value 223* Return value: 224* data to be stored whenever a document event should be processed. 225* This data is unused internally and is provided as the user_data 226* argument in the XmHTMLEvent structure. For example, the return value 227* could be a pointer into some internal procedural database, a ptr to a 228* compiled script procedure or the script source text if you want to 229* process it at some later time (when the event occurs). 230* 231* When NULL is returned the event in question is disabled. 232*****/ 233typedef XtPointer (*XmHTMLEventProc)(Widget, String, XtPointer); 234 235/***** 236* HTML Form component types. Alphabetically sorted to speed up searching. 237*****/ 238typedef enum{ 239 FORM_CHECK = 0, /* checkbox */ 240 FORM_FILE, /* file selection box */ 241 FORM_HIDDEN, /* hidden input */ 242 FORM_IMAGE, /* drawnbutton */ 243 FORM_OPTION, /* select child */ 244 FORM_PASSWD, /* password textfield */ 245 FORM_RADIO, /* radiobox */ 246 FORM_RESET, /* reset button */ 247 FORM_SELECT, /* select parent */ 248 FORM_SUBMIT, /* submit button */ 249 FORM_TEXT, /* singleline textfield */ 250 FORM_TEXTAREA, /* multiline edit field */ 251 FORM_UNKNOWN /* unknown type */ 252}componentType; 253 254/***** 255* Supported HTML Form method types 256*****/ 257enum{ 258 XmHTML_FORM_GET = 0, /* method = get */ 259 XmHTML_FORM_POST, /* method = post */ 260 XmHTML_FORM_PIPE /* method = pipe */ 261}; 262 263/***** 264* possible error codes for XmNparserCallback 265*****/ 266typedef enum{ 267 HTML_UNKNOWN_ELEMENT = 1, /* unknown HTML element */ 268 HTML_BAD, /* very badly placed element */ 269 HTML_OPEN_BLOCK, /* block still open while new block started */ 270 HTML_CLOSE_BLOCK, /* block closed but was never opened */ 271 HTML_OPEN_ELEMENT, /* unbalanced terminator */ 272 HTML_NESTED, /* improperly nested element */ 273 HTML_VIOLATION, /* bad content for current block/element */ 274 HTML_NOTIFY, /* notification of text insertion/removal */ 275 HTML_INTERNAL /* internal parser error */ 276}parserError; 277 278/***** 279* And corresponding values for XmNenableBadHTMLWarnings. 280* These are or'd together. 281* XmNONE disables warnings and XmHTML_ALL enables all warnings. 282* See parserError for their meaning. 283*****/ 284enum{ 285 XmHTML_NONE = 0, /* no warnings */ 286 XmHTML_UNKNOWN_ELEMENT = 1, 287 XmHTML_BAD = 2, 288 XmHTML_OPEN_BLOCK = 4, 289 XmHTML_CLOSE_BLOCK = 8, 290 XmHTML_OPEN_ELEMENT = 16, 291 XmHTML_NESTED = 32, 292 XmHTML_VIOLATION = 64, 293 XmHTML_ALL = 127 /* all warnings */ 294}; 295 296/***** 297* possible action codes for the action field in the XmHTMLParserCallbackStruct 298*****/ 299enum{ 300 HTML_REMOVE = 1, /* remove offending element */ 301 HTML_INSERT, /* insert missing element */ 302 HTML_SWITCH, /* switch offending and expected element */ 303 HTML_KEEP, /* keep offending element */ 304 HTML_IGNORE, /* ignore, proceed as if nothing happened */ 305 HTML_ALIAS, /* alias an unknown element to known one */ 306 HTML_TERMINATE /* terminate parser */ 307}; 308 309/***** 310* Possible return codes for XmHTMLImageGetType(). 311* These are all reserved values and represent image types 312* XmHTML is able to recognize. 313* User-defined images start from IMAGE_USER. 314*****/ 315enum{ 316 IMAGE_ERROR = 0, /* error on image loading */ 317 IMAGE_UNKNOWN, /* unknown image */ 318 IMAGE_XPM, /* X11 pixmap */ 319 IMAGE_XBM, /* X11 bitmap */ 320 IMAGE_GIF, /* CompuServe(C) Gif87a or Gif89a */ 321 IMAGE_GIFANIM, /* animated gif */ 322 IMAGE_GIFANIMLOOP, /* animated gif with loop extension */ 323 IMAGE_GZF, /* compatible Gif87a or Gif89a */ 324 IMAGE_GZFANIM, /* compatible animated gif */ 325 IMAGE_GZFANIMLOOP, /* compatible animated gif */ 326 IMAGE_JPEG, /* JPEG image */ 327 IMAGE_PNG, /* PNG image */ 328 IMAGE_FLG, /* Fast Loadable Graphic */ 329 IMAGE_USER = 64 /* user defined image */ 330}; 331 332/***** 333* Possible return values for a function installed on the 334* XmNprogressiveReadProc resource. 335*****/ 336#define STREAM_OK 1 /* internally used value */ 337#define STREAM_END 0 /* data stream ended (no more data) */ 338#define STREAM_SUSPEND -1 /* data stream suspended (not enough data) */ 339#define STREAM_ABORT -2 /* data stream aborted */ 340#define STREAM_RESIZE -3 /* resize input buffer */ 341 342/***** 343* Possible return values for the XmNdecodeGIFProc resource and 344* values for the XmHTMLGIFStream state. 345*****/ 346#define GIF_STREAM_OK 2 347#define GIF_STREAM_END 1 348#define GIF_STREAM_ERR 0 349#define GIF_STREAM_INIT -1 350#define GIF_STREAM_FINAL -2 351 352/***** 353* Possible return values from a number of image related routines. 354* The actual meaning depends on the routine used. 355*****/ 356typedef enum{ 357 XmIMAGE_ERROR = 0, /* unknown error occured */ 358 XmIMAGE_BAD, /* bad function call: missing arg or so */ 359 XmIMAGE_UNKNOWN, /* provided XmImage/XmImageInfo unknown/unbound */ 360 XmIMAGE_ALMOST, /* action completed, further response necessary */ 361 XmIMAGE_OK /* action completed. */ 362}XmImageStatus; 363 364/***** 365* Possible values for transparency (value for the "bg" field in both 366* XmImage and XmImageInfo structures). Possible values are: 367* 368* XmIMAGE_NONE 369* indicates the image is not transparent 370* XmIMAGE_TRANSPARENCY_BG 371* indicates the image achieves transparency by substituting the current 372* background setting (can be a single color or background image. Internally, 373* such transparency is achieved by using a clipmask). 374* XmIMAGE_TRANSPARENCY_ALPHA 375* indicates the image achieves transparency by using an alpha channel. 376* This transparency is currently only used by PNG images with an alpha 377* channel or a tRNS chunk (which is expanded to an alpha channel internally). 378*****/ 379enum{ 380 XmIMAGE_NONE = 0, 381 XmIMAGE_TRANSPARENCY_BG, 382 XmIMAGE_TRANSPARENCY_ALPHA 383}; 384 385/***** 386* Possible values for the colorspace value. 387* 388* XmIMAGE_COLORSPACE_GRAYSCALE 389* image contains only shades of gray. The colorcube is reduced to a 1D 390* representation. All components in a shade have the same value. The 391* pixel values are equal to the value of a single color component. 392* XmIMAGE_COLORSPACE_INDEXED 393* image uses a fixed palette. Colorcube is mapped to a 1D lookup-table. 394* XmIMAGE_COLORSPACE_RGB 395* image uses a full 3D colorcube. 396*****/ 397enum{ 398 /* XmIMAGE_NONE */ 399 XmIMAGE_COLORSPACE_GRAYSCALE = 1, 400 XmIMAGE_COLORSPACE_INDEXED, 401 XmIMAGE_COLORSPACE_RGB 402}; 403 404/***** 405* XmImageInfo structure options field bits. 406* The ``Set by default'' indicates a bit set when the XmHTMLImageDefaultProc 407* is used to read an image. The ``Read Only'' indicates a bit you should 408* consider as read-only. 409* XmIMAGE_DELAYED 410* Indicates the image is delayed, e.i. it will be provided at a later stage; 411* XmIMAGE_DEFERRED_FREE 412* Indicates XmHTML may free this structure when a new document is loaded. 413* XmIMAGE_IMMEDIATE_FREE 414* Indicates XmHTML may free this structure when XmHTML no longer needs it; 415* XmIMAGE_RGB_SINGLE 416* Indicates that the reds, greens and blues fields are allocated in a single 417* memory area instead of three seperate memory arrays. 418* XmIMAGE_ALLOW_SCALE 419* Indicates that scaling an image is allowed. 420* XmIMAGE_FRAME_IGNORE 421* Use with animations: set this bit when a frame falls outside the logical 422* screen area. No pixmap is created but the timeout for the frame is kept. 423* XmIMAGE_CLIPMASK 424* This bit is set when the returned XmImageInfo structure contains clipmask 425* data. XmHTML uses this info to create a clipping bitmap. Changing this 426* bit from set to unset will lead to a memory leak while changing it from 427* unset to set *without* providing a clipmask yourself *will* cause an error 428* to happen. You can set this bit when you are providing your own clipmask 429* (to provide non-rectangular images for example), PROVIDED you fill the 430* ``clip'' field with valid bitmap data (a stream of bytes in XYBitmap format 431* and the same size of the image). 432* XmIMAGE_SHARED_DATA 433* This bit is set when images share data. XmHTML sets this bit when the image 434* in question is an internal image, e.i., one for which the image data may 435* never be freed. Be carefull setting this bit yourself, since it prevents 436* XmHTML from freeing the image data present in the XmImageInfo structure. 437* It can easily lead to memory leaks when an image is *not* an internal 438* image. 439* XmIMAGE_PROGRESSIVE 440* Setting this bit will enable XmHTML progressive image loading. A function 441* *must* have been installed on the XmNprogressiveReadProc resource *prior* 442* to setting this bit. Installing a function on the XmNprogressiveEndProc 443* is optional. When this bit is set all other bits will be ignored. 444* XmIMAGE_DELAYED_CREATION 445* This bit is read-only. It is used internally by XmHTML for images with 446* an alpha channel. Alpha channel processing merges the current background 447* with the original RGB data from the image and uses the result to compose 448* the actual on-screen image (the merged data is stored in the ``data'' 449* field of the XmImageInfo structure). XmHTML needs to store the original 450* data somewhere, and when this bit is set it is stored in the ``rgb'' field 451* of the XmImageInfo structure. 452* When this bit is set, the returned XmImageInfo may *NOT BE FREED* as long 453* as the current document is alive. You can discard it as soon as a new 454* document is loaded. 455*****/ 456#define XmIMAGE_DELAYED (1<<1) 457#define XmIMAGE_DEFERRED_FREE (1<<2) /* set by default */ 458#define XmIMAGE_IMMEDIATE_FREE (1<<3) 459#define XmIMAGE_RGB_SINGLE (1<<4) /* set by default */ 460#define XmIMAGE_ALLOW_SCALE (1<<5) /* set by default */ 461#define XmIMAGE_FRAME_IGNORE (1<<6) 462#define XmIMAGE_CLIPMASK (1<<7) /* Read Only */ 463#define XmIMAGE_SHARED_DATA (1<<8) /* Read Only */ 464#define XmIMAGE_PROGRESSIVE (1<<9) 465 466#define XmIMAGE_DELAYED_CREATION (1<<10) /* Read Only */ 467 468/***** 469* XmImageInfo animation disposal values 470* A disposal method specifies what should be done before the current frame is 471* rendered. Possible values are: 472* XmIMAGE_DISPOSE_NONE 473* do nothing, overlays the previous frame with the current frame. 474* XmIMAGE_DISPOSE_BY_BACKGROUND 475* Restore to background color. The area used by the previous frame must 476* be restored to the background color/image 477* XmIMAGE_DISPOSE_BY_PREVIOUS 478* Restore to previous. The area used by the previous frame must be 479* restored to what was there prior to rendering the previous frame. 480*****/ 481enum{ 482 /* XmIMAGE_NONE */ 483 XmIMAGE_DISPOSE_NONE = 1, /* default behaviour */ 484 XmIMAGE_DISPOSE_BY_BACKGROUND, 485 XmIMAGE_DISPOSE_BY_PREVIOUS 486}; 487 488/***** 489* Primary image cache actions 490* (unimplemented) 491*****/ 492#define IMAGE_STORE 0 /* store an image in the cache */ 493#define IMAGE_GET 1 /* retrieve an image from the cache */ 494#define IMAGE_DISCARD 2 /* discard an image from the cache */ 495 496/***** 497* XmNperfectColors/XmNalphaChannelProcessing resource values. 498* 499* Note: these values are represented by the XmCEnableMode resource class. 500*****/ 501enum{ 502 /* XmAUTOMATIC */ 503 XmALWAYS = 1, 504 XmNEVER 505}; 506 507/***** 508* Possible XmNimageMapToPalette/XmNimageRGBConversion resource values: 509* 510* XmQUICK 511* RGBConversion: 512* first checks if the 24bit image contains less than XmNmaxImageColors. 513* If not, XmHTML will dither to a fixed palette. This is fast but has 514* the disadvantage that the background color in an alpha channelled 515* image will not be matched exactly. 516* MapToPalette: 517* Use closest distance algorithm to map colors to the palette. No 518* error correction is performed. Reasonably fast, but quality 519* heavily depends on the distribution of the colors in the image. 520* XmBEST 521* RGBConversion (default): 522* first checks if the 24bit image contains less than XmNmaxImageColors. 523* If it is, the actual image colors are used. If not, a histogram of the 524* image is computed, the most used colors are selected and the resulting 525* image is dithered to this palette. 526* Offers best 24 to 8bit conversion and is probably faster than XmSLOW 527* as only images with more than XmNmaxImageColors will be dithered. 528* MapToPalette: 529* Ordered dithering using predefined error matrices. Reasonably fast and 530* quite good results; 531* XmFAST 532* RGBConversion: 533* Skips the check and dithers to a fixed palette right away. This is the 534* fastest way to do 24 to 8bit conversion but has the disadvantage that 535* every 24bit image is dithered to a fixed palette, regardless of the 536* actual no of colors in the image. 537* MapToPalette: 538* Simple ordered dithering. Fastest but probably the poorest results. 539* XmSLOW 540* RGBConversion: 541* Skips the check and does histogram stuff right away. 542* MapToPalette: 543* closest distance algorithm to map image colors to the palette and use 544* dynamic error correction. Slowest but best results; 545* XmDISABLED 546* RGBConversion: 547* ignored; 548* MapToPalette (default): 549* Disables palette mapping; 550* 551* Note: these values are represented by the XmCConversionMode resource class. 552*****/ 553enum{ 554 XmQUICK = 0, 555 XmBEST, 556 XmFAST, 557 XmSLOW, 558 XmDISABLED 559}; 560 561/***** 562* Embedded object flags. These flags tell XmHTML which attributes are 563* defined for an object. 564*****/ 565#define HT_TAG_CLASSID (1<<1) /* classid, defines an implementation */ 566#define HT_TAG_CODEBASE (1<<2) /* base url for applet */ 567#define HT_TAG_DATA (1<<3) /* object data */ 568#define HT_TAG_SRC (1<<4) /* object data */ 569#define HT_TAG_TYPE (1<<5) /* internet data content type */ 570#define HT_TAG_CODETYPE (1<<6) /* internet code content type */ 571#define HT_TAG_STANDBY (1<<7) /* standby message */ 572#define HT_TAG_ALIGN (1<<8) /* global alignment */ 573#define HT_TAG_HALIGN (1<<9) /* horizontal alignment */ 574#define HT_TAG_VALIGN (1<<10) /* vertical alignment */ 575#define HT_TAG_HEIGHT (1<<11) /* suggested height */ 576#define HT_TAG_WIDTH (1<<12) /* suggested width */ 577#define HT_TAG_BORDER (1<<13) /* suggested border width */ 578#define HT_TAG_HSPACE (1<<14) /* suggested horizontal gutting space */ 579#define HT_TAG_VSPACE (1<<15) /* suggested vertical gutting space */ 580#define HT_TAG_USEMAP (1<<16) /* imagemap reference */ 581#define HT_TAG_BACKGROUND (1<<17) /* background image specification */ 582#define HT_TAG_BGCOLOR (1<<18) /* background color specification */ 583#define HT_TAG_HREF (1<<19) /* hyperlink */ 584#define HT_TAG_NAME (1<<20) /* object name/named hyperlink */ 585#define HT_TAG_EVENTS (1<<21) /* HTML4.0 events */ 586 587/***** 588* Possible return values for the embedded object convenience functions 589*****/ 590typedef enum{ 591 OBJECT_ALMOST = 0, /* action completed, further action required */ 592 OBJECT_DESTROYED, /* object has been destroyed */ 593 OBJECT_EMPTY, /* object is empty */ 594 OBJECT_ERROR, /* unknown error */ 595 OBJECT_FATAL, /* fatal object error has occured */ 596 OBJECT_INVALID, /* invalid object */ 597 OBJECT_INVALID_LOCATION,/* object has an invalid location */ 598 OBJECT_INVALID_SIZE, /* object has an invalid size */ 599 OBJECT_LOWERED, /* object is lowered */ 600 OBJECT_MAPPED, /* object is mapped to screen */ 601 OBJECT_OK, /* action completed succesfully */ 602 OBJECT_ORPHANED, /* object has no parent */ 603 OBJECT_PARENTED, /* object already has a parent */ 604 OBJECT_RAISED, /* object is raised */ 605 OBJECT_UNIMPLEMENTED, /* requested function unimplemented */ 606 OBJECT_UNKNOWN, /* unknown object */ 607 OBJECT_UNKNOWN_ELEMENT, /* invalid element id */ 608 OBJECT_UNMAPPED, /* object has been unmapped */ 609 OBJECT_UNUSED, /* object is not being used */ 610 OBJECT_USED, /* object is currently being used */ 611 OBJECT_VISIBLE /* object is visible */ 612}XmHTMLObjectStatus; 613 614/***** 615* Search directions: forward or backward search 616*****/ 617typedef enum{ 618 XmHTML_FORWARD = 0, 619 XmHTML_BACKWARD 620}XmHTMLDirection; 621 622/***** 623* XmHTMLTextFind return codes 624*****/ 625typedef enum{ 626 XmREG_ERROR = 0, /* An error occured */ 627 XmREG_NOMATCH, /* end of text and no match found */ 628 XmREG_MATCH /* a match was found */ 629}XmHTMLRegexStatus; 630 631/***** 632* In addition to the POSIX regex error codes, XmHTMLTextFinderGetError 633* can return the following errors 634*****/ 635#define RE_EEMPTY -1 /* no search string given */ 636#define RE_ENOMEM -2 /* out of memory */ 637#define RE_EBADPARENT -3 /* parent is not of class xmHTMLWidgetClass */ 638#define RE_EWORDS -4 /* no words to be searched (empty document) */ 639#define RE_ERROR -5 /* unknown error */ 640 641/***** 642* Finder is a fully opaque type. 643*****/ 644typedef struct _XmHTMLTextFinder *XmHTMLTextFinder; 645 646/***** 647* Custom Papersize dimension unit type 648*****/ 649enum{ 650 XmHTML_CHAR = 0, 651 XmHTML_CENTIMETER, /* 1cm = 0.39in */ 652 XmHTML_MILLIMETER, /* 1mm = 0.1cm */ 653 XmHTML_INCH, /* 1in = 2.54cm */ 654 XmHTML_PICA, /* 1pc = 12pt */ 655 XmHTML_POINT /* 1in = 72.27pt, 1cm = 28.45pt */ 656}; 657 658/***** 659* XmHTMLTextGetFormatted paper size defines 660*****/ 661enum{ 662 XmHTMLTEXT_PAPERSIZE_A4 = 0, 663 XmHTMLTEXT_PAPERSIZE_LETTER, 664 XmHTMLTEXT_PAPERSIZE_CUSTOM 665}; 666 667/***** 668* XmHTMLTextGetFormatted type definitions 669*****/ 670enum{ 671 XmHTMLTEXT_PLAIN = 0, /* generate plain ASCII document */ 672 XmHTMLTEXT_FORMATTED, /* generate formatted ASCII document */ 673 XmHTMLTEXT_POSTSCRIPT /* generate formatted Postscript output */ 674}; 675 676/***** 677* XmHTMLTextGetFormatted Postscript option bits 678* (under construction) 679* The MIMIC_FONTS bit instructs XmHTML to use any of the supported postscript 680* fonts to approach the fonts used in the document. When set, all other font 681* bits are ignored. When not used, the PSFONT bits can be or'd together. 682* XmHTML will attempt to do the following mapping: 683* PSFONT_ROMAN/PSFONT_CENTURY -> default text font; 684* PSFONT_HELVETICA/PSFONT_LUCIDA -> fixed width font; 685* If only one of the PSFONT bits is set, the entire document will be rendered 686* in that font. 687*****/ 688#define XmHTMLTEXT_ANCHORFOOTNOTES (1L<<0) /* footnote anchors */ 689#define XmHTMLTEXT_ADDHEADER (1L<<1) /* put title */ 690#define XmHTMLTEXT_ADDFOOTER (1L<<2) /* put pagenumbers */ 691#define XmHTMLTEXT_PSFONT_ROMAN (1L<<3) 692#define XmHTMLTEXT_PSFONT_HELVETICA (1L<<4) 693#define XmHTMLTEXT_PSFONT_CENTURY (1L<<5) 694#define XmHTMLTEXT_PSFONT_LUCIDA (1L<<6) 695#define XmHTMLTEXT_MIMIC_FONTS (1L<<7) 696 697/***** 698* XmHTMLGetHeadAttributes mask bits 699*****/ 700#define HeadClear ((unsigned char)0) /* clear everything */ 701#define HeadDocType (1<<0) /* fill doctype member */ 702#define HeadTitle (1<<1) /* fill title member */ 703#define HeadIsIndex (1<<2) /* fill isIndex member */ 704#define HeadBase (1<<3) /* fill Base member */ 705#define HeadMeta (1<<4) /* fill meta members */ 706#define HeadLink (1<<5) /* fill link members */ 707#define HeadScript (1<<6) /* fill script members */ 708#define HeadStyle (1<<7) /* fill Style members */ 709#define HeadAll ((unsigned char)~0) /* fill all members */ 710 711/***** 712* XmImage frame selection flags. 713* any positive number will return the requested frame. If larger than 714* total framecount, last frame is returned. 715*****/ 716#define AllFrames -1 /* do all frames */ 717#define FirstFrame -2 /* only use first frame */ 718#define LastFrame -3 /* only do last frame */ 719 720/***** 721* XmImage configuration flags 722*****/ 723#define ImageFSDither (1L<<1) /* Floyd-Steinberg on quantized images */ 724#define ImageCreateGC (1L<<2) /* create gc for image */ 725#define ImageWorkSpace (1L<<3) /* create animation workspace */ 726#define ImageClipmask (1L<<4) /* create clipmask */ 727#define ImageBackground (1L<<5) /* substitute background pixel */ 728#define ImageQuantize (1L<<6) /* quantize image */ 729#define ImageMaxColors (1L<<7) /* sets maximum colors */ 730#define ImageGifDecodeProc (1L<<8) /* gif lzw decoder function */ 731#define ImageGifzCmd (1L<<9) /* gif lzw uncompress command */ 732#define ImageFrameSelect (1L<<10)/* frame selection */ 733#define ImageScreenGamma (1L<<11)/* gamma correction. JPEG and PNG only */ 734 735/****************************************************************************** 736* Commonly used structures 737******************************************************************************/ 738 739/***** 740* Representation of parsed HTML elements 741*****/ 742typedef struct _XmHTMLObject{ 743 htmlEnum id; /* internal ID for this element */ 744 String element; /* element text */ 745 String attributes; /* element attributes (if any) */ 746 Boolean is_end; /* true if this is a closing element */ 747 Boolean terminated; /* true if element has closing counterpart */ 748 Cardinal line; /* line number in input for this element */ 749 struct _XmHTMLObject *next; 750 struct _XmHTMLObject *prev; 751}XmHTMLObject; 752 753/***** 754* Custom papersize definition 755*****/ 756typedef struct _XmHTMLPaperSize{ 757 unsigned char unit_type; /* unit in which dimensions are specified */ 758 unsigned char paper_type; /* type of paper: A4, US or custom */ 759 Cardinal width; /* total paper width */ 760 Cardinal height; /* total paper height */ 761 Cardinal left_margin; /* left text margin */ 762 Cardinal right_margin; /* right text margin */ 763 Cardinal top_margin; /* top text margin */ 764 Cardinal bottom_margin; /* bottom text margin */ 765}XmHTMLPaperSize; 766 767/***** 768* Definition of a HTMLTextPosition. 769* Should be considered an opaque object. 770*****/ 771typedef struct _XmHTMLTextPosition{ 772 struct _XmHTMLObjectTable *start; /* selection start */ 773 int idx; /* first word in selection start */ 774 int nwords; /* no of words in selection start */ 775 int fc; /* first char in selection start */ 776}XmHTMLTextPosition; 777 778/***** 779* The following structure is returned by the XmHTMLImageDefaultProc convenience 780* function. When a procedure for the XmNimageProc resource is installed, 781* it *must* return this structure. 782*****/ 783typedef struct _XmImageInfo 784{ 785 /* regular image fields */ 786 String url; /* original location of image */ 787 unsigned char *data; /* raw image data. ZPixmap format */ 788 unsigned char *clip; /* raw clipmask data. XYBitmap format */ 789 Dimension width; /* used image width, in pixels */ 790 Dimension height; /* used image height, in pixels */ 791 Dimension *reds; /* red image pixels */ 792 Dimension *greens; /* green image pixels */ 793 Dimension *blues; /* blue image pixels */ 794 int bg; /* transparent pixel index/type */ 795 unsigned int ncolors; /* Number of colors in the image */ 796 unsigned int options; /* image option bits */ 797 798 /* image classification fields and original data */ 799 unsigned char type; /* image type, see the IMAGE_ enum above */ 800 unsigned char depth; /* bits per pixel for this image */ 801 unsigned char colorspace; /* colorspace for this image */ 802 unsigned char transparency; /* transparency type for this image */ 803 Dimension swidth; /* image width as read from image */ 804 Dimension sheight; /* image height as read from image */ 805 unsigned int scolors; /* Original number of colors in the image */ 806 807 /* Special fields for images with an alpha channel */ 808 unsigned char *alpha; /* alpha channel data */ 809 float fg_gamma; /* image gamma */ 810 811 /* Additional animation data */ 812 int x; /* logical screen x-position for this frame */ 813 int y; /* logical screen y-position for this frame */ 814 int loop_count; /* animation loop count */ 815 unsigned char dispose; /* image disposal method */ 816 int timeout; /* frame refreshment in milliseconds */ 817 int nframes; /* no of animation frames remaining */ 818 struct _XmImageInfo *frame; /* ptr to next animation frame */ 819 820 XtPointer user_data; /* any data to be stored with this image */ 821}XmImageInfo, *XmImageInfoStruct; 822 823/* XmHTML method to load images */ 824typedef XmImageInfo* (*XmImageProc)(Widget, String, Dimension, Dimension, 825 XtPointer); 826 827/**** 828* The next two structures constitute the XmImage definition which are used by 829* the XmImageCreate and XmImageDestroy routines. Please note that the *only* 830* safe way to destroy an XmImage is to use the XmImageDestroy function. 831* XmHTML does not use the XmImage structure, it is provided for your 832* convenience. 833****/ 834/**** 835* Animation frame data. 836****/ 837typedef struct{ 838 int x; /* x position in logical screen */ 839 int y; /* y position in logical screen */ 840 int w; /* width of this particular frame */ 841 int h; /* height of this particular frame */ 842 int timeout; /* timeout for the next frame */ 843 unsigned char dispose; /* previous frame disposal method */ 844 Pixmap pixmap; /* actual image */ 845 Pixmap clip; /* image clipmask */ 846 Pixmap prev_state; /* previous screen state */ 847}XmImageFrame; 848 849/***** 850* Actual image definition. 851* If you want access to the xcc member, include the XCC.h header file. 852*****/ 853typedef struct{ 854 String file; /* originating file */ 855 unsigned char type; /* image type, see the IMAGE_ enum below */ 856 Pixmap pixmap; /* actual image */ 857 Pixmap clip; /* for transparant pixmaps */ 858 unsigned int options; /* image option bits */ 859 int width; /* current image width, in pixels */ 860 int height; /* current image height, in pixels */ 861 int ncolors; /* no of colors in this image */ 862 int scolors; /* specified no of colors */ 863 int swidth; /* image width as read from image */ 864 int sheight; /* image height as read from image */ 865 int depth; /* depth of this image */ 866 int npixels; /* no of really allocated pixels */ 867 GC gc; /* graphics context for rendering */ 868 869 /* animation data */ 870 XmImageFrame *frames; /* array of animation frames */ 871 int nframes; /* no of frames following */ 872 int current_frame; /* current frame count */ 873 int current_loop; /* current loop count */ 874 int loop_count; /* maximum loop count */ 875 XtIntervalId proc_id; /* timer id for animations */ 876 Widget w; /* image owner */ 877 XtAppContext context; /* Application context for animations */ 878 879 /* private data */ 880 struct _XColorContext *xcc; /* a lot of visual info */ 881 struct _ToolkitAbstraction *tka; 882}XmImage; 883 884/***** 885* Link member information. 886*****/ 887typedef struct 888{ 889 String url; /* value of URL tag */ 890 String rel; /* value of REL tag */ 891 String rev; /* value of REV tag */ 892 String title; /* value of TITLE tag */ 893}XmHTMLLinkDataRec, *XmHTMLLinkDataPtr; 894 895/***** 896* Meta member information. 897*****/ 898typedef struct 899{ 900 String http_equiv; /* value of HTTP-EQUIV tag */ 901 String name; /* value of NAME tag */ 902 String content; /* value of CONTENT tag */ 903}XmHTMLMetaDataRec, *XmHTMLMetaDataPtr; 904 905/***** 906* XmHTMLHeadAttributes definition 907*****/ 908typedef struct{ 909 String doctype; /* doctype data */ 910 String title; /* document title */ 911 Boolean is_index; /* true when the <isindex> element exists */ 912 String base; /* value of the <base> element */ 913 int num_meta; /* number of META info to process */ 914 XmHTMLMetaDataPtr meta; /* array of META info to process */ 915 int num_link; /* number of LINK info to process */ 916 XmHTMLLinkDataPtr link; /* array of LINK info to process */ 917 String style_type; /* value of the style type element tag */ 918 String style; /* <style></style> contents */ 919 String script_lang; /* value of the language element tag */ 920 String script; /* <script></script> contents */ 921}XmHTMLHeadAttributes; 922 923/***** 924* Document Information. 925* images and anchors contain all src and href's in a single string. Entries 926* are separated by the null char and terminated by two null chars. 927*****/ 928typedef struct{ 929 String bg_image; /* background image (if any) */ 930 String images; /* list of all images (if any) */ 931 String anchors; /* list of all anchors (excluding named) */ 932}XmHTMLDocumentInfo; 933 934/***** 935* XmHTMLFontCacheInfo definition. This structure is returned by the 936* XmHTMLGetFontCacheInfo convenience routine and contains information about 937* the font cache bound to the display of a given widget. 938* The fonts and mapping arrays are in sync: when a name in the fonts array 939* has a non-NULL entry at the corresponding position in the mapping array, 940* the value of the mapping entry is the real font being used. 941*****/ 942typedef struct{ 943 int nentries; /* total no of cached fonts */ 944 int nmaps; /* of which this many are mapped fonts */ 945 int nlookups; /* no of search actions */ 946 int nrequests; /* no of requests made */ 947 int hits; /* no of hits */ 948 int misses; /* no of misses */ 949 String *fonts; /* array of font names, size nentries */ 950 String *mapping; /* array of font mappings, size nentries */ 951 int nwidgets; /* no of widgets using this cache */ 952 WidgetList widgets; /* array of widgets */ 953}XmHTMLFontCacheInfo; 954 955/***** 956* forward declaration of XmHTMLAnchorCallback structure 957*****/ 958typedef struct _XmHTMLAnchorCallbackStruct *XmHTMLAnchorPtr; 959 960/***** 961* XmHTMLXYToInfo return value 962* This structure and any of it members may *never* be freed by the caller. 963*****/ 964typedef struct 965{ 966 Cardinal line; /* line number at selected position */ 967 Boolean is_map; /* true when clicked image is an imagemap */ 968 int x,y; /* position relative to image corner */ 969 XmImageInfo *image; /* image data */ 970 XmHTMLAnchorPtr anchor; /* possible anchor data */ 971}XmHTMLInfoStructure, *XmHTMLInfoPtr; 972 973/***** 974* XmHTML progressive object loading 975* (PLC stands for Progressive Loader Context) 976*****/ 977typedef struct _XmHTMLPLCStream{ 978 Cardinal total_in; /* no of bytes received so far */ 979 Cardinal min_out; /* minimum number of bytes requested */ 980 Cardinal max_out; /* maximum number of bytes requested */ 981 XtPointer user_data; /* any data registered on this PLC */ 982 unsigned char pad[24]; /* reserved for future use */ 983}XmHTMLPLCStream; 984 985/***** 986* External GIF decoder stream object. This is the only argument to any 987* procedure installed on the XmNdecodeGIFProc resource. 988* 989* The first block is kept up to date by XmHTML and is read-only. When state 990* is GIF_STREAM_INIT, the decoder should initialize it's private data and store 991* it in the external_state field so that it can be used for successive calls 992* to the decoder. When state is GIF_STREAM_FINAL, the decoder should wrapup 993* and flush all pending data. It can also choose to destruct it's internal 994* data structures here (another call with state set to GIF_STREAM_END will be 995* made when the internal loader is destroying it's internal objects as 996* well). 997* 998* All remaining fields are the ``public'' fields and must be updated by the 999* external decoder. The msg field can be set to an error message if the 1000* external decoder fails for some reason. XmHTML will then display this 1001* error message and abort this image. 1002*****/ 1003typedef struct _XmHTMLGIFStream{ 1004 /* read-only fields */ 1005 int state; /* decoder state */ 1006 int codesize; /* initial LZW codesize */ 1007 Boolean is_progressive; /* when used by a progressive loader */ 1008 unsigned char *next_in; /* next input byte */ 1009 Cardinal avail_in; /* number of bytes available at next_in */ 1010 Cardinal total_in; /* total nb of input bytes read so far */ 1011 1012 /* fields to be updated by caller */ 1013 unsigned char *next_out; /* next output byte should be put there */ 1014 Cardinal avail_out; /* remaining free space at next_out */ 1015 Cardinal total_out; /* total nb of bytes output so far */ 1016 1017 String msg; /* last error message, or NULL */ 1018 XtPointer external_state; /* room for decoder-specific data */ 1019}XmHTMLGIFStream; 1020 1021/* and the proto for the XmNdecodeGIFProc resource */ 1022typedef int (*XmImageGifProc)(XmHTMLGIFStream*); 1023 1024/***** 1025* Progressive Loading function prototypes. 1026* XmHTMLGetDataProc: proto for function installed on the 1027* XmNprogressiveReadProc resource; 1028* XmHTMLEndDataProc: proto for function installed on the 1029* XmNprogressiveEndProc resource; 1030*****/ 1031typedef int (*XmHTMLGetDataProc)(XmHTMLPLCStream*, XtPointer); 1032typedef void (*XmHTMLEndDataProc)(XmHTMLPLCStream*, XtPointer, int, Boolean); 1033 1034/***** 1035* possible values for the third argument on the EndDataProc 1036*****/ 1037enum{ 1038 /* XmHTML_NONE = 0 */ /* PLCObject referenced by all objects */ 1039 XmPLC_IMAGE, /* PLCObject for an image */ 1040 XmPLC_DOCUMENT, /* PLCObject for a document */ 1041 XmPLC_FINISHED /* indicates all plc's have been processed */ 1042}; 1043 1044/***** 1045* XmImage configuration 1046*****/ 1047typedef struct{ 1048 unsigned long flags; /* XmImage configuration flags, see above */ 1049 int ncolors; /* desired number of colors */ 1050 int which_frames; /* animation frames selection flag */ 1051 int bg_color; /* background pixel on transparent images */ 1052 String z_cmd; /* gif uncompress command */ 1053 XmImageGifProc gif_proc; /* external gif decoder */ 1054 float gamma; /* gamma correction. JPEG and PNG only */ 1055 struct _ToolkitAbstraction *tka; /* private data */ 1056}XmImageConfig; 1057 1058/***** 1059* HTML4.0 Event structure 1060*****/ 1061typedef struct _XmHTMLEvent{ 1062 int type; /* HTML4.0 event type, see above */ 1063 String script; /* contents of event */ 1064}XmHTMLEvent; 1065 1066/***** 1067* XmNobjectCallback tag_attributes substructure. 1068*****/ 1069typedef struct{ 1070 unsigned long flags; /* defines which fields have a value */ 1071 String attributes; /* unfiltered attributes */ 1072 1073 String classid; /* contents of the classid attribute */ 1074 String codebase; /* contents of the codebase attribute */ 1075 String data; /* location of object data */ 1076 String src; /* location of object data */ 1077 String type; /* type of object data */ 1078 String codetype; /* type of codebase */ 1079 String standby; /* message to display while loading */ 1080 String align; /* global alignment */ 1081 String halign; /* horizontal alignment */ 1082 String valign; /* vertical alignment */ 1083 int height; /* following five fields are always integers*/ 1084 int width; 1085 int border; /* border = 0: no border */ 1086 int hspace; 1087 int vspace; 1088 String usemap; /* location or name of imagemap */ 1089 String background; /* location of background image */ 1090 String bgcolor; /* name of background color */ 1091 String href; /* hyperlink reference */ 1092 String name; /* named hyperlink */ 1093 XmHTMLEvent *events; /* defined events */ 1094 int nevents; /* no of events */ 1095}XmHTMLTagAttributes; 1096 1097/***** 1098* The XmHTMLElementId and XmHTMLObjectId are opaque structures. They 1099* are fully defined in XmHTMLP.h 1100*****/ 1101typedef struct _XmHTMLParserTag *XmHTMLElementId; 1102 1103typedef struct _XmHTMLExtObj *XmHTMLObjectId; 1104 1105/****************************************************************************** 1106* Callback structures 1107* Unless explicitly mentioned, *none* of these structures (or any of its 1108* members) may be freed. 1109******************************************************************************/ 1110 1111/***** 1112* XmNactivateCallback and XmNanchorTrackCallback callback structure. 1113*****/ 1114typedef struct _XmHTMLAnchorCallbackStruct{ 1115 int reason; /* the reason the callback was called */ 1116 XEvent *event; /* event structure that triggered callback */ 1117 URLType url_type; /* type of url referenced */ 1118 Cardinal line; /* line number of the selected anchor */ 1119 String href; /* pointer to the anchor value */ 1120 String target; /* pointer to target value */ 1121 String rel; /* pointer to rel value */ 1122 String rev; /* pointer to rev value */ 1123 String title; /* pointer to title value */ 1124 Boolean is_frame; /* true when inside a frame */ 1125 Boolean doit; /* local anchor vetoing flag */ 1126 Boolean visited; /* local anchor visited flag */ 1127 Boolean doc_modified; /* Set to True when document is modified */ 1128}XmHTMLAnchorCallbackStruct; 1129 1130typedef Boolean (*XmHTMLAnchorProc)(Widget, String, XtPointer); 1131 1132/***** 1133* XmNeventCallback callback structure. 1134* 1135* Note on the doc_modified field: this field *MUST* be set to True if the 1136* processing of this event leads to a modification of the currently 1137* displayed document (XmHTMLTextSetString for example) or even destruction 1138* of the widget. It informs XmHTML of the fact that it can no longer rely on 1139* the consistency of it's internal data structures. 1140* 1141* Note on processing of the XmCR_HTML_LOAD and XmCR_HTML_UNLOAD events: 1142* processing of these events may *NEVER* cause a modification of the currently 1143* displayed document. It is a FATAL ERROR if it does change: XmHTML can no 1144* longer guarantee the consistency of it's internal data. 1145*****/ 1146typedef struct{ 1147 int reason; /* the reason the event was called */ 1148 XEvent *event; /* event triggering this action */ 1149 int type; /* HTML4.0 event type, see above */ 1150 XtPointer data; /* HTML4.0 event callback data */ 1151 Boolean doc_modified; /* Set to True when document is modified*/ 1152}XmHTMLEventCallbackStruct, *XmHTMLEventCallbackPtr; 1153 1154/***** 1155* XmNdocumentCallback callback structure. 1156*****/ 1157typedef struct 1158{ 1159 int reason; /* the reason the callback was called */ 1160 XEvent *event; /* always NULL for XmNdocumentCallback */ 1161 Boolean html32; /* True if document was HTML 3.2 conforming */ 1162 Boolean verified; /* True if document has been verified */ 1163 Boolean balanced; /* True if parser tree is balanced */ 1164 Boolean terminated; /* True if parser terminated prematurely */ 1165 int pass_level; /* current parser level count. Starts at 1 */ 1166 Boolean redo; /* perform another pass? */ 1167}XmHTMLDocumentCallbackStruct, *XmHTMLDocumentPtr; 1168 1169/***** 1170* XmNformCallback callback structure. 1171*****/ 1172/***** 1173* Form Component data 1174*****/ 1175typedef struct 1176{ 1177 componentType type; /* Form component type */ 1178 String name; /* component name */ 1179 String value; /* component value */ 1180}XmHTMLFormDataRec, *XmHTMLFormDataPtr; 1181 1182/***** 1183* Actual XmNformCallback callback structure. 1184*****/ 1185typedef struct 1186{ 1187 int reason; /* the reason the callback was called */ 1188 XEvent *event; /* event structure that triggered callback */ 1189 String action; /* URL or cgi-bin destination */ 1190 String enctype; /* form encoding */ 1191 int method; /* Form Method, GET, POST or PIPE */ 1192 int ncomponents; /* no of components in this form */ 1193 XmHTMLFormDataPtr components; 1194 Boolean doc_modified; /* Set to True when document is modified */ 1195}XmHTMLFormCallbackStruct, *XmHTMLFormPtr; 1196 1197/***** 1198* XmNframeCallback callback structure. 1199* This callback is activated when one of the following events occurs: 1200* 1. XmHTML wants to create a frame, reason = XmCR_HTML_FRAMECREATE 1201* can be veto'd by setting doit to False and supplying a HTML widget 1202* id yourself; 1203* 2. XmHTML wants to destroy a frame, reason = XmCR_HTML_FRAMEDESTROY 1204* can be veto'd by setting doit to False (widget reuse). 1205* 3. XmHTML has finished creating a frame, reason = XmCR_HTML_FRAME. 1206* This is the time to attach callbacks and set additional resources on the 1207* newly created XmHTMLWidget. 1208*****/ 1209typedef struct 1210{ 1211 int reason; /* the reason the callback was called */ 1212 XEvent *event; /* event structure that triggered callback */ 1213 String src; /* requested document */ 1214 String name; /* frame name */ 1215 Widget html; /* XmHTML widget id */ 1216 Boolean doit; /* destroy/create vetoing flag */ 1217}XmHTMLFrameCallbackStruct, *XmHTMLFramePtr; 1218 1219/***** 1220* XmNimagemapCallback callback structure. 1221* callback reasons can be one of the following: 1222* XmCR_HTML_IMAGEMAP_ACTIVATE 1223* user clicked on an image. Valid fields are x, y and image_name. x and y 1224* are relative to the upper-left corner of the image. Only invoked when 1225* an image has it's ismap attribute set and no client-side imagemap is 1226* present for this image. 1227* XmCR_HTML_IMAGEMAP 1228* an image requires an external imagemap. The only valid field is map_name 1229* which contains the location of the imagemap to fetch. If the contents 1230* of this imagemap is set in the map_contents field, it will be loaded 1231* by the widget. Alternatively, one could also use the XmHTMLAddImagemap 1232* convenience routine to set an imagemap into the widget. 1233*****/ 1234typedef struct 1235{ 1236 int reason; /* the reason the callback was called */ 1237 XEvent *event; /* event structure that triggered callback */ 1238 int x,y; /* position relative to the upper-left image corner */ 1239 String image_name; /* name of referenced image, value of src attribute */ 1240 String map_name; /* name of imagemap to fetch/referenced */ 1241 String map_contents;/* contents of fetched imagemap */ 1242 XmImageInfo *image; /* image data */ 1243}XmHTMLImagemapCallbackStruct, *XmHTMLImagemapPtr; 1244 1245/***** 1246* XmNlinkCallback callback structure. 1247*****/ 1248typedef struct{ 1249 int reason; /* the reason the callback was called */ 1250 XEvent *event; /* event structure that triggered callback */ 1251 int num_link; /* number of LINK info to process */ 1252 XmHTMLLinkDataPtr link; /* array of LINK info to process */ 1253}XmHTMLLinkCallbackStruct, *XmHTMLLinkPtr; 1254 1255/***** 1256* XmNpageCallback callback structure. 1257*****/ 1258typedef struct{ 1259 int reason; /* the reason the callback was called */ 1260 XEvent *event; /* event structure that triggered callback */ 1261 Cardinal total_pages; /* no of pages in document */ 1262}XmHTMLPageCallbackStruct, *XmHTMLPagePtr; 1263 1264/***** 1265* XmNobjectCallback callback structure. 1266*****/ 1267typedef struct{ 1268 int reason; /* the reason the callback was called */ 1269 XEvent *event; /* event structure that triggered callback */ 1270 1271 int object_id; /* id of object, set by XmHTML */ 1272 1273 int tag_id; /* HTML tag identifying an embedded object */ 1274 XtPointer tag_user_data;/* any data associated with this tag */ 1275 XmHTMLTagAttributes *attributes; 1276 /* parsed attributes, immutable */ 1277 1278 Widget parent; /* Widget id of parent. */ 1279 Widget object; 1280 Window window; 1281 1282 Boolean scrollable; /* If True, object is part of document 1283 * If False, object stays on top of document. 1284 */ 1285 Boolean wrap; /* Only used when scrollable == False. 1286 * If False, document scrolls underneath 1287 * the object. 1288 * If True, document scrolls around object. 1289 */ 1290 Boolean reparent; /* If True, XmHTML will reparent the window */ 1291 1292 XtPointer user_data; /* additional data registered for this object. 1293 * Unused by XmHTML. 1294 */ 1295 1296 /* Next two fields are only meaningfull when scrollable == False */ 1297 int x; /* suggested upper-left position */ 1298 int y; /* suggested upper-left position */ 1299 1300 Dimension width; /* suggested object width */ 1301 Dimension height; /* suggested object height */ 1302 1303 Boolean is_frame; /* true when inside a frame */ 1304 Boolean doit; /* destruct veto flag */ 1305}XmHTMLObjectCallbackStruct, *XmHTMLObjectPtr; 1306 1307/***** 1308* XmNlanguageCallback structure. 1309* The event member is always NULL. 1310* The language, country and text fields are owned by XmHTML and should never 1311* be freed. 1312* 1313* The language field specifies the requested language name, per iso639; 1314* 1315* The country field specifies the requested country, per iso3166; 1316* 1317* The ltor field indicates if XmHTML should render the text left to right 1318* (value: True) or right to left (value: False). The default is True, unless the 1319* "dir" attribute indicates right-to-left rendering; 1320* 1321* The toptobot field indicates if XmHTML should render text from top to bottom 1322* (value: True) or bottom to top (value: False). The default is True. 1323* 1324* The multibyte field indicates if the text to be rendered contains multibyte 1325* characters. It's value is True if multibyte chars have been detected. False 1326* otherwise. 1327* 1328* The text field represents a pointer to the text that is to be rendered in the 1329* specified language. This field is owned by XmHTML and may not be freed. 1330* 1331* The fontfamily[fixed] fields specify the proportional and fixed font families 1332* XmHTML intends to use for rendering text in the requested language. 1333* Can be overridden by the application. 1334* 1335* The charset field specifies the document encoding XmHTML intends to use for 1336* rendering text in the requested language. 1337* Can be overridden by the application. 1338* 1339* To override the fontFamily and charset fields, the application should provide 1340* appropriate values. The provided (default) values may *never* be freed, and 1341* XmHTML will *never* free the provided values. Simply replace the pointers. 1342* 1343* The fontset field allows one to specify a full X11 fontSet, following the 1344* X11 fontset specification rules. This field has no default, but can be provided 1345* by the application. If provided, XmHTML will use this information to create 1346* a fontset. This field is never freed by XmHTML. The x and y resolution to be 1347* used when creating the fontSet members can be deduced by requesting the values 1348* for the XmNxResolution and XmNyResolution resources. 1349* 1350* The XmNlanguageCallback is called under any of the following circumstances: 1351* - A <META> declaration with "http-equiv" set to "Content-Type" and a value set 1352* for "charset". Specifies the default document encoding; 1353* - A <META> declaration with "http-equiv" set to "Content-Type" and a value set 1354* for "language". Specifies the default document language (closely intertwined 1355* with the "charset" specification); 1356* - All terminated HTML elements (<>...</>) with a value for "lang". 1357* Specifies the language of the enclosed text. 1358*****/ 1359typedef struct{ 1360 int reason; /* the reason the callback was called */ 1361 XEvent *event; /* event structure that triggered callback */ 1362 String language; /* language name according to iso639 */ 1363 String country; /* country name according to iso3166 */ 1364 Boolean ltor; /* left to right or vice-versa rendering */ 1365 Boolean toptobot; /* top to bottom or vice-versa rendering */ 1366 Boolean multibyte; /* True if requested for multibyte text */ 1367 String text; /* text using the requested font */ 1368 String fontFamily; /* proposed proportional fontFamily */ 1369 String fontFamilyFixed; /* proposed fixed fontFamily */ 1370 String charset; /* proposed charset to be used */ 1371 String fontset; /* Full fontSet specification */ 1372}XmHTMLLanguageCallbackStruct, *XmHTMLLanguagePtr; 1373 1374/* Don't add anything after this endif! */ 1375#endif /* _HTML_h_ */ 1376