Logo ROOT   6.21/01
Reference Guide
Go to the documentation of this file.
1 // $Id: TGHtml.h,v 1.1 2007/05/04 17:07:01 brun Exp $
2 // Author: Valeriy Onuchin 03/05/2007
4 /*************************************************************************
5  * Copyright (C) 1995-2001, Rene Brun, Fons Rademakers and Reiner Rohlfs *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
12 /**************************************************************************
14  HTML widget for xclass. Based on tkhtml 1.28
15  Copyright (C) 1997-2000 D. Richard Hipp <drh@acm.org>
16  Copyright (C) 2002-2003 Hector Peraza.
18  This library is free software; you can redistribute it and/or
19  modify it under the terms of the GNU Library General Public
20  License as published by the Free Software Foundation; either
21  version 2 of the License, or (at your option) any later version.
23  This library is distributed in the hope that it will be useful,
24  but WITHOUT ANY WARRANTY; without even the implied warranty of
26  Library General Public License for more details.
28  You should have received a copy of the GNU Library General Public
29  License along with this library; if not, write to the Free
30  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32 **************************************************************************/
34 #ifndef ROOT_TGHtml
35 #define ROOT_TGHtml
37 #include "TGView.h"
39 #include "TGHtmlTokens.h"
41 class TGClient;
42 class TImage;
43 class TGFont;
44 class TGIdleHandler;
45 class THashTable;
46 class TTimer;
48 //----------------------------------------------------------------------
50 #define HTML_RELIEF_FLAT 0
54 //#define TABLE_TRIM_BLANK 1
56 // Debug must be turned on for testing to work.
57 //#define DEBUG
59 #define CANT_HAPPEN \
60  fprintf(stderr, \
61  "Unplanned behavior in the HTML Widget in file %s line %d\n", \
62  __FILE__, __LINE__)
64 #define UNTESTED \
65  fprintf(stderr, \
66  "Untested code executed in the HTML Widget in file %s line %d\n", \
67  __FILE__, __LINE__)
69 // Sanity checking macros.
71 #ifdef DEBUG
72 #define HtmlAssert(X) \
73  if(!(X)){ \
74  fprintf(stderr,"Assertion failed on line %d of %s\n",__LINE__,__FILE__); \
75  }
76 #define HtmlCantHappen \
77  fprintf(stderr,"Can't happen on line %d of %s\n",__LINE__,__FILE__);
78 #else
79 #define HtmlAssert(X)
80 #define HtmlCantHappen
81 #endif
83 // Bitmasks for the HtmlTraceMask global variable
85 #define HtmlTrace_Table1 0x00000001
86 #define HtmlTrace_Table2 0x00000002
87 #define HtmlTrace_Table3 0x00000004
88 #define HtmlTrace_Table4 0x00000008
89 #define HtmlTrace_Table5 0x00000010
90 #define HtmlTrace_Table6 0x00000020
91 #define HtmlTrace_GetLine 0x00000100
92 #define HtmlTrace_GetLine2 0x00000200
93 #define HtmlTrace_FixLine 0x00000400
94 #define HtmlTrace_BreakMarkup 0x00001000
95 #define HtmlTrace_Style 0x00002000
96 #define HtmlTrace_Input1 0x00004000
98 // The TRACE macro is used to print internal information about the
99 // HTML layout engine during testing and debugging. The amount of
100 // information printed is governed by a global variable named
101 // HtmlTraceMask. If bits in the first argument to the TRACE macro
102 // match any bits in HtmlTraceMask variable, then the trace message
103 // is printed.
104 //
105 // All of this is completely disabled, of course, if the DEBUG macro
106 // is not defined.
108 #ifdef DEBUG
109 extern int HtmlTraceMask;
110 extern int HtmlDepth;
111 # define TRACE_INDENT printf("%*s",HtmlDepth-3,"")
112 # define TRACE(Flag, Args) \
113  if( (Flag)&HtmlTraceMask ){ \
114  TRACE_INDENT; printf Args; fflush(stdout); \
115  }
116 # define TRACE_PUSH(Flag) if( (Flag)&HtmlTraceMask ){ HtmlDepth+=3; }
117 # define TRACE_POP(Flag) if( (Flag)&HtmlTraceMask ){ HtmlDepth-=3; }
118 #else
119 # define TRACE_INDENT
120 # define TRACE(Flag, Args)
121 # define TRACE_PUSH(Flag)
122 # define TRACE_POP(Flag)
123 #endif
126 //----------------------------------------------------------------------
128 // Various data types. This code is designed to run on a modern cached
129 // architecture where the CPU runs a lot faster than the memory bus. Hence
130 // we try to pack as much data into as small a space as possible so that it
131 // is more likely to fit in cache. The extra CPU instruction or two needed
132 // to unpack the data is not normally an issue since we expect the speed of
133 // the memory bus to be the limiting factor.
135 typedef unsigned char Html_u8_t; // 8-bit unsigned integer
136 typedef short Html_16_t; // 16-bit signed integer
137 typedef unsigned short Html_u16_t; // 16-bit unsigned integer
138 typedef int Html_32_t; // 32-bit signed integer
140 // An instance of the following structure is used to record style
141 // information on each Html element.
143 struct SHtmlStyle_t {
144  unsigned int fFont : 6; // Font to use for display
145  unsigned int fColor : 6; // Foreground color
146  signed int fSubscript : 4; // Positive for <sup>, negative for <sub>
147  unsigned int fAlign : 2; // Horizontal alignment
148  unsigned int fBgcolor : 6; // Background color
149  unsigned int fExpbg : 1; // Set to 1 if bgcolor explicitly set
150  unsigned int fFlags : 7; // the STY_ flags below
151 };
154 // We allow 8 different font families: Normal, Bold, Italic and Bold-Italic
155 // in either variable or constant width. Within each family there can be up
156 // to 7 font sizes from 1 (the smallest) up to 7 (the largest). Hence, the
157 // widget can use a maximum of 56 fonts. The ".font" field of the style is
158 // an integer between 0 and 55 which indicates which font to use.
160 // HP: we further subdivide the .font field into two 3-bit subfields (size
161 // and family). That makes easier to manipulate the family field.
163 #define N_FONT_FAMILY 8
164 #define N_FONT_SIZE 7
165 #define N_FONT 71
166 #define NormalFont(X) (X)
167 #define BoldFont(X) ((X) | 8)
168 #define ItalicFont(X) ((X) | 16)
169 #define CWFont(X) ((X) | 32)
170 #define FontSize(X) ((X) & 007)
171 #define FontFamily(X) ((X) & 070)
172 #define FONT_Any -1
173 #define FONT_Default 3
174 #define FontSwitch(Size, Bold, Italic, Cw) \
175  ((Size) | ((Bold+(Italic)*2+(Cw)*4) << 3))
177 // Macros for manipulating the fontValid bitmap of an TGHtml object.
179 #define FontIsValid(I) ((fFontValid[(I)>>3] & (1<<((I)&3)))!=0)
180 #define FontSetValid(I) (fFontValid[(I)>>3] |= (1<<((I)&3)))
181 #define FontClearValid(I) (fFontValid[(I)>>3] &= ~(1<<((I)&3)))
184 // Information about available colors.
185 //
186 // The widget will use at most N_COLOR colors. 4 of these colors are
187 // predefined. The rest are user selectable by options to various markups.
188 // (Ex: <font color=red>)
189 //
190 // All colors are stored in the apColor[] array of the main widget object.
191 // The ".color" field of the SHtmlStyle_t is an integer between 0 and
192 // N_COLOR-1 which indicates which of these colors to use.
194 #define N_COLOR 32 // Total number of colors
196 #define COLOR_Normal 0 // Index for normal color (black)
197 #define COLOR_Unvisited 1 // Index for unvisited hyperlinks
198 #define COLOR_Visited 2 // Color for visited hyperlinks
199 #define COLOR_Selection 3 // Background color for the selection
200 #define COLOR_Background 4 // Default background color
201 #define N_PREDEFINED_COLOR 5 // Number of predefined colors
204 // The "align" field of the style determines how text is justified
205 // horizontally. ALIGN_None means that the alignment is not specified.
206 // (It should probably default to ALIGN_Left in this case.)
208 #define ALIGN_Left 1
209 #define ALIGN_Right 2
210 #define ALIGN_Center 3
211 #define ALIGN_None 0
214 // Possible value of the "flags" field of SHtmlStyle_t are shown below.
215 //
216 // STY_Preformatted If set, the current text occurred within
217 // <pre>..</pre>
218 //
219 // STY_StrikeThru Draw a solid line thru the middle of this text.
220 //
221 // STY_Underline This text should drawn with an underline.
222 //
223 // STY_NoBreak This text occurs within <nobr>..</nobr>
224 //
225 // STY_Anchor This text occurs within <a href=X>..</a>.
226 //
227 // STY_DT This text occurs within <dt>..</dt>.
228 //
229 // STY_Invisible This text should not appear in the main HTML
230 // window. (For example, it might be within
231 // <title>..</title> or <marquee>..</marquee>.)
233 #define STY_Preformatted 0x001
234 #define STY_StrikeThru 0x002
235 #define STY_Underline 0x004
236 #define STY_NoBreak 0x008
237 #define STY_Anchor 0x010
238 #define STY_DT 0x020
239 #define STY_Invisible 0x040
240 #define STY_FontMask (STY_StrikeThru|STY_Underline)
243 //----------------------------------------------------------------------
244 // The first thing done with input HTML text is to parse it into
245 // TGHtmlElements. All sizing and layout is done using these elements.
247 // Every element contains at least this much information:
249 class TGHtmlElement : public TObject {
250 public:
251  TGHtmlElement(int etype = 0);
253  virtual int IsMarkup() const { return (fType > Html_Block); }
254  virtual const char *MarkupArg(const char * /*tag*/, const char * /*zDefault*/) { return 0; }
255  virtual int GetAlignment(int dflt) { return dflt; }
256  virtual int GetOrderedListType(int dflt) { return dflt; }
257  virtual int GetUnorderedListType(int dflt) { return dflt; }
258  virtual int GetVerticalAlignment(int dflt) { return dflt; }
260 public:
261  TGHtmlElement *fPNext; // Next input token in a list of them all
262  TGHtmlElement *fPPrev; // Previous token in a list of them all
263  SHtmlStyle_t fStyle; // The rendering style for this token
264  Html_u8_t fType; // The token type.
265  Html_u8_t fFlags; // The HTML_ flags below
266  Html_16_t fCount; // Various uses, depending on "type"
267  int fElId; // Unique identifier
268  int fOffs; // Offset within zText
269 };
272 // Bitmasks for the "flags" field of the TGHtmlElement
274 #define HTML_Visible 0x01 // This element produces "ink"
275 #define HTML_NewLine 0x02 // type == Html_Space and ends with newline
276 #define HTML_Selected 0x04 // Some or all of this Html_Block is selected
277  // Used by Html_Block elements only.
280 // Each text element holds additional information as shown here. Notice that
281 // extra space is allocated so that zText[] will be large enough to hold the
282 // complete text of the element. X and y coordinates are relative to the
283 // virtual canvas. The y coordinate refers to the baseline.
286 private:
287  TGHtmlTextElement(const TGHtmlTextElement&); // Not implemented.
288  TGHtmlTextElement &operator=(const TGHtmlTextElement&); // Not implemented.
290 public:
291  TGHtmlTextElement(int size);
292  virtual ~TGHtmlTextElement();
294  Html_32_t fY; // y coordinate where text should be rendered
295  Html_16_t fX; // x coordinate where text should be rendered
296  Html_16_t fW; // width of this token in pixels
297  Html_u8_t fAscent; // height above the baseline
298  Html_u8_t fDescent; // depth below the baseline
299  Html_u8_t fSpaceWidth; // Width of one space in the current font
300  char *fZText; // Text for this element. Null terminated
301 };
304 // Each space element is represented like this:
307 public:
308  Html_16_t fW; // Width of a single space in current font
309  Html_u8_t fAscent; // height above the baseline
310  Html_u8_t fDescent; // depth below the baseline
312 public:
314 };
316 // Most markup uses this class. Some markup extends this class with
317 // additional information, but most use it as is, at the very least.
318 //
319 // If the markup doesn't have arguments (the "count" field of
320 // TGHtmlElement is 0) then the extra "argv" field of this class
321 // is not allocated and should not be used.
324 public:
325  TGHtmlMarkupElement(int type, int argc, int arglen[], char *argv[]);
326  virtual ~TGHtmlMarkupElement();
328  virtual const char *MarkupArg(const char *tag, const char *zDefault);
329  virtual int GetAlignment(int dflt);
330  virtual int GetOrderedListType(int dflt);
331  virtual int GetUnorderedListType(int dflt);
332  virtual int GetVerticalAlignment(int dflt);
334 public://protected:
335  char **fArgv;
336 };
339 // The maximum number of columns allowed in a table. Any columns beyond
340 // this number are ignored.
342 #define HTML_MAX_COLUMNS 40
345 // This class is used for each <table> element.
346 //
347 // In the minW[] and maxW[] arrays, the [0] element is the overall
348 // minimum and maximum width, including cell padding, spacing and
349 // the "hspace". All other elements are the minimum and maximum
350 // width for the contents of individual cells without any spacing or
351 // padding.
354 public:
355  TGHtmlTable(int type, int argc, int arglen[], char *argv[]);
356  ~TGHtmlTable();
358 public:
359  Html_u8_t fBorderWidth; // Width of the border
360  Html_u8_t fNCol; // Number of columns
361  Html_u16_t fNRow; // Number of rows
362  Html_32_t fY; // top edge of table border
363  Html_32_t fH; // height of the table border
364  Html_16_t fX; // left edge of table border
365  Html_16_t fW; // width of the table border
366  int fMinW[HTML_MAX_COLUMNS+1]; // minimum width of each column
367  int fMaxW[HTML_MAX_COLUMNS+1]; // maximum width of each column
368  TGHtmlElement *fPEnd; // Pointer to the end tag element
369  TImage *fBgImage; // A background for the entire table
370  int fHasbg; // 1 if a table above has bgImage
371 };
374 // Each <td> or <th> markup is represented by an instance of the
375 // following class.
376 //
377 // Drawing for a cell is a sunken 3D border with the border width given
378 // by the borderWidth field in the associated <table> object.
381 public:
382  TGHtmlCell(int type, int argc, int arglen[], char *argv[]);
383  ~TGHtmlCell();
385 public:
386  Html_16_t fRowspan; // Number of rows spanned by this cell
387  Html_16_t fColspan; // Number of columns spanned by this cell
388  Html_16_t fX; // X coordinate of left edge of border
389  Html_16_t fW; // Width of the border
390  Html_32_t fY; // Y coordinate of top of border indentation
391  Html_32_t fH; // Height of the border
392  TGHtmlTable *fPTable; // Pointer back to the <table>
393  TGHtmlElement *fPRow; // Pointer back to the <tr>
394  TGHtmlElement *fPEnd; // Element that ends this cell
395  TImage *fBgImage; // Background for the cell
396 };
399 // This class is used for </table>, </td>, <tr>, </tr> and </th> elements.
400 // It points back to the <table> element that began the table. It is also
401 // used by </a> to point back to the original <a>. I'll probably think of
402 // other uses before all is said and done...
405 public:
406  TGHtmlRef(int type, int argc, int arglen[], char *argv[]);
407  ~TGHtmlRef();
409 public:
410  TGHtmlElement *fPOther; // Pointer to some other Html element
411  TImage *fBgImage; // A background for the entire row
412 };
415 // An instance of the following class is used to represent
416 // each <LI> markup.
419 public:
420  TGHtmlLi(int type, int argc, int arglen[], char *argv[]);
422 public:
423  Html_u8_t fLtype; // What type of list is this?
424  Html_u8_t fAscent; // height above the baseline
425  Html_u8_t fDescent; // depth below the baseline
426  Html_16_t fCnt; // Value for this element (if inside <OL>)
427  Html_16_t fX; // X coordinate of the bullet
428  Html_32_t fY; // Y coordinate of the bullet
429 };
432 // The ltype field of an TGHtmlLi or TGHtmlListStart object can take on
433 // any of the following values to indicate what type of bullet to draw.
434 // The value in TGHtmlLi will take precedence over the value in
435 // TGHtmlListStart if the two values differ.
437 #define LI_TYPE_Undefined 0 // If in TGHtmlLi, use the TGHtmlListStart value
438 #define LI_TYPE_Bullet1 1 // A solid circle
439 #define LI_TYPE_Bullet2 2 // A hollow circle
440 #define LI_TYPE_Bullet3 3 // A hollow square
441 #define LI_TYPE_Enum_1 4 // Arabic numbers
442 #define LI_TYPE_Enum_A 5 // A, B, C, ...
443 #define LI_TYPE_Enum_a 6 // a, b, c, ...
444 #define LI_TYPE_Enum_I 7 // Capitalized roman numerals
445 #define LI_TYPE_Enum_i 8 // Lower-case roman numerals
448 // An instance of this class is used for <UL> or <OL> markup.
451 public:
452  TGHtmlListStart(int type, int argc, int arglen[], char *argv[]);
454 public:
455  Html_u8_t fLtype; // One of the LI_TYPE_ defines above
456  Html_u8_t fCompact; // True if the COMPACT flag is present
457  Html_u16_t fCnt; // Next value for <OL>
458  Html_u16_t fWidth; // How much space to allow for indentation
459  TGHtmlListStart *fLPrev; // Next higher level list, or NULL
460 };
463 #define HTML_MAP_RECT 1
464 #define HTML_MAP_CIRCLE 2
465 #define HTML_MAP_POLY 3
468 public:
469  TGHtmlMapArea(int type, int argc, int arglen[], char *argv[]);
471 public:
472  int fMType;
473  int *fCoords;
474  int fNum;
475 };
478 //----------------------------------------------------------------------
480 // Structure to chain extension data onto.
483  void *fExts;
484  int fTyp;
485  int fFlags;
487 };
490 //----------------------------------------------------------------------
492 // Information about each image on the HTML widget is held in an instance
493 // of the following class. All images are held on a list attached to the
494 // main widget object.
495 //
496 // This class is NOT an element. The <IMG> element is represented by an
497 // TGHtmlImageMarkup object below. There is one TGHtmlImageMarkup for each
498 // <IMG> in the source HTML. There is one of these objects for each unique
499 // image loaded. (If two <IMG> specify the same image, there are still two
500 // TGHtmlImageMarkup objects but only one TGHtmlImage object that is shared
501 // between them.)
503 class TGHtml;
504 class TGHtmlImageMarkup;
506 class TGHtmlImage : public TObject {
507 private:
508  TGHtmlImage(const TGHtmlImage&); // Not implemented.
509  TGHtmlImage &operator=(const TGHtmlImage&); // Not implemented.
511 public:
512  TGHtmlImage(TGHtml *htm, const char *url, const char *width,
513  const char *height);
514  virtual ~TGHtmlImage();
516 public:
517  TGHtml *fHtml; // The owner of this image
518  TImage *fImage; // The image token
519  Html_32_t fW; // Requested width of this image (0 if none)
520  Html_32_t fH; // Requested height of this image (0 if none)
521  char *fZUrl; // The URL for this image.
522  char *fZWidth, *fZHeight; // Width and height in the <img> markup.
523  TGHtmlImage *fPNext; // Next image on the list
524  TGHtmlImageMarkup *fPList; // List of all <IMG> markups that use this
525  // same image
526  TTimer *fTimer; // for animations
527 };
529 // Each <img> markup is represented by an instance of the following
530 // class.
531 //
532 // If pImage == 0, then we use the alternative text in zAlt.
535 public:
536  TGHtmlImageMarkup(int type, int argc, int arglen[], char *argv[]);
538 public:
539  Html_u8_t fAlign; // Alignment. See IMAGE_ALIGN_ defines below
540  Html_u8_t fTextAscent; // Ascent of text font in force at the <IMG>
541  Html_u8_t fTextDescent; // Descent of text font in force at the <IMG>
542  Html_u8_t fRedrawNeeded; // Need to redraw this image because the image
543  // content changed.
544  Html_16_t fH; // Actual height of the image
545  Html_16_t fW; // Actual width of the image
546  Html_16_t fAscent; // How far image extends above "y"
547  Html_16_t fDescent; // How far image extends below "y"
548  Html_16_t fX; // X coordinate of left edge of the image
549  Html_32_t fY; // Y coordinate of image baseline
550  const char *fZAlt; // Alternative text
551  TGHtmlImage *fPImage; // Corresponding TGHtmlImage object
552  TGHtmlElement *fPMap; // usemap
553  TGHtmlImageMarkup *fINext; // Next markup using the same TGHtmlImage object
554 };
557 // Allowed alignments for images. These represent the allowed arguments
558 // to the "align=" field of the <IMG> markup.
560 #define IMAGE_ALIGN_Bottom 0
561 #define IMAGE_ALIGN_Middle 1
562 #define IMAGE_ALIGN_Top 2
563 #define IMAGE_ALIGN_TextTop 3
564 #define IMAGE_ALIGN_AbsMiddle 4
565 #define IMAGE_ALIGN_AbsBottom 5
566 #define IMAGE_ALIGN_Left 6
567 #define IMAGE_ALIGN_Right 7
570 // All kinds of form markup, including <INPUT>, <TEXTAREA> and <SELECT>
571 // are represented by instances of the following class.
572 //
573 // (later...) We also use this for the <APPLET> markup. That way,
574 // the window we create for an <APPLET> responds to the TGHtml::MapControls()
575 // and TGHtml::UnmapControls() function calls. For an <APPLET>, the
576 // pForm field is NULL. (Later still...) <EMBED> works just like
577 // <APPLET> so it uses this class too.
579 class TGHtmlForm;
582 public:
583  TGHtmlInput(int type, int argc, int arglen[], char *argv[]);
585  void Empty();
587 public:
588  TGHtmlForm *fPForm; // The <FORM> to which this belongs
589  TGHtmlInput *fINext; // Next element in a list of all input elements
590  TGFrame *fFrame; // The xclass window that implements this control
591  TGHtml *fHtml; // The HTML widget this control is attached to
592  TGHtmlElement *fPEnd; // End tag for <TEXTAREA>, etc.
593  Html_u16_t fInpId; // Unique id for this element
594  Html_u16_t fSubId; // For radio - an id, for select - option count
595  Html_32_t fY; // Baseline for this input element
596  Html_u16_t fX; // Left edge
597  Html_u16_t fW, fH; // Width and height of this control
598  Html_u8_t fPadLeft; // Extra padding on left side of the control
599  Html_u8_t fAlign; // One of the IMAGE_ALIGN_xxx types
600  Html_u8_t fTextAscent; // Ascent for the current font
601  Html_u8_t fTextDescent; // descent for the current font
602  Html_u8_t fItype; // What type of input is this?
603  Html_u8_t fSized; // True if this input has been sized already
604  Html_u16_t fCnt; // Used to derive widget name. 0 if no widget
605 };
608 // An input control can be one of the following types. See the
609 // comment about <APPLET> on the TGHtmlInput class insight into
610 // INPUT_TYPE_Applet.
612 #define INPUT_TYPE_Unknown 0
613 #define INPUT_TYPE_Checkbox 1
614 #define INPUT_TYPE_File 2
615 #define INPUT_TYPE_Hidden 3
616 #define INPUT_TYPE_Image 4
617 #define INPUT_TYPE_Password 5
618 #define INPUT_TYPE_Radio 6
619 #define INPUT_TYPE_Reset 7
620 #define INPUT_TYPE_Select 8
621 #define INPUT_TYPE_Submit 9
622 #define INPUT_TYPE_Text 10
623 #define INPUT_TYPE_TextArea 11
624 #define INPUT_TYPE_Applet 12
625 #define INPUT_TYPE_Button 13
628 // There can be multiple <FORM> entries on a single HTML page.
629 // Each one must be given a unique number for identification purposes,
630 // and so we can generate unique state variable names for radiobuttons,
631 // checkbuttons, and entry boxes.
634 public:
635  TGHtmlForm(int type, int argc, int arglen[], char *argv[]);
637 public:
638  Html_u16_t fFormId; // Unique number assigned to this form
639  unsigned int fElements; // Number of elements
640  unsigned int fHasctl; // Has controls
641  TGHtmlElement *fPFirst; // First form element
642  TGHtmlElement *fPEnd; // Pointer to end tag element
643 };
646 // Information used by a <HR> markup
649 public:
650  TGHtmlHr(int type, int argc, int arglen[], char *argv[]);
652 public:
653  Html_32_t fY; // Baseline for this input element
654  Html_u16_t fX; // Left edge
655  Html_u16_t fW, fH; // Width and height of this control
656  Html_u8_t fIs3D; // Is it drawn 3D?
657 };
660 // Information used by a <A> markup
663 public:
664  TGHtmlAnchor(int type, int argc, int arglen[], char *argv[]);
666 public:
667  Html_32_t fY; // Top edge for this element
668 };
671 // Information about the <SCRIPT> markup. The parser treats <SCRIPT>
672 // specially. All text between <SCRIPT> and </SCRIPT> is captured and
673 // is indexed to by the nStart field of this class.
674 //
675 // The nStart field indexs to a spot in the zText field of the TGHtml object.
676 // The nScript field determines how long the script is.
679 public:
680  TGHtmlScript(int type, int argc, int arglen[], char *argv[]);
682 public:
683  int fNStart; // Start of the script (index into TGHtml::zText)
684  int fNScript; // Number of characters of text in zText holding
685  // the complete text of this script
686 };
689 // A block is a single unit of display information. This can be one or more
690 // text elements, or the border of table, or an image, etc.
691 //
692 // Blocks are used to improve display speed and to improve the speed of
693 // linear searchs through the token list. A single block will typically
694 // contain enough information to display a dozen or more Text and Space
695 // elements all with a single call to OXFont::DrawChars(). The blocks are
696 // linked together on their own list, so we can search them much faster than
697 // elements (since there are fewer of them.)
698 //
699 // Of course, you can construct pathological HTML that has as many Blocks as
700 // it has normal tokens. But you haven't lost anything. Using blocks just
701 // speeds things up in the common case.
702 //
703 // Much of the information needed for display is held in the original
704 // TGHtmlElement objects. "fPNext" points to the first object in the list
705 // which can be used to find the "style" "x" and "y".
706 //
707 // If n is zero, then "fPNext" might point to a special TGHtmlElement
708 // that defines some other kind of drawing, like <LI> or <IMG> or <INPUT>.
710 class TGHtmlBlock : public TGHtmlElement {
711 public:
712  TGHtmlBlock();
713  virtual ~TGHtmlBlock();
715 public:
716  char *fZ; // Space to hold text when n > 0
717  int fTop, fBottom; // Extremes of y coordinates
718  Html_u16_t fLeft, fRight; // Left and right boundry of this object
719  Html_u16_t fN; // Number of characters in z[]
720  TGHtmlBlock *fBPrev, *fBNext; // Linked list of all Blocks
721 };
724 // A stack of these structures is used to keep track of nested font and
725 // style changes. This allows us to easily revert to the previous style
726 // when we encounter and end-tag like </em> or </h3>.
727 //
728 // This stack is used to keep track of the current style while walking
729 // the list of elements. After all elements have been assigned a style,
730 // the information in this stack is no longer used.
733  SHtmlStyleStack_t *fPNext; // Next style on the stack
734  int fType; // A markup that ends this style. Ex: Html_EndEM
735  SHtmlStyle_t fStyle; // The currently active style.
736 };
739 // A stack of the following structures is used to remember the
740 // left and right margins within a layout context.
743  int fIndent; // Size of the current margin
744  int fBottom; // Y value at which this margin expires
745  int fTag; // Markup that will cancel this margin
746  SHtmlMargin_t *fPNext; // Previous margin
747 };
750 // How much space (in pixels) used for a single level of indentation due
751 // to a <UL> or <DL> or <BLOCKQUOTE>, etc.
753 #define HTML_INDENT 36
756 //----------------------------------------------------------------------
758 // A layout context holds all state information used by the layout engine.
760 class TGHtmlLayoutContext : public TObject {
761 public:
764  void LayoutBlock();
765  void Reset();
767  void PopIndent();
768  void PushIndent();
770 protected:
771  void PushMargin(SHtmlMargin_t **ppMargin, int indent, int bottom, int tag);
772  void PopOneMargin(SHtmlMargin_t **ppMargin);
773  void PopMargin(SHtmlMargin_t **ppMargin, int tag);
774  void PopExpiredMargins(SHtmlMargin_t **ppMarginStack, int y);
775  void ClearMarginStack(SHtmlMargin_t **ppMargin);
778  int width, int minX, int *actualWidth);
780  void FixAnchors(TGHtmlElement *p, TGHtmlElement *pEnd, int y);
781  int FixLine(TGHtmlElement *pStart, TGHtmlElement *pEnd,
782  int bottom, int width, int actualWidth, int leftMargin,
783  int *maxX);
784  void Paragraph(TGHtmlElement *p);
785  void ComputeMargins(int *pX, int *pY, int *pW);
786  void ClearObstacle(int mode);
788  int InWrapAround();
789  void WidenLine(int reqWidth, int *pX, int *pY, int *pW);
793 public:
794  TGHtml *fHtml; // The html widget undergoing layout
795  TGHtmlElement *fPStart; // Start of elements to layout
796  TGHtmlElement *fPEnd; // Stop when reaching this element
797  int fHeadRoom; // Extra space wanted above this line
798  int fTop; // Absolute top of drawing area
799  int fBottom; // Bottom of previous line
800  int fLeft, fRight; // Left and right extremes of drawing area
801  int fPageWidth; // Width of the layout field, including
802  // the margins
803  int fMaxX, fMaxY; // Maximum X and Y values of paint
804  SHtmlMargin_t *fLeftMargin; // Stack of left margins
805  SHtmlMargin_t *fRightMargin; // Stack of right margins
806 };
809 // With 28 different fonts and 16 colors, we could in principle have
810 // as many as 448 different GCs. But in practice, a single page of
811 // HTML will typically have much less than this. So we won't try to
812 // keep all GCs on hand. Instead, we'll keep around the most recently
813 // used GCs and allocate new ones as necessary.
814 //
815 // The following structure is used to build a cache of GCs in the
816 // main widget object.
818 #define N_CACHE_GC 32
820 struct GcCache_t {
821  GContext_t fGc; // The graphics context
822  Html_u8_t fFont; // Font used for this context
823  Html_u8_t fColor; // Color used for this context
824  Html_u8_t fIndex; // Index used for LRU replacement
825 };
828 // An SHtmlIndex_t is a reference to a particular character within a
829 // particular Text or Space token.
831 struct SHtmlIndex_t {
832  TGHtmlElement *fP; // The token containing the character
833  int fI; // Index of the character
834 };
837 // Used by the tokenizer
840  const char *fZName; // Name of a markup
841  Html_16_t fType; // Markup type code
842  Html_16_t fObjType; // Which kind of TGHtml... object to alocate
843  SHtmlTokenMap_t *fPCollide; // Hash table collision chain
844 };
847 // Markup element types to be allocated by the tokenizer.
848 // Do not confuse with .type field in TGHtmlElement
850 #define O_HtmlMarkupElement 0
851 #define O_HtmlCell 1
852 #define O_HtmlTable 2
853 #define O_HtmlRef 3
854 #define O_HtmlLi 4
855 #define O_HtmlListStart 5
856 #define O_HtmlImageMarkup 6
857 #define O_HtmlInput 7
858 #define O_HtmlForm 8
859 #define O_HtmlHr 9
860 #define O_HtmlAnchor 10
861 #define O_HtmlScript 11
862 #define O_HtmlMapArea 12
865 //----------------------------------------------------------------------
867 // The HTML widget. A derivate of TGView.
869 class TGListBox;
870 class THashTable;
872 class TGHtml : public TGView {
873 public:
874  TGHtml(const TGWindow *p, int w, int h, int id = -1);
875  virtual ~TGHtml();
877  virtual Bool_t HandleFocusChange(Event_t *event);
878  virtual Bool_t HandleButton(Event_t *event);
879  virtual Bool_t HandleMotion(Event_t *event);
882  virtual Bool_t HandleTimer(TTimer *timer);
886  virtual void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h);
887  virtual Bool_t ItemLayout();
892 public: // user commands
894  int ParseText(char *text, const char *index = 0);
896  void SetTableRelief(int relief);
897  int GetTableRelief() const { return fTableRelief; }
899  void SetRuleRelief(int relief);
900  int GetRuleRelief() const { return fRuleRelief; }
901  int GetRulePadding() const { return fRulePadding; }
903  void UnderlineLinks(int onoff);
905  void SetBaseUri(const char *uri);
906  const char *GetBaseUri() const { return fZBase; }
908  int GotoAnchor(const char *name);
910 public: // reloadable methods
912  // called when the widget is cleared
913  virtual void Clear(Option_t * = "");
915  // User function to resolve URIs
916  virtual char *ResolveUri(const char *uri);
918  // User function to get an image from a URL
919  virtual TImage *LoadImage(const char *uri, int w = 0, int h = 0) ;//
920  // { return 0; }
922  // User function to tell if a hyperlink has already been visited
923  virtual int IsVisited(const char * /*url*/)
924  { return kFALSE; }
926  // User function to process tokens of the given type
927  virtual int ProcessToken(TGHtmlElement * /*pElem*/, const char * /*name*/, int /*type*/)
928  { return kFALSE; }
930  virtual TGFont *GetFont(int iFont);
932  // The HTML parser will invoke the following methods from time
933  // to time to find out information it needs to complete formatting of
934  // the document.
936  // Method for handling <frameset> markup
937  virtual int ProcessFrame()
938  { return kFALSE; }
940  // Method to process applets
941  virtual TGFrame *ProcessApplet(TGHtmlInput * /*input*/)
942  { return 0; }
944  // Called when parsing forms
945  virtual int FormCreate(TGHtmlForm * /*form*/, const char * /*zUrl*/, const char * /*args*/)
946  { return kFALSE; }
948  // Called when user presses Submit
949  virtual int FormAction(TGHtmlForm * /*form*/, int /*id*/)
950  { return kFALSE; }
952  // Invoked to find font names
953  virtual char *GetFontName()
954  { return 0; }
956  // Invoked for each <SCRIPT> markup
957  virtual char *ProcessScript(TGHtmlScript * /*script*/)
958  { return 0; }
960 public:
961  const char *GetText() const { return fZText; }
963  int GetMarginWidth() { return fMargins.fL + fMargins.fR; }
964  int GetMarginHeight() { return fMargins.fT + fMargins.fB; }
966  TGHtmlInput *GetInputElement(int x, int y);
967  const char *GetHref(int x, int y, const char **target = 0);
971  int InArea(TGHtmlMapArea *p, int left, int top, int x, int y);
972  TGHtmlElement *GetMap(const char *name);
975  int ElementCoords(TGHtmlElement *p, int i, int pct, int *coords);
977  TGHtmlElement *TableDimensions(TGHtmlTable *pStart, int lineWidth);
978  int CellSpacing(TGHtmlElement *pTable);
979  void MoveVertically(TGHtmlElement *p, TGHtmlElement *pLast, int dy);
983  char *GetTokenName(TGHtmlElement *p);
984  char *DumpToken(TGHtmlElement *p);
986  void EncodeText(TGString *str, const char *z);
988 protected:
989  void HClear();
990  void ClearGcCache();
991  void ResetLayoutContext();
992  void Redraw();
993  void ComputeVirtualSize();
995  void ScheduleRedraw();
997  void RedrawArea(int left, int top, int right, int bottom);
998  void RedrawBlock(TGHtmlBlock *p);
999  void RedrawEverything();
1000  void RedrawText(int y);
1002  float ColorDistance(ColorStruct_t *pA, ColorStruct_t *pB);
1003  int IsDarkColor(ColorStruct_t *p);
1004  int IsLightColor(ColorStruct_t *p);
1005  int GetColorByName(const char *zColor);
1006  int GetDarkShadowColor(int iBgColor);
1007  int GetLightShadowColor(int iBgColor);
1008  int GetColorByValue(ColorStruct_t *pRef);
1010  void FlashCursor();
1012  GContext_t GetGC(int color, int font);
1013  GContext_t GetAnyGC();
1015  void AnimateImage(TGHtmlImage *image);
1016  void ImageChanged(TGHtmlImage *image, int newWidth, int newHeight);
1018  int GetImageAt(int x, int y);
1019  const char *GetPctWidth(TGHtmlElement *p, char *opt, char *ret);
1020  void TableBgndImage(TGHtmlElement *p);
1023  void UnlinkAndFreeBlock(TGHtmlBlock *pBlock);
1024  void AppendBlock(TGHtmlElement *pToken, TGHtmlBlock *pBlock);
1026  void StringHW(const char *str, int *h, int *w);
1027  TGHtmlElement *MinMax(TGHtmlElement *p, int *pMin, int *pMax,
1028  int lineWidth, int hasbg);
1031  int x, int y);
1032  void DrawRect(Drawable_t drawable, TGHtmlElement *src,
1033  int x, int y, int w, int h, int depth, int relief);
1034  void BlockDraw(TGHtmlBlock *pBlock, Drawable_t wid,
1035  int left, int top,
1036  int width, int height, Pixmap_t pixmap);
1037  void DrawImage(TGHtmlImageMarkup *image, Drawable_t wid,
1038  int left, int top,
1039  int right, int bottom);
1040  void DrawTableBgnd(int x, int y, int w, int h, Drawable_t d, TImage *image);
1043  void FormBlocks();
1045  void AppendElement(TGHtmlElement *pElem);
1046  int Tokenize();
1047  void AppToken(TGHtmlElement *pNew, TGHtmlElement *p, int offs);
1048  TGHtmlMarkupElement *MakeMarkupEntry(int objType, int type, int argc,
1049  int arglen[], char *argv[]);
1050  void TokenizerAppend(const char *text);
1052  char *zType, char *zArgs, int offs);
1053  SHtmlTokenMap_t *NameToPmap(char *zType);
1054  int NameToType(char *zType);
1055  const char *TypeToName(int type);
1056  int TextInsertCmd(int argc, char **argv);
1059  TGHtmlElement *TokenByIndex(int N, int flag);
1060  int TokenNumber(TGHtmlElement *p);
1062  void MaxIndex(TGHtmlElement *p, int *pIndex, int isLast);
1063  int IndexMod(TGHtmlElement **pp, int *ip, char *cp);
1064  void FindIndexInBlock(TGHtmlBlock *pBlock, int x,
1065  TGHtmlElement **ppToken, int *pIndex);
1066  void IndexToBlockIndex(SHtmlIndex_t sIndex,
1067  TGHtmlBlock **ppBlock, int *piIndex);
1068  int DecodeBaseIndex(const char *zBase,
1069  TGHtmlElement **ppToken, int *pIndex);
1070  int GetIndex(const char *zIndex, TGHtmlElement **ppToken, int *pIndex);
1072  void LayoutDoc();
1074  int MapControls();
1075  void UnmapControls();
1076  void DeleteControls();
1077  int ControlSize(TGHtmlInput *p);
1078  void SizeAndLink(TGFrame *frame, TGHtmlInput *pElem);
1079  int FormCount(TGHtmlInput *p, int radio);
1080  void AddFormInfo(TGHtmlElement *p);
1082  void AppendText(TGString *str, TGHtmlElement *pFirst, TGHtmlElement *pEnd);
1084  void UpdateSelection(int forceUpdate);
1085  void UpdateSelectionDisplay();
1086  void LostSelection();
1087  int SelectionSet(const char *startIx, const char *endIx);
1088  void UpdateInsert();
1089  int SetInsert(const char *insIx);
1091  const char *GetUid(const char *string);
1092  ColorStruct_t *AllocColor(const char *name);
1094  void FreeColor(ColorStruct_t *color);
1097  void PushStyleStack(int tag, SHtmlStyle_t style);
1098  SHtmlStyle_t PopStyleStack(int tag);
1100  void MakeInvisible(TGHtmlElement *p_first, TGHtmlElement *p_last);
1101  int GetLinkColor(const char *zURL);
1102  void AddStyle(TGHtmlElement *p);
1103  void Sizer();
1105  int NextMarkupType(TGHtmlElement *p);
1107  TGHtmlElement *AttrElem(const char *name, char *value);
1109 public:
1110  void AppendArglist(TGString *str, TGHtmlMarkupElement *pElem);
1113  TGString *TableText(TGHtmlTable *pTable, int flags);
1115  virtual void MouseOver(const char *uri) { Emit("MouseOver(const char *)",uri); } // *SIGNAL*
1116  virtual void MouseDown(const char *uri) { Emit("MouseDown(const char *)",uri); } // *SIGNAL*
1117  virtual void ButtonClicked(const char *name, const char *val); // *SIGNAL*
1118  virtual void SubmitClicked(const char *val); // *SIGNAL*
1119  virtual void CheckToggled(const char *name, Bool_t on, const char *val); // *SIGNAL*
1120  virtual void RadioChanged(const char *name, const char *val); // *SIGNAL*
1121  virtual void InputSelected(const char *name, const char *val); //*SIGNAL*
1122  virtual void SavePrimitive(std::ostream &out, Option_t * = "");
1124 protected:
1125  virtual void UpdateBackgroundStart();
1127 protected:
1128  TGHtmlElement *fPFirst; // First HTML token on a list of them all
1129  TGHtmlElement *fPLast; // Last HTML token on the list
1130  int fNToken; // Number of HTML tokens on the list.
1131  // Html_Block tokens don't count.
1132  TGHtmlElement *fLastSized; // Last HTML element that has been sized
1133  TGHtmlElement *fNextPlaced; // Next HTML element that needs to be
1134  // positioned on canvas.
1135  TGHtmlBlock *fFirstBlock; // List of all TGHtmlBlock tokens
1136  TGHtmlBlock *fLastBlock; // Last TGHtmlBlock in the list
1137  TGHtmlInput *fFirstInput; // First <INPUT> element
1138  TGHtmlInput *fLastInput; // Last <INPUT> element
1139  int fNInput; // The number of <INPUT> elements
1140  int fNForm; // The number of <FORM> elements
1141  int fVarId; // Used to construct a unique name for a
1142  // global array used by <INPUT> elements
1143  int fInputIdx; // Unique input index
1144  int fRadioIdx; // Unique radio index
1146  // Information about the selected region of text
1148  SHtmlIndex_t fSelBegin; // Start of the selection
1149  SHtmlIndex_t fSelEnd; // End of the selection
1150  TGHtmlBlock *fPSelStartBlock; // Block in which selection starts
1151  Html_16_t fSelStartIndex; // Index in pSelStartBlock of first selected
1152  // character
1153  Html_16_t fSelEndIndex; // Index of last selecte char in pSelEndBlock
1154  TGHtmlBlock *fPSelEndBlock; // Block in which selection ends
1156  // Information about the insertion cursor
1158  int fInsOnTime; // How long the cursor states one (millisec)
1159  int fInsOffTime; // How long it is off (milliseconds)
1160  int fInsStatus; // Is it visible?
1161  TTimer *fInsTimer; // Timer used to flash the insertion cursor
1162  SHtmlIndex_t fIns; // The insertion cursor position
1163  TGHtmlBlock *fPInsBlock; // The TGHtmlBlock containing the cursor
1164  int fInsIndex; // Index in pInsBlock of the cursor
1166  // The following fields hold state information used by the tokenizer.
1168  char *fZText; // Complete text of the unparsed HTML
1169  int fNText; // Number of characters in zText
1170  int fNAlloc; // Space allocated for zText
1171  int fNComplete; // How much of zText has actually been
1172  // converted into tokens
1173  int fICol; // The column in which zText[nComplete]
1174  // occurs. Used to resolve tabs in input
1175  int fIPlaintext; // If not zero, this is the token type that
1176  // caused us to go into plaintext mode. One
1177  // of Html_PLAINTEXT, Html_LISTING or
1178  // Html_XMP
1179  TGHtmlScript *fPScript; // <SCRIPT> currently being parsed
1183  // These fields hold state information used by the HtmlAddStyle routine.
1184  // We have to store this state information here since HtmlAddStyle
1185  // operates incrementally. This information must be carried from
1186  // one incremental execution to the next.
1188  SHtmlStyleStack_t *fStyleStack; // The style stack
1189  int fParaAlignment; // Justification associated with <p>
1190  int fRowAlignment; // Justification associated with <tr>
1191  int fAnchorFlags; // Style flags associated with <A>...</A>
1192  int fInDt; // Style flags associated with <DT>...</DT>
1193  int fInTr; // True if within <tr>..</tr>
1194  int fInTd; // True if within <td>..</td> or <th>..</th>
1195  TGHtmlAnchor *fAnchorStart; // Most recent <a href=...>
1196  TGHtmlForm *fFormStart; // Most recent <form>
1197  TGHtmlInput *fFormElemStart; // Most recent <textarea> or <select>
1198  TGHtmlInput *fFormElemLast; // Most recent <input>, <textarea> or <select>
1199  TGHtmlListStart *fInnerList; // The inner most <OL> or <UL>
1200  TGHtmlElement *fLoEndPtr; // How far AddStyle has gone to
1201  TGHtmlForm *fLoFormStart; // For AddStyle
1203  // These fields are used to hold the state of the layout engine.
1204  // Because the layout is incremental, this state must be held for
1205  // the life of the widget.
1209  // Information used when displaying the widget:
1211  int fHighlightWidth; // Width in pixels of highlight to draw
1212  // around widget when it has the focus.
1213  // <= 0 means don't draw a highlight.
1214  TGInsets fMargins; // document margins (separation between the
1215  // edge of the clip window and rendered HTML).
1216  ColorStruct_t *fHighlightBgColorPtr; // Color for drawing traversal highlight
1217  // area when highlight is off.
1218  ColorStruct_t *fHighlightColorPtr; // Color for drawing traversal highlight.
1219  TGFont *fAFont[N_FONT]; // Information about all screen fonts
1220  char fFontValid[(N_FONT+7)/8]; // If bit N%8 of work N/8 of this field is 0
1221  // if aFont[N] needs to be reallocated before
1222  // being used.
1223  ColorStruct_t *fApColor[N_COLOR]; // Information about all colors
1224  Long_t fColorUsed; // bit N is 1 if color N is in use. Only
1225  // applies to colors that aren't predefined
1226  int fIDark[N_COLOR]; // Dark 3D shadow of color K is iDark[K]
1227  int fILight[N_COLOR]; // Light 3D shadow of color K is iLight[K]
1228  ColorStruct_t *fBgColor; // Background color of the HTML document
1229  ColorStruct_t *fFgColor; // Color of normal text. apColor[0]
1230  ColorStruct_t *fNewLinkColor; // Color of unvisitied links. apColor[1]
1231  ColorStruct_t *fOldLinkColor; // Color of visitied links. apColor[2]
1232  ColorStruct_t *fSelectionColor; // Background color for selections
1233  GcCache_t fAGcCache[N_CACHE_GC]; // A cache of GCs for general use
1235  int fLastGC; // Index of recently used GC
1236  TGHtmlImage *fImageList; // A list of all images
1237  TImage *fBgImage; // Background image
1239  int fFormPadding; // Amount to pad form elements by
1240  int fOverrideFonts; // TRUE if we should override fonts
1241  int fOverrideColors; // TRUE if we should override colors
1242  int fUnderlineLinks; // TRUE if we should underline hyperlinks
1243  int fHasScript; // TRUE if we can do scripts for this page
1244  int fHasFrames; // TRUE if we can do frames for this page
1245  int fAddEndTags; // TRUE if we add /LI etc.
1246  int fTableBorderMin; // Force tables to have min border size
1247  int fVarind; // Index suffix for unique global var name
1249  // Information about the selection
1251  int fExportSelection; // True if the selection is automatically
1252  // exported to the clipboard
1254  // Miscellaneous information:
1256  int fTableRelief; // 3d effects on <TABLE>
1257  int fRuleRelief; // 3d effects on <HR>
1258  int fRulePadding; // extra pixels above and below <HR>
1259  const char *fZBase; // The base URI
1260  char *fZBaseHref; // zBase as modified by <BASE HREF=..> markup
1261  Cursor_t fCursor; // Current cursor for window, or None.
1262  int fMaxX, fMaxY; // Maximum extent of any "paint" that appears
1263  // on the virtual canvas. Used to compute
1264  // scrollbar positions.
1265  int fDirtyLeft, fDirtyTop; // Top left corner of region to redraw. These
1266  // are physical screen coordinates relative to
1267  // the clip win, not main window.
1268  int fDirtyRight, fDirtyBottom; // Bottom right corner of region to redraw
1269  int fFlags; // Various flags; see below for definitions.
1270  int fIdind;
1271  int fInParse; // Prevent update if parsing
1272  char *fZGoto; // Label to goto right after layout
1274  SHtmlExtensions_t *fExts; // Pointer to user extension data
1276  THashTable *fUidTable; // Hash table for some used string values
1277  // like color names, etc.
1278  const char *fLastUri; // Used in HandleMotion
1279  int fExiting; // True if the widget is being destroyed
1281  ClassDef(TGHtml, 0); // HTML widget
1282 };
1285 // Flag bits "flags" field of the Html widget:
1286 //
1287 // REDRAW_PENDING An idle handler has already been queued to
1288 // call the TGHtml::Redraw() method.
1289 //
1290 // GOT_FOCUS This widget currently has input focus.
1291 //
1292 // HSCROLL Horizontal scrollbar position needs to be
1293 // recomputed.
1294 //
1295 // VSCROLL Vertical scrollbar position needs to be
1296 // recomputed.
1297 //
1298 // RELAYOUT We need to reposition every element on the
1299 // virtual canvas. (This happens, for example,
1300 // when the size of the widget changes and we
1301 // need to recompute the line breaks.)
1302 //
1303 // RESIZE_ELEMENTS We need to recompute the size of every element.
1304 // This happens, for example, when the fonts
1305 // change.
1306 //
1307 // REDRAW_FOCUS We need to repaint the focus highlight border.
1308 //
1309 // REDRAW_TEXT Everything in the clipping window needs to be redrawn.
1310 //
1311 // STYLER_RUNNING There is a call to HtmlAddStyle() in process.
1312 // Used to prevent a recursive call to HtmlAddStyle().
1313 //
1314 // INSERT_FLASHING True if there is a timer scheduled that will toggle
1315 // the state of the insertion cursor.
1316 //
1317 // REDRAW_IMAGES One or more TGHtmlImageMarkup objects have their
1318 // redrawNeeded flag set.
1320 #define REDRAW_PENDING 0x000001
1321 #define GOT_FOCUS 0x000002
1322 #define HSCROLL 0x000004
1323 #define VSCROLL 0x000008
1324 #define RELAYOUT 0x000010
1325 #define RESIZE_ELEMENTS 0x000020
1326 #define REDRAW_FOCUS 0x000040
1327 #define REDRAW_TEXT 0x000080
1328 #define EXTEND_LAYOUT 0x000100
1329 #define STYLER_RUNNING 0x000200
1330 #define INSERT_FLASHING 0x000400
1331 #define REDRAW_IMAGES 0x000800
1332 #define ANIMATE_IMAGES 0x001000
1335 // Macros to set, clear or test bits of the "flags" field.
1337 #define HtmlHasFlag(A,F) (((A)->flags&(F))==(F))
1338 #define HtmlHasAnyFlag(A,F) (((A)->flags&(F))!=0)
1339 #define HtmlSetFlag(A,F) ((A)->flags|=(F))
1340 #define HtmlClearFlag(A,F) ((A)->flags&=~(F))
1343 // No coordinate is ever as big as this number
1345 #define LARGE_NUMBER 100000000
1348 // Default values for configuration options
1352 #define DEF_HTML_EXPORT_SEL 1
1357 #define DEF_HTML_INSERT_OFF_TIME 300
1358 #define DEF_HTML_INSERT_ON_TIME 600
1359 #define DEF_HTML_PADX (HTML_INDENT / 4)
1360 #define DEF_HTML_PADY (HTML_INDENT / 4)
1361 #define DEF_HTML_RELIEF "raised"
1362 #define DEF_HTML_SELECTION_COLOR "skyblue"
1363 #define DEF_HTML_TAKE_FOCUS "0"
1364 #define DEF_HTML_UNVISITED "blue2"
1365 #define DEF_HTML_VISITED "purple4"
1369 #define DEF_HTML_TABLE_BORDER "0"
1373 #define DEF_HTML_TABLE_BORDER_DARK_COLOR "gray40"
1375 #endif // NAVIGATOR_TABLES
1378 //----------------------------------------------------------------------
1380 // Messages generated by the HTML widget
1381 /*
1382 class TGHtmlMessage : public OWidgetMessage {
1383 public:
1384  TGHtmlMessage(int t, int a, int i, const char *u, int rx, int ry) :
1385  OWidgetMessage(t, a, i) {
1386  uri = u;
1387  x_root = rx;
1388  y_root = ry;
1389  }
1391 public:
1392  const char *uri;
1393  //ORectangle bbox;
1394  int x_root, y_root;
1395 };
1396 */
1398 #endif // ROOT_TGHtml
Html_32_t fY
Definition: TGHtml.h:362
TGHtmlForm * fFormStart
Definition: TGHtml.h:1196
SHtmlIndex_t fSelBegin
Definition: TGHtml.h:1148
int fParaAlignment
Definition: TGHtml.h:1189
unsigned int fHasctl
Definition: TGHtml.h:640
TImage * fBgImage
Definition: TGHtml.h:395
int fDirtyBottom
Definition: TGHtml.h:1268
Long_t fColorUsed
Definition: TGHtml.h:1224
TGHtmlElement * GetLine(TGHtmlElement *pStart, TGHtmlElement *pEnd, int width, int minX, int *actualWidth)
This routine gathers as many tokens as will fit on one line.
virtual int FormCreate(TGHtmlForm *, const char *, const char *)
Definition: TGHtml.h:945
TGHtmlBlock * fPSelStartBlock
Definition: TGHtml.h:1150
int fILight[N_COLOR]
Definition: TGHtml.h:1227
char * fZHeight
Definition: TGHtml.h:522
virtual void InputSelected(const char *name, const char *val)
Emit Selected() signal.
Definition: TGHtml.cxx:1314
void UpdateInsert()
Recompute the position of the insertion cursor based on the position in fIns.
Definition: TGHtml.cxx:2025
TGString * TableText(TGHtmlTable *pTable, int flags)
Return text and images from a table as lists.
TGHtmlInput(int type, int argc, int arglen[], char *argv[])
HTML input element constructor.
Html_16_t fX
Definition: TGHtml.h:427
TGHtml * fHtml
Definition: TGHtml.h:794
Html_u16_t fNRow
Definition: TGHtml.h:361
void TokenizerAppend(const char *text)
Append text to the tokenizer engine.
int fRulePadding
Definition: TGHtml.h:1258
char * fZ
Definition: TGHtml.h:716
Html_u8_t fLtype
Definition: TGHtml.h:455
#define N_FONT
Definition: TGHtml.h:165
TImage * fBgImage
Definition: TGHtml.h:411
void RedrawBlock(TGHtmlBlock *p)
Redraw the TGHtmlBlock given.
Definition: TGHtml.cxx:854
int fExportSelection
Definition: TGHtml.h:1251
Html_u8_t fAscent
Definition: TGHtml.h:309
unsigned int fColor
Definition: TGHtml.h:145
TGHtmlElement * fP
Definition: TGHtml.h:832
Definition: TGView.h:43
TGHtmlListStart * fLPrev
Definition: TGHtml.h:459
void PrintList(TGHtmlElement *first, TGHtmlElement *last)
Print a list of tokens.
TGHtmlElement * fLoEndPtr
Definition: TGHtml.h:1200
SHtmlStyleStack_t * fStyleStack
Definition: TGHtml.h:1188
const char * fZBase
Definition: TGHtml.h:1259
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a html widget as a C++ statement(s) on output stream out.
Definition: TGHtml.cxx:2063
int fTop
Definition: TGHtml.h:717
void Paragraph(TGHtmlElement *p)
Increase the headroom to create a paragraph break at the current token.
TGHtmlImageMarkup * fINext
Definition: TGHtml.h:553
int GotoAnchor(const char *name)
Go to anchor position.
Definition: TGHtml.cxx:449
virtual int ProcessFrame()
Definition: TGHtml.h:937
Html_16_t fAscent
Definition: TGHtml.h:546
int fHasbg
Definition: TGHtml.h:370
TGHtmlElement * fNextPlaced
Definition: TGHtml.h:1133
TGHtmlElement * AttrElem(const char *name, char *value)
Returns html element matching attribute name and value.
Definition: TGHtml.cxx:1848
Html_16_t fObjType
Definition: TGHtml.h:842
TGHtmlElement * fPOther
Definition: TGHtml.h:410
virtual void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw region defined by [x,y] [w,h].
Definition: TGHtml.cxx:793
void AppendText(TGString *str, TGHtmlElement *pFirst, TGHtmlElement *pEnd)
Append all text and space tokens between pStart and pEnd to the given TString.
Definition: TGHtmlForm.cxx:246
char * fZUrl
Definition: TGHtml.h:521
SHtmlTokenMap_t * NameToPmap(char *zType)
Returns token map matching zType name.
TGHtmlBlock * fPSelEndBlock
Definition: TGHtml.h:1154
TGHtmlMarkupElement(int type, int argc, int arglen[], char *argv[])
HTML mrkup element constructor.
const char Option_t
Definition: RtypesCore.h:62
Html_u16_t fRight
Definition: TGHtml.h:718
void UpdateSelectionDisplay()
The fPSelStartBlock and fPSelEndBlock values have been changed.
Definition: TGHtml.cxx:1922
void ResetLayoutContext()
Reset the main layout context in the main widget.
Definition: TGHtml.cxx:521
TGHtmlBlock * fLastBlock
Definition: TGHtml.h:1136
Html_32_t fY
Definition: TGHtml.h:595
int fInsOnTime
Definition: TGHtml.h:1158
TGHtmlTable(int type, int argc, int arglen[], char *argv[])
HTML table element constructor.
Html_16_t fX
Definition: TGHtml.h:548
Html_32_t fY
Definition: TGHtml.h:390
void Sizer()
Compute the size of all elements in the widget.
Html_u16_t fSubId
Definition: TGHtml.h:594
void SizeAndLink(TGFrame *frame, TGHtmlInput *pElem)
&#39;frame&#39; is the child widget that is used to implement an input element.
Definition: TGHtmlForm.cxx:192
virtual void Clear(Option_t *="")
Erase all HTML from this widget and clear the screen.
Definition: TGHtml.cxx:298
int NameToType(char *zType)
Convert a markup name into a type integer.
void LayoutBlock()
Do as much layout as possible on the block of text defined by the HtmlLayoutContext.
SHtmlTokenMap_t * fPCollide
Definition: TGHtml.h:843
void ClearObstacle(int mode)
Clear a wrap-around obstacle.
virtual void SubmitClicked(const char *val)
Emit SubmitClicked() signal.
Definition: TGHtml.cxx:1327
char * fZText
Definition: TGHtml.h:1168
TGHtmlBlock * fBPrev
Definition: TGHtml.h:720
Html_u8_t fIs3D
Definition: TGHtml.h:656
Handle_t Cursor_t
Definition: GuiTypes.h:33
virtual int GetUnorderedListType(int dflt)
Definition: TGHtml.h:257
Definition: TGHtmlDraw.cxx:46
int fInsStatus
Definition: TGHtml.h:1160
TGHtmlBlock * fPInsBlock
Definition: TGHtml.h:1163
virtual int GetVerticalAlignment(int dflt)
Definition: TGHtml.h:258
Html_u8_t fTextAscent
Definition: TGHtml.h:540
void MaxIndex(TGHtmlElement *p, int *pIndex, int isLast)
Find the maximum index for the given token.
Definition: TGHtmlIndex.cxx:97
void DrawTableBgnd(int x, int y, int w, int h, Drawable_t d, TImage *image)
Draw table background.
Definition: TGHtmlDraw.cxx:856
TGHtmlElement * fPLast
Definition: TGHtml.h:1129
void PushIndent()
Adjust (push) ident.
Definition: TGHtml.h:367
#define N
int fRuleRelief
Definition: TGHtml.h:1257
int IndexMod(TGHtmlElement **pp, int *ip, char *cp)
Modify an index for both pointer and char +/-/=N.
Handle_t GContext_t
Definition: GuiTypes.h:37
SHtmlMargin_t * fLeftMargin
Definition: TGHtml.h:804
TGHtmlBlock * fFirstBlock
Definition: TGHtml.h:1135
int HtmlDepth
Definition: TGHtml.cxx:61
Html Layout Context constructor.
void LostSelection()
Clear selection.
Definition: TGHtml.cxx:1968
void DeleteControls()
Delete all input controls.
Definition: TGHtmlForm.cxx:103
TGHtmlImage * fImageList
Definition: TGHtml.h:1236
virtual TGFont * GetFont(int iFont)
The rendering and layout routines should call this routine in order to get a font structure...
Definition: TGHtml.cxx:1406
virtual void MouseDown(const char *uri)
Definition: TGHtml.h:1116
TGHtmlRef(int type, int argc, int arglen[], char *argv[])
HTML ref element constructor.
Html_16_t fX
Definition: TGHtml.h:388
int Int_t
Definition: RtypesCore.h:41
Bool_t HandleRadioButton(TGHtmlInput *p)
Handle radio button event.
Definition: TGHtml.cxx:1255
bool Bool_t
Definition: RtypesCore.h:59
TImage * fBgImage
Definition: TGHtml.h:369
unsigned int fExpbg
Definition: TGHtml.h:149
TGHtmlInput * fLastInput
Definition: TGHtml.h:1138
char fFontValid[(N_FONT+7)/8]
Definition: TGHtml.h:1220
unsigned int fElements
Definition: TGHtml.h:639
TGHtmlElement * MinMax(TGHtmlElement *p, int *pMin, int *pMax, int lineWidth, int hasbg)
Given a list of elements, compute the minimum and maximum width needed to render the list...
int fIDark[N_COLOR]
Definition: TGHtml.h:1226
void ScheduleRedraw()
Make sure that a call to the Redraw() routine has been queued.
Definition: TGHtml.cxx:750
Handle_t Drawable_t
Definition: GuiTypes.h:30
TGHtmlMarkupElement * MakeMarkupEntry(int objType, int type, int argc, int arglen[], char *argv[])
Make one markup entry.
void UnderlineLinks(int onoff)
Set/reset html links underline.
Definition: TGHtml.cxx:396
virtual ~TGHtmlTextElement()
HTML element destructor.
Html_u8_t fAlign
Definition: TGHtml.h:599
An abstract interface to image processing library.
Definition: TImage.h:29
int TextInsertCmd(int argc, char **argv)
Insert text into text token, or break token into two text tokens.
int fBottom
Definition: TGHtml.h:744
int fNToken
Definition: TGHtml.h:1130
void RedrawEverything()
Call this routine to force the entire widget to be redrawn.
Definition: TGHtml.cxx:865
GcCache_t fAGcCache[N_CACHE_GC]
Definition: TGHtml.h:1233
TGHtmlElement * TableLayout(TGHtmlTable *p)
Do all layout for a single table.
int fICol
Definition: TGHtml.h:1173
virtual int ProcessToken(TGHtmlElement *, const char *, int)
Definition: TGHtml.h:927
void AddFormInfo(TGHtmlElement *p)
Add the DOM control information for form elements.
Definition: TGHtmlForm.cxx:565
void AddSelectOptions(TGListBox *lb, TGHtmlElement *p, TGHtmlElement *pEnd)
The "p" argument points to a <select>.
Definition: TGHtmlForm.cxx:303
int SelectionSet(const char *startIx, const char *endIx)
Set selection.
Definition: TGHtml.cxx:1983
Html_32_t fY
Definition: TGHtml.h:667
Html_u8_t fLtype
Definition: TGHtml.h:423
TGHtmlMapArea(int type, int argc, int arglen[], char *argv[])
HTML map area constructor.
Cursor_t fCursor
Definition: TGHtml.h:1261
int fInTr
Definition: TGHtml.h:1193
TGHtmlElement * fPEnd
Definition: TGHtml.h:642
void AppendElement(TGHtmlElement *pElem)
Append the given TGHtmlElement to the tokenizers list of elements.
Html_16_t fW
Definition: TGHtml.h:545
Html_16_t fColspan
Definition: TGHtml.h:387
int fDirtyTop
Definition: TGHtml.h:1265
TGIdleHandler * fIdle
Definition: TGHtml.h:1181
Definition: TGHtml.h:872
void DrawSelectionBackground(TGHtmlBlock *pBlock, Drawable_t Drawable_t, int x, int y)
Draw the selection background for the given block.
Definition: TGHtmlDraw.cxx:215
Html_u8_t fCompact
Definition: TGHtml.h:456
int fNComplete
Definition: TGHtml.h:1171
TGHtmlElement * fPNext
Definition: TGHtml.h:261
const char * GetPctWidth(TGHtmlElement *p, char *opt, char *ret)
Return the height and width, converting to percent if required ret must be at least 16 characters lon...
TGHtmlAnchor * fAnchorStart
Definition: TGHtml.h:1195
TTimer * fInsTimer
Definition: TGHtml.h:1161
int fRowAlignment
Definition: TGHtml.h:1190
Html_u8_t fSized
Definition: TGHtml.h:603
Html_u8_t fIndex
Definition: TGHtml.h:824
SHtmlIndex_t fIns
Definition: TGHtml.h:1162
Html_u16_t fCnt
Definition: TGHtml.h:457
Html_u16_t fWidth
Definition: TGHtml.h:458
TGHtmlElement * DoBreakMarkup(TGHtmlElement *p)
Break markup is any kind of markup that might force a line-break.
void PushMargin(SHtmlMargin_t **ppMargin, int indent, int bottom, int tag)
Push a new margin onto the given margin stack.
void PopExpiredMargins(SHtmlMargin_t **ppMarginStack, int y)
Pop all expired margins from the stack.
TTimer * fTimer
Definition: TGHtml.h:526
void UnmapControls()
Unmap any input control that is currently mapped.
Definition: TGHtmlForm.cxx:51
virtual Bool_t HandleFocusChange(Event_t *event)
Handle focus change event.
Definition: TGHtml.cxx:1120
int fExiting
Definition: TGHtml.h:1279
Html_32_t fH
Definition: TGHtml.h:363
int fLastGC
Definition: TGHtml.h:1235
virtual ~TGHtml()
HTML widget destructor.
Definition: TGHtml.cxx:220
Html_u8_t fBorderWidth
Definition: TGHtml.h:359
void DrawRect(Drawable_t drawable, TGHtmlElement *src, int x, int y, int w, int h, int depth, int relief)
Draw a rectangle.
Definition: TGHtmlDraw.cxx:265
Html_32_t fY
Definition: TGHtml.h:653
THashTable implements a hash table to store TObject&#39;s.
Definition: THashTable.h:35
void PushStyleStack(int tag, SHtmlStyle_t style)
Push a new rendering style onto the stack.
Definition: TGHtmlSizer.cxx:64
Double_t x[n]
Definition: legend1.C:17
TGHtmlElement * FillOutBlock(TGHtmlBlock *p)
Recompute the following fields of the given block structure:
Definition: TGHtmlDraw.cxx:616
Html_u8_t fNCol
Definition: TGHtml.h:360
#define ClassDef(name, id)
Definition: Rtypes.h:326
virtual const char * MarkupArg(const char *, const char *)
Definition: TGHtml.h:254
int fDirtyRight
Definition: TGHtml.h:1268
void StringHW(const char *str, int *h, int *w)
Return the height and width of string.
Definition: TGHtmlTable.cxx:77
ColorStruct_t * AllocColor(const char *name)
Allocate system color by name.
Definition: TGHtml.cxx:260
void FixAnchors(TGHtmlElement *p, TGHtmlElement *pEnd, int y)
Set the y coordinate for every anchor in the given list.
void UpdateSelection(int forceUpdate)
Given the selection end-points in fSelBegin and fSelEnd, recompute pSelBeginBlock and fPSelEndBlock...
Definition: TGHtml.cxx:1869
const char * GetUid(const char *string)
Given a string, this procedure returns a unique identifier for the string.
Definition: TGHtml.cxx:478
int MapControls()
Map any control that should be visible according to the current scroll position.
Definition: TGHtmlForm.cxx:71
void LayoutDoc()
Advance the layout as far as possible.
ColorStruct_t * fSelectionColor
Definition: TGHtml.h:1232
char * fZWidth
Definition: TGHtml.h:522
int DecodeBaseIndex(const char *zBase, TGHtmlElement **ppToken, int *pIndex)
Given a base index name (without any modifiers) return a pointer to the token described, and the character within that token.
void ResetBlocks()
Definition: TGHtml.h:974
int fOverrideFonts
Definition: TGHtml.h:1240
unsigned int fBgcolor
Definition: TGHtml.h:148
TGHtmlElement * fPFirst
Definition: TGHtml.h:641
ColorStruct_t * AllocColorByValue(ColorStruct_t *color)
Allocate system color by value.
Definition: TGHtml.cxx:279
virtual int GetAlignment(int dflt)
Definition: TGHtml.h:255
short Html_16_t
Definition: TGHtml.h:136
ColorStruct_t * fFgColor
Definition: TGHtml.h:1229
int fVarId
Definition: TGHtml.h:1141
unsigned int fFont
Definition: TGHtml.h:144
Int_t fT
Definition: TGDimension.h:85
TGHtml(const TGWindow *p, int w, int h, int id=-1)
HTML Widget constructor.
Definition: TGHtml.cxx:73
GContext_t GetAnyGC()
Retrieve any valid GC.
Definition: TGHtml.cxx:1105
Html_u16_t fW
Definition: TGHtml.h:655
TGHtmlElement * FindEndNest(TGHtmlElement *sp, int en, TGHtmlElement *lp)
Find End tag en, but ignore intervening begin/end tag pairs.
void UnlinkAndFreeBlock(TGHtmlBlock *pBlock)
Destroy the given Block after first unlinking it from the element list.
Definition: TGHtmlDraw.cxx:69
int fNAlloc
Definition: TGHtml.h:1170
TGInsets fMargins
Definition: TGHtml.h:1214
void RedrawArea(int left, int top, int right, int bottom)
If any part of the screen needs to be redrawn, then call this routine with the values of a box (in wi...
Definition: TGHtml.cxx:777
virtual void ButtonClicked(const char *name, const char *val)
Emit ButtonClicked() signal.
Definition: TGHtml.cxx:1274
Int_t fB
Definition: TGDimension.h:86
int fNStart
Definition: TGHtml.h:683
Html_u8_t fColor
Definition: TGHtml.h:823
virtual Bool_t HandleMotion(Event_t *event)
handle mouse motion events
Definition: TGHtml.cxx:1379
int fMaxY
Definition: TGHtml.h:1262
TGHtmlListStart * fInnerList
Definition: TGHtml.h:1199
int CellSpacing(TGHtmlElement *pTable)
Return the appropriate cell spacing for the given table.
Definition: TGHtmlTable.cxx:53
Html_u8_t fAlign
Definition: TGHtml.h:539
TGHtmlForm(int type, int argc, int arglen[], char *argv[])
HTML form element constructor.
ColorStruct_t * fApColor[N_COLOR]
Definition: TGHtml.h:1223
TGHtmlElement * fPPrev
Definition: TGHtml.h:262
SHtmlExtensions_t * fNext
Definition: TGHtml.h:486
int Tokenize()
Process as much of the input HTML as possible.
TGHtmlBlock * fBNext
Definition: TGHtml.h:720
TGHtmlInput * fFirstInput
Definition: TGHtml.h:1137
void MakeInvisible(TGHtmlElement *p_first, TGHtmlElement *p_last)
Add the STY_Invisible style to every token between p_first and p_last.
int ControlSize(TGHtmlInput *p)
This routine implements the Sizer() function for <INPUT>, <SELECT> and <TEXTAREA> markup...
Definition: TGHtmlForm.cxx:357
virtual Bool_t ProcessMessage(Long_t, Long_t, Long_t)
Process messages (GUI events) in the html widget.
Definition: TGHtmlForm.cxx:670
void IndexToBlockIndex(SHtmlIndex_t sIndex, TGHtmlBlock **ppBlock, int *piIndex)
Convert an Element-based index into a Block-based index.
virtual char * GetFontName()
Definition: TGHtml.h:953
int GetRuleRelief() const
Definition: TGHtml.h:900
void MoveVertically(TGHtmlElement *p, TGHtmlElement *pLast, int dy)
Move all elements in the given list vertically by the amount dy.
SHtmlStyle_t PopStyleStack(int tag)
Pop a rendering style off of the stack.
Definition: TGHtmlSizer.cxx:85
int FixLine(TGHtmlElement *pStart, TGHtmlElement *pEnd, int bottom, int width, int actualWidth, int leftMargin, int *maxX)
This routine computes the X and Y coordinates for all elements of a line that has been gathered using...
void DrawImage(TGHtmlImageMarkup *image, Drawable_t wid, int left, int top, int right, int bottom)
Draw all or part of an image.
Definition: TGHtmlDraw.cxx:538
Html_u8_t fRedrawNeeded
Definition: TGHtml.h:542
void HClear()
Erase all data from the HTML widget. Bring it back to an empty screen.
Definition: TGHtml.cxx:889
Html_16_t fType
Definition: TGHtml.h:841
virtual char * ResolveUri(const char *uri)
This function resolves the specified URI and returns the result in a newly allocated string...
Definition: TGHtmlUri.cxx:307
TGHtmlImage * fPImage
Definition: TGHtml.h:551
TGHtmlForm * fLoFormStart
Definition: TGHtml.h:1201
char * fZBaseHref
Definition: TGHtml.h:1260
Html_16_t fX
Definition: TGHtml.h:295
Html_32_t fY
Definition: TGHtml.h:549
void SetTableRelief(int relief)
Sets relief mode of html table.
Definition: TGHtml.cxx:372
int Html_32_t
Definition: TGHtml.h:138
virtual int FormAction(TGHtmlForm *, int)
Definition: TGHtml.h:949
int HtmlTraceMask
Definition: TGHtml.cxx:60
SHtmlTokenMap_t * GetMarkupMap(int n)
Returns token map at location n.
int fGcNextToFree
Definition: TGHtml.h:1234
virtual char * ProcessScript(TGHtmlScript *)
Definition: TGHtml.h:957
void BlockDraw(TGHtmlBlock *pBlock, Drawable_t wid, int left, int top, int width, int height, Pixmap_t pixmap)
Display a single HtmlBlock. This is where all the drawing happens.
Definition: TGHtmlDraw.cxx:316
int GetIndex(const char *zIndex, TGHtmlElement **ppToken, int *pIndex)
This routine decodes a complete index specification.
int fIPlaintext
Definition: TGHtml.h:1175
void ImageChanged(TGHtmlImage *image, int newWidth, int newHeight)
This routine is called when an image changes.
int GetMarginWidth()
Definition: TGHtml.h:963
void RedrawText(int y)
Call this routine to cause all of the rendered HTML at the virtual canvas coordinate of Y and beyond ...
Definition: TGHtml.cxx:875
TGHtmlElement * fPEnd
Definition: TGHtml.h:796
void EncodeText(TGString *str, const char *z)
Append to the given TString an encoded version of the given text.
Definition: TGHtmlForm.cxx:642
ColorStruct_t * fNewLinkColor
Definition: TGHtml.h:1230
void AddStyle(TGHtmlElement *p)
This routine adds information to the input texts that doesn&#39;t change when the display is resized or w...
SHtmlIndex_t fSelEnd
Definition: TGHtml.h:1149
int FormCount(TGHtmlInput *p, int radio)
Return the number of elments of type p in a form.
Definition: TGHtmlForm.cxx:543
int fNScript
Definition: TGHtml.h:684
Html_u8_t fAscent
Definition: TGHtml.h:297
void * fExts
Definition: TGHtml.h:483
int fInParse
Definition: TGHtml.h:1271
int fOverrideColors
Definition: TGHtml.h:1241
TGHtmlInput * fFormElemLast
Definition: TGHtml.h:1198
TGHtmlLi(int type, int argc, int arglen[], char *argv[])
HTML li element constructor.
SHtmlStyle_t fStyle
Definition: TGHtml.h:263
Html_32_t fH
Definition: TGHtml.h:391
int fInsIndex
Definition: TGHtml.h:1164
void AppendBlock(TGHtmlElement *pToken, TGHtmlBlock *pBlock)
Append a block to the block list and insert the block into the element list immediately prior to the ...
Definition: TGHtmlDraw.cxx:92
virtual Bool_t HandleIdleEvent(TGIdleHandler *i)
Handles idle event.
Definition: TGHtml.cxx:761
int GetDarkShadowColor(int iBgColor)
Given that the background color is iBgColor, figure out an appropriate color for the dark part of a 3...
Definition: TGHtml.cxx:1633
Html_u16_t fW
Definition: TGHtml.h:597
Html_u8_t fPadLeft
Definition: TGHtml.h:598
TImage * fImage
Definition: TGHtml.h:518
char * GetTokenName(TGHtmlElement *p)
Returns token name of html element p.
SHtmlStyle_t fStyle
Definition: TGHtml.h:735
virtual ~TGHtmlMarkupElement()
HTML markup element destructor.
void AppendArglist(TGString *str, TGHtmlMarkupElement *pElem)
Append all the arguments of the given markup to the given TGString.
int GetImageAt(int x, int y)
This routine searchs for an image beneath the coordinates x,y and returns the token number of the the...
void TableBgndImage(TGHtmlElement *p)
Set background picture of a html table.
void Redraw()
This routine is invoked in order to redraw all or part of the HTML widget.
Definition: TGHtml.cxx:532
int fUnderlineLinks
Definition: TGHtml.h:1242
virtual void CheckToggled(const char *name, Bool_t on, const char *val)
Emit CheckToggled() signal.
Definition: TGHtml.cxx:1287
Html_u8_t fTextDescent
Definition: TGHtml.h:541
int GetColorByValue(ColorStruct_t *pRef)
Find a color integer for the color whose color components are given by pRef.
Definition: TGHtml.cxx:1708
TGHtmlInput * GetInputElement(int x, int y)
This routine searchs for a hyperlink beneath the coordinates x,y and returns a pointer to the HREF fo...
Definition: TGHtml.cxx:1139
unsigned int UInt_t
Definition: RtypesCore.h:42
TGHtmlImage * fPNext
Definition: TGHtml.h:523
int ParseText(char *text, const char *index=0)
Appends (or insert at the specified position) the given HTML text to the end of any HTML text that ma...
Definition: TGHtml.cxx:313
Html_u16_t fCnt
Definition: TGHtml.h:604
void FindIndexInBlock(TGHtmlBlock *pBlock, int x, TGHtmlElement **ppToken, int *pIndex)
Given a Block and an x coordinate, find the Index of the character that is closest to the given x coo...
Html_u16_t fX
Definition: TGHtml.h:596
SHtmlMargin_t * fPNext
Definition: TGHtml.h:746
void AnimateImage(TGHtmlImage *image)
TGImage *img = image->image;.
Definition: TGHtmlDraw.cxx:590
TGHtmlElement * InsertToken(TGHtmlElement *pToken, char *zType, char *zArgs, int offs)
This routine takes a text representation of a token, converts it into an TGHtmlElement object and ins...
TGHtmlTable * fPTable
Definition: TGHtml.h:392
Html_u16_t fN
Definition: TGHtml.h:719
virtual void MouseOver(const char *uri)
Definition: TGHtml.h:1115
virtual TGFrame * ProcessApplet(TGHtmlInput *)
Definition: TGHtml.h:941
Html_u8_t fFont
Definition: TGHtml.h:822
Html_16_t fRowspan
Definition: TGHtml.h:386
Handles synchronous and a-synchronous timer events.
Definition: TTimer.h:51
virtual Bool_t HandleTimer(TTimer *timer)
Handle timer event.
Definition: TGHtml.cxx:992
char * fZText
Definition: TGHtml.h:300
Html_16_t fX
Definition: TGHtml.h:364
Html_u16_t fInpId
Definition: TGHtml.h:593
char * fZGoto
Definition: TGHtml.h:1272
int IsDarkColor(ColorStruct_t *p)
Check to see if the given color is too dark to be easily distinguished from black.
Definition: TGHtml.cxx:1619
int GetTableRelief() const
Definition: TGHtml.h:897
TGHtmlCell(int type, int argc, int arglen[], char *argv[])
HTML cell element constructor.
int fTableRelief
Definition: TGHtml.h:1256
Html_u8_t fAscent
Definition: TGHtml.h:424
static void indent(ostringstream &buf, int indent_level)
Html_u8_t fType
Definition: TGHtml.h:264
TGHtmlHr(int type, int argc, int arglen[], char *argv[])
HTML hr element constructor.
GContext_t fGc
Definition: TGHtml.h:821
virtual int IsVisited(const char *)
Definition: TGHtml.h:923
int fRadioIdx
Definition: TGHtml.h:1144
virtual int IsMarkup() const
Definition: TGHtml.h:253
#define h(i)
Definition: RSha256.hxx:106
TGHtmlTextElement & operator=(const TGHtmlTextElement &)
Html_u8_t fSpaceWidth
Definition: TGHtml.h:299
const char * GetBaseUri() const
Definition: TGHtml.h:906
const Bool_t kFALSE
Definition: RtypesCore.h:88
Int_t fR
Definition: TGDimension.h:84
Html_u16_t fH
Definition: TGHtml.h:655
TGHtmlElement * FindStartOfNextBlock(TGHtmlElement *p, int *pCnt)
Scan ahead looking for a place to put a block.
Definition: TGHtmlDraw.cxx:805
int InArea(TGHtmlMapArea *p, int left, int top, int x, int y)
Only support rect and circles for now.
Definition: TGHtml.cxx:1515
virtual ~TGHtmlImage()
Definition: TGHtmlImage.cxx:71
Bool_t HandleHtmlInput(TGHtmlInput *pr, Event_t *event)
Handle html input (button, checkbox, ...) event.
Definition: TGHtml.cxx:1164
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
int fVarind
Definition: TGHtml.h:1247
int fHasScript
Definition: TGHtml.h:1243
unsigned int fFlags
Definition: TGHtml.h:150
virtual void RadioChanged(const char *name, const char *val)
Emit RadioChanged() signal.
Definition: TGHtml.cxx:1301
TGHtmlElement * TokenByIndex(int N, int flag)
Return a pointer to the Nth TGHtmlElement in the list.
Definition: TGHtmlIndex.cxx:48
long Long_t
Definition: RtypesCore.h:50
int fAddEndTags
Definition: TGHtml.h:1245
Html_u8_t fDescent
Definition: TGHtml.h:310
virtual int GetUnorderedListType(int dflt)
The "type" argument to the given element might describe a type for an unordered list.
Int_t fL
Definition: TGDimension.h:83
#define d(i)
Definition: RSha256.hxx:102
Html_u16_t fX
Definition: TGHtml.h:654
int fInDt
Definition: TGHtml.h:1192
const char * fZName
Definition: TGHtml.h:840
unsigned short Html_u16_t
Definition: TGHtml.h:137
int SetInsert(const char *insIx)
Set the position of the insertion cursor.
Definition: TGHtml.cxx:2038
SHtmlStyle_t GetCurrentStyle()
Get the current rendering style.
Definition: TGHtmlSizer.cxx:39
virtual void UpdateBackgroundStart()
Start background update.
Definition: TGHtml.cxx:238
virtual int GetVerticalAlignment(int dflt)
Return the vertical alignment specified by the given element.
Html_16_t fCnt
Definition: TGHtml.h:426
TGHtmlImage * GetImage(TGHtmlImageMarkup *p)
Given an.
virtual int GetOrderedListType(int dflt)
Definition: TGHtml.h:256
const char * GetText() const
Definition: TGHtml.h:961
GContext_t GetGC(int color, int font)
Return a GC from the cache.
Definition: TGHtml.cxx:1035
Html_32_t fH
Definition: TGHtml.h:520
ColorStruct_t * fHighlightColorPtr
Definition: TGHtml.h:1218
TGHtmlImage(const TGHtmlImage &)
void PopOneMargin(SHtmlMargin_t **ppMargin)
Pop one margin off of the given margin stack.
int fFormPadding
Definition: TGHtml.h:1239
TGHtmlForm * fPForm
Definition: TGHtml.h:588
const char * TypeToName(int type)
Convert a type into a symbolic name.
int ElementCoords(TGHtmlElement *p, int i, int pct, int *coords)
Return coordinates of item.
Definition: TGHtml.cxx:1818
Html_u8_t fItype
Definition: TGHtml.h:602
Html_16_t fSelStartIndex
Definition: TGHtml.h:1151
TText * text
SHtmlStyleStack_t * fPNext
Definition: TGHtml.h:733
Html_16_t fH
Definition: TGHtml.h:544
int fMaxX
Definition: TGHtml.h:1262
TGHtmlElement * fPEnd
Definition: TGHtml.h:368
Html_u8_t fTextAscent
Definition: TGHtml.h:600
virtual int GetOrderedListType(int dflt)
The "type" argument to the given element might describe the type for an ordered list.
int GetMarginHeight()
Definition: TGHtml.h:964
HTML cell element destructor.
int type
Definition: TGX11.cxx:120
Definition: TGFont.h:149
TGHtmlElement * TableDimensions(TGHtmlTable *pStart, int lineWidth)
pStart points to a
TCanvas * style()
Definition: style.C:1
Html_16_t fW
Definition: TGHtml.h:296
Double_t y[n]
Definition: legend1.C:17
Definition: TGHtml.h:342
void PopMargin(SHtmlMargin_t **ppMargin, int tag)
Pop as many margins as necessary until the margin that was created with "tag" is popped off...
Html_16_t fW
Definition: TGHtml.h:389
TGHtmlAnchor(int type, int argc, int arglen[], char *argv[])
HTML anchor element constructor.
Html_u16_t fH
Definition: TGHtml.h:597
int fInsOffTime
Definition: TGHtml.h:1159
int fAnchorFlags
Definition: TGHtml.h:1191
TGHtmlElement * fPFirst
Definition: TGHtml.h:1128
TGHtmlElement * fPMap
Definition: TGHtml.h:552
int GetLightShadowColor(int iBgColor)
Given that the background color is iBgColor, figure out an appropriate color for the bright part of t...
Definition: TGHtml.cxx:1675
TGHtmlScript * fPScript
Definition: TGHtml.h:1179
TGHtmlScript(int type, int argc, int arglen[], char *argv[])
HTML script element constructor.
void WidenLine(int reqWidth, int *pX, int *pY, int *pW)
Move past obstacles until a linewidth of reqWidth is obtained, or until all obstacles are cleared...
TGFrame * fFrame
Definition: TGHtml.h:590
int fInputIdx
Definition: TGHtml.h:1143
TImage * fBgImage
Definition: TGHtml.h:1237
int fDirtyLeft
Definition: TGHtml.h:1265
TGString * ListTokens(TGHtmlElement *p, TGHtmlElement *pEnd)
Return all tokens between the two elements as a string list.
Html_32_t fY
Definition: TGHtml.h:428
Mother of all ROOT objects.
Definition: TObject.h:37
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
Html_u8_t fDescent
Definition: TGHtml.h:425
HTML ref element destructor.
#define N_COLOR
Definition: TGHtml.h:194
TGHtmlInput * fFormElemStart
Definition: TGHtml.h:1197
int TokenNumber(TGHtmlElement *p)
Return the token number for the given TGHtmlElement.
Definition: TGHtmlIndex.cxx:79
Definition: TGHtml.h:366
TGHtmlElement * fPEnd
Definition: TGHtml.h:394
virtual ~TGHtmlBlock()
Definition: TGHtmlDraw.cxx:59
Html_u16_t fLeft
Definition: TGHtml.h:718
float ColorDistance(ColorStruct_t *pA, ColorStruct_t *pB)
Compute the squared distance between two colors.
Definition: TGHtml.cxx:1554
int fFlags
Definition: TGHtml.h:1269
int fHasFrames
Definition: TGHtml.h:1244
void SetRuleRelief(int relief)
Sets relief mode of html rule.
Definition: TGHtml.cxx:384
unsigned char Html_u8_t
Definition: TGHtml.h:135
const char * fLastUri
Definition: TGHtml.h:1278
int fNText
Definition: TGHtml.h:1169
int IsLightColor(ColorStruct_t *p)
Check to see if the given color is too light to be easily distinguished from white.
Definition: TGHtml.cxx:1666
Html_16_t fW
Definition: TGHtml.h:365
ColorStruct_t * fBgColor
Definition: TGHtml.h:1228
Html_16_t fCount
Definition: TGHtml.h:266
SHtmlExtensions_t * fExts
Definition: TGHtml.h:1274
const char * fZAlt
Definition: TGHtml.h:550
Html_u8_t fTextDescent
Definition: TGHtml.h:601
TGHtmlInput * fINext
Definition: TGHtml.h:589
Handle_t Pixmap_t
Definition: GuiTypes.h:29
int fNForm
Definition: TGHtml.h:1140
TGHtml * fHtml
Definition: TGHtml.h:591
TGHtmlElement * fPStart
Definition: TGHtml.h:795
int GetLinkColor(const char *zURL)
For the markup , find out if the URL has been visited before or not.
TGHtml * fHtml
Definition: TGHtml.h:517
void AppToken(TGHtmlElement *pNew, TGHtmlElement *p, int offs)
Insert token pNew before token p.
char * DumpToken(TGHtmlElement *p)
For debugging purposes, print information about a token.
TGHtmlElement * fLastSized
Definition: TGHtml.h:1132
int fBottom
Definition: TGHtml.h:717
int InWrapAround()
Return TRUE (non-zero) if we are currently wrapping text around one or more images.
void SetBaseUri(const char *uri)
Sets base URI.
Definition: TGHtml.cxx:439
int GetColorByName(const char *zColor)
This routine returns an index between 0 and N_COLOR-1 which indicates which ColorStruct_t structure i...
Definition: TGHtml.cxx:1570
void FormBlocks()
Add additional blocks to the block list in order to cover all elements on the element list...
Definition: TGHtmlDraw.cxx:830
Html_16_t fSelEndIndex
Definition: TGHtml.h:1153
Html_32_t fW
Definition: TGHtml.h:519
TGHtmlListStart(int type, int argc, int arglen[], char *argv[])
HTML list start element constructor.
TGFont * fAFont[N_FONT]
Definition: TGHtml.h:1219
void ComputeMargins(int *pX, int *pY, int *pW)
Compute the current margins for layout.
TGHtmlElement * GetMap(const char *name)
Returns html map element.
Definition: TGHtml.cxx:1534
#define N_CACHE_GC
Definition: TGHtml.h:818
int fMType
Definition: TGHtml.h:472
int GetImageAlignment(TGHtmlElement *p)
Find the alignment for an image.
Definition: TGHtmlImage.cxx:84
unsigned int fAlign
Definition: TGHtml.h:147
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
TGHtmlImage & operator=(const TGHtmlImage &)
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event.
Definition: TGHtml.cxx:1335
Definition: first.py:1
void ClearMarginStack(SHtmlMargin_t **ppMargin)
Clear a margin stack to reclaim memory.
THashTable * fUidTable
Definition: TGHtml.h:1276
virtual TImage * LoadImage(const char *uri, int w=0, int h=0)
This is the default LoadImage() procedure.
TGHtmlElement(int etype=0)
HTML element constructor.
int fIndent
Definition: TGHtml.h:743
ColorStruct_t * fOldLinkColor
Definition: TGHtml.h:1231
TGHtmlElement * fPEnd
Definition: TGHtml.h:592
int fInTd
Definition: TGHtml.h:1194
const char * GetHref(int x, int y, const char **target=0)
This routine searchs for a hyperlink beneath the coordinates x,y and returns a pointer to the HREF fo...
Definition: TGHtml.cxx:1772
Html_16_t fW
Definition: TGHtml.h:308
virtual const char * MarkupArg(const char *tag, const char *zDefault)
Lookup an argument in the given markup with the name given.
void ClearGcCache()
Clear the cache of GCs.
Definition: TGHtml.cxx:504
Html_32_t fY
Definition: TGHtml.h:294
void FlashCursor()
Flash the insertion cursor.
Definition: TGHtml.cxx:1014
Html_u16_t fFormId
Definition: TGHtml.h:638
signed int fSubscript
Definition: TGHtml.h:146
TGHtmlImageMarkup * fPList
Definition: TGHtml.h:524
int fHighlightWidth
Definition: TGHtml.h:1211
int GetRulePadding() const
Definition: TGHtml.h:901
const Int_t n
Definition: legend1.C:16
TGHtmlTextElement(const TGHtmlTextElement &)
void Empty()
Mark this element as being empty.
SHtmlMargin_t * fRightMargin
Definition: TGHtml.h:805
HTML table element destructor.
TGHtmlElement * fPRow
Definition: TGHtml.h:393
void ComputeVirtualSize()
Computes virtual size of html area.
Definition: TGHtml.cxx:496
Html_16_t fDescent
Definition: TGHtml.h:547
ColorStruct_t * fHighlightBgColorPtr
Definition: TGHtml.h:1216
int fNInput
Definition: TGHtml.h:1139
char name[80]
Definition: TGX11.cxx:109
void FreeColor(ColorStruct_t *color)
Free system color.
Definition: TGHtml.cxx:251
int * fCoords
Definition: TGHtml.h:473
void PopIndent()
Adjust (pop) ident.
TGHtmlLayoutContext fLayoutContext
Definition: TGHtml.h:1207
virtual int GetAlignment(int dflt)
Return an alignment or justification flag associated with the given markup.
TGHtmlImageMarkup(int type, int argc, int arglen[], char *argv[])
HTML image element constructor.
void Reset()
Reset the layout context.
Html_u8_t fFlags
Definition: TGHtml.h:265
int fIdind
Definition: TGHtml.h:1270
int fTableBorderMin
Definition: TGHtml.h:1246
int NextMarkupType(TGHtmlElement *p)
Return the next markup type [TGHtmlElement::NextMarkupType].
Html_u8_t fDescent
Definition: TGHtml.h:298
virtual Bool_t ItemLayout()
Layout html widget.
Definition: TGHtml.cxx:822