Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGHtml.h
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
3
4/*************************************************************************
5 * Copyright (C) 1995-2021, 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 *************************************************************************/
11
12/**************************************************************************
13
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.
17
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.
22
23 This library is distributed in the hope that it will be useful,
24 but WITHOUT ANY WARRANTY; without even the implied warranty of
25 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 Library General Public License for more details.
27
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.
31
32**************************************************************************/
33
34#ifndef ROOT_TGHtml
35#define ROOT_TGHtml
36
37#include "TGView.h"
38
39#include "TGHtmlTokens.h"
40
41class TGClient;
42class TImage;
43class TGFont;
44class TGIdleHandler;
45class THashTable;
46class TTimer;
47
48//----------------------------------------------------------------------
49
50#define HTML_RELIEF_FLAT 0
51#define HTML_RELIEF_SUNKEN 1
52#define HTML_RELIEF_RAISED 2
53
54//#define TABLE_TRIM_BLANK 1
55
56// Debug must be turned on for testing to work.
57//#define DEBUG
58
59#define CANT_HAPPEN \
60 fprintf(stderr, \
61 "Unplanned behavior in the HTML Widget in file %s line %d\n", \
62 __FILE__, __LINE__)
63
64#define UNTESTED \
65 fprintf(stderr, \
66 "Untested code executed in the HTML Widget in file %s line %d\n", \
67 __FILE__, __LINE__)
68
69// Sanity checking macros.
70
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
82
83// Bitmasks for the HtmlTraceMask global variable
84
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
97
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.
107
108#ifdef DEBUG
109extern int HtmlTraceMask;
110extern 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
124
125
126//----------------------------------------------------------------------
127
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.
134
135typedef unsigned char Html_u8_t; // 8-bit unsigned integer
136typedef short Html_16_t; // 16-bit signed integer
137typedef unsigned short Html_u16_t; // 16-bit unsigned integer
138typedef int Html_32_t; // 32-bit signed integer
139
140// An instance of the following structure is used to record style
141// information on each Html element.
142
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};
152
153
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.
159
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.
162
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))
176
177// Macros for manipulating the fontValid bitmap of an TGHtml object.
178
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)))
182
183
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.
193
194#define N_COLOR 32 // Total number of colors
195
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
202
203
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.)
207
208#define ALIGN_Left 1
209#define ALIGN_Right 2
210#define ALIGN_Center 3
211#define ALIGN_None 0
212
213
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>.)
232
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)
241
242
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.
246
247// Every element contains at least this much information:
248
249class TGHtmlElement : public TObject {
250public:
251 TGHtmlElement(int etype = 0);
252
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; }
259
260public:
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};
270
271
272// Bitmasks for the "flags" field of the TGHtmlElement
273
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.
278
279
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.
284
286private:
289
290public:
291 TGHtmlTextElement(int size);
292 virtual ~TGHtmlTextElement();
293
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};
302
303
304// Each space element is represented like this:
305
307public:
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
311
312public:
314};
315
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.
322
324public:
325 TGHtmlMarkupElement(int type, int argc, int arglen[], char *argv[]);
326 virtual ~TGHtmlMarkupElement();
327
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);
333
334public://protected:
335 char **fArgv;
336};
337
338
339// The maximum number of columns allowed in a table. Any columns beyond
340// this number are ignored.
341
342#define HTML_MAX_COLUMNS 40
343
344
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.
352
354public:
355 TGHtmlTable(int type, int argc, int arglen[], char *argv[]);
356 ~TGHtmlTable();
357
358public:
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};
372
373
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.
379
381public:
382 TGHtmlCell(int type, int argc, int arglen[], char *argv[]);
383 ~TGHtmlCell();
384
385public:
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};
397
398
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...
403
405public:
406 TGHtmlRef(int type, int argc, int arglen[], char *argv[]);
407 ~TGHtmlRef();
408
409public:
410 TGHtmlElement *fPOther; // Pointer to some other Html element
411 TImage *fBgImage; // A background for the entire row
412};
413
414
415// An instance of the following class is used to represent
416// each <LI> markup.
417
419public:
420 TGHtmlLi(int type, int argc, int arglen[], char *argv[]);
421
422public:
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};
430
431
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.
436
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
446
447
448// An instance of this class is used for <UL> or <OL> markup.
449
451public:
452 TGHtmlListStart(int type, int argc, int arglen[], char *argv[]);
453
454public:
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};
461
462
463#define HTML_MAP_RECT 1
464#define HTML_MAP_CIRCLE 2
465#define HTML_MAP_POLY 3
466
468public:
469 TGHtmlMapArea(int type, int argc, int arglen[], char *argv[]);
470
471public:
474 int fNum;
475};
476
477
478//----------------------------------------------------------------------
479
480// Structure to chain extension data onto.
481
483 void *fExts;
484 int fTyp;
487};
488
489
490//----------------------------------------------------------------------
491
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.)
502
503class TGHtml;
505
506class TGHtmlImage : public TObject {
507private:
508 TGHtmlImage(const TGHtmlImage&) = delete;
510
511public:
512 TGHtmlImage(TGHtml *htm, const char *url, const char *width,
513 const char *height);
514 virtual ~TGHtmlImage();
515
516public:
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};
528
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.
533
535public:
536 TGHtmlImageMarkup(int type, int argc, int arglen[], char *argv[]);
537
538public:
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
553 TGHtmlImageMarkup *fINext; // Next markup using the same TGHtmlImage object
554};
555
556
557// Allowed alignments for images. These represent the allowed arguments
558// to the "align=" field of the <IMG> markup.
559
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
568
569
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.
578
579class TGHtmlForm;
580
582public:
583 TGHtmlInput(int type, int argc, int arglen[], char *argv[]);
584
585 void Empty();
586
587public:
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};
606
607
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.
611
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
626
627
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.
632
634public:
635 TGHtmlForm(int type, int argc, int arglen[], char *argv[]);
636
637public:
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};
644
645
646// Information used by a <HR> markup
647
649public:
650 TGHtmlHr(int type, int argc, int arglen[], char *argv[]);
651
652public:
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};
658
659
660// Information used by a <A> markup
661
663public:
664 TGHtmlAnchor(int type, int argc, int arglen[], char *argv[]);
665
666public:
667 Html_32_t fY; // Top edge for this element
668};
669
670
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.
677
679public:
680 TGHtmlScript(int type, int argc, int arglen[], char *argv[]);
681
682public:
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};
687
688
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>.
709
711public:
712 TGHtmlBlock();
713 virtual ~TGHtmlBlock();
714
715public:
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};
722
723
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.
731
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};
737
738
739// A stack of the following structures is used to remember the
740// left and right margins within a layout context.
741
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};
748
749
750// How much space (in pixels) used for a single level of indentation due
751// to a <UL> or <DL> or <BLOCKQUOTE>, etc.
752
753#define HTML_INDENT 36
754
755
756//----------------------------------------------------------------------
757
758// A layout context holds all state information used by the layout engine.
759
761public:
763
764 void LayoutBlock();
765 void Reset();
766
767 void PopIndent();
768 void PushIndent();
769
770protected:
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);
776
778 int width, int minX, int *actualWidth);
779
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);
790
792
793public:
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};
807
808
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.
817
818#define N_CACHE_GC 32
819
820struct 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};
826
827
828// An SHtmlIndex_t is a reference to a particular character within a
829// particular Text or Space token.
830
832 TGHtmlElement *fP; // The token containing the character
833 int fI; // Index of the character
834};
835
836
837// Used by the tokenizer
838
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};
845
846
847// Markup element types to be allocated by the tokenizer.
848// Do not confuse with .type field in TGHtmlElement
849
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
863
864
865//----------------------------------------------------------------------
866
867// The HTML widget. A derivate of TGView.
868
869class TGListBox;
870class THashTable;
871
872class TGHtml : public TGView {
873public:
874 TGHtml(const TGWindow *p, int w, int h, int id = -1);
875 virtual ~TGHtml();
876
877 virtual Bool_t HandleFocusChange(Event_t *event);
878 virtual Bool_t HandleButton(Event_t *event);
879 virtual Bool_t HandleMotion(Event_t *event);
880
882 virtual Bool_t HandleTimer(TTimer *timer);
883
885
886 virtual void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h);
887 virtual Bool_t ItemLayout();
888
891
892public: // user commands
893
894 int ParseText(char *text, const char *index = 0);
895
896 void SetTableRelief(int relief);
897 int GetTableRelief() const { return fTableRelief; }
898
899 void SetRuleRelief(int relief);
900 int GetRuleRelief() const { return fRuleRelief; }
901 int GetRulePadding() const { return fRulePadding; }
902
903 void UnderlineLinks(int onoff);
904
905 void SetBaseUri(const char *uri);
906 const char *GetBaseUri() const { return fZBase; }
907
908 int GotoAnchor(const char *name);
909
910public: // reloadable methods
911
912 // called when the widget is cleared
913 virtual void Clear(Option_t * = "");
914
915 // User function to resolve URIs
916 virtual char *ResolveUri(const char *uri);
917
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; }
921
922 // User function to tell if a hyperlink has already been visited
923 virtual int IsVisited(const char * /*url*/)
924 { return kFALSE; }
925
926 // User function to process tokens of the given type
927 virtual int ProcessToken(TGHtmlElement * /*pElem*/, const char * /*name*/, int /*type*/)
928 { return kFALSE; }
929
930 virtual TGFont *GetFont(int iFont);
931
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.
935
936 // Method for handling <frameset> markup
937 virtual int ProcessFrame()
938 { return kFALSE; }
939
940 // Method to process applets
941 virtual TGFrame *ProcessApplet(TGHtmlInput * /*input*/)
942 { return 0; }
943
944 // Called when parsing forms
945 virtual int FormCreate(TGHtmlForm * /*form*/, const char * /*zUrl*/, const char * /*args*/)
946 { return kFALSE; }
947
948 // Called when user presses Submit
949 virtual int FormAction(TGHtmlForm * /*form*/, int /*id*/)
950 { return kFALSE; }
951
952 // Invoked to find font names
953 virtual char *GetFontName()
954 { return 0; }
955
956 // Invoked for each <SCRIPT> markup
957 virtual char *ProcessScript(TGHtmlScript * /*script*/)
958 { return 0; }
959
960public:
961 const char *GetText() const { return fZText; }
962
965
966 TGHtmlInput *GetInputElement(int x, int y);
967 const char *GetHref(int x, int y, const char **target = 0);
968
970
971 int InArea(TGHtmlMapArea *p, int left, int top, int x, int y);
972 TGHtmlElement *GetMap(const char *name);
973
975 int ElementCoords(TGHtmlElement *p, int i, int pct, int *coords);
976
977 TGHtmlElement *TableDimensions(TGHtmlTable *pStart, int lineWidth);
978 int CellSpacing(TGHtmlElement *pTable);
979 void MoveVertically(TGHtmlElement *p, TGHtmlElement *pLast, int dy);
980
982
983 char *GetTokenName(TGHtmlElement *p);
984 char *DumpToken(TGHtmlElement *p);
985
986 void EncodeText(TGString *str, const char *z);
987
988protected:
989 void HClear();
990 void ClearGcCache();
991 void ResetLayoutContext();
992 void Redraw();
993 void ComputeVirtualSize();
994
995 void ScheduleRedraw();
996
997 void RedrawArea(int left, int top, int right, int bottom);
998 void RedrawBlock(TGHtmlBlock *p);
999 void RedrawEverything();
1000 void RedrawText(int y);
1001
1003 int IsDarkColor(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);
1009
1010 void FlashCursor();
1011
1012 GContext_t GetGC(int color, int font);
1014
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);
1021
1023 void UnlinkAndFreeBlock(TGHtmlBlock *pBlock);
1024 void AppendBlock(TGHtmlElement *pToken, TGHtmlBlock *pBlock);
1025
1026 void StringHW(const char *str, int *h, int *w);
1027 TGHtmlElement *MinMax(TGHtmlElement *p, int *pMin, int *pMax,
1028 int lineWidth, int hasbg);
1029
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);
1041
1043 void FormBlocks();
1044
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);
1058
1059 TGHtmlElement *TokenByIndex(int N, int flag);
1060 int TokenNumber(TGHtmlElement *p);
1061
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);
1071
1072 void LayoutDoc();
1073
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);
1083
1084 void UpdateSelection(int forceUpdate);
1086 void LostSelection();
1087 int SelectionSet(const char *startIx, const char *endIx);
1088 void UpdateInsert();
1089 int SetInsert(const char *insIx);
1090
1091 const char *GetUid(const char *string);
1092 ColorStruct_t *AllocColor(const char *name);
1094 void FreeColor(ColorStruct_t *color);
1095
1097 void PushStyleStack(int tag, SHtmlStyle_t style);
1098 SHtmlStyle_t PopStyleStack(int tag);
1099
1100 void MakeInvisible(TGHtmlElement *p_first, TGHtmlElement *p_last);
1101 int GetLinkColor(const char *zURL);
1102 void AddStyle(TGHtmlElement *p);
1103 void Sizer();
1104
1106
1107 TGHtmlElement *AttrElem(const char *name, char *value);
1108
1109public:
1110 void AppendArglist(TGString *str, TGHtmlMarkupElement *pElem);
1113 TGString *TableText(TGHtmlTable *pTable, int flags);
1114
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 * = "");
1123
1124protected:
1125 virtual void UpdateBackgroundStart();
1126
1127protected:
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
1145
1146 // Information about the selected region of text
1147
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
1155
1156 // Information about the insertion cursor
1157
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
1165
1166 // The following fields hold state information used by the tokenizer.
1167
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
1180
1182
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.
1187
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
1202
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.
1206
1208
1209 // Information used when displaying the widget:
1210
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
1238
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
1248
1249 // Information about the selection
1250
1251 int fExportSelection; // True if the selection is automatically
1252 // exported to the clipboard
1253
1254 // Miscellaneous information:
1255
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.
1271 int fInParse; // Prevent update if parsing
1272 char *fZGoto; // Label to goto right after layout
1273
1274 SHtmlExtensions_t *fExts; // Pointer to user extension data
1275
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
1280
1281 ClassDef(TGHtml, 0); // HTML widget
1282};
1283
1284
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.
1319
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
1333
1334
1335// Macros to set, clear or test bits of the "flags" field.
1336
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))
1341
1342
1343// No coordinate is ever as big as this number
1344
1345#define LARGE_NUMBER 100000000
1346
1347
1348// Default values for configuration options
1349
1350#define DEF_HTML_BG_COLOR DEF_FRAME_BG_COLOR
1351#define DEF_HTML_BG_MONO DEF_FRAME_BG_MONO
1352#define DEF_HTML_EXPORT_SEL 1
1353#define DEF_HTML_FG DEF_BUTTON_FG
1354#define DEF_HTML_HIGHLIGHT_BG DEF_BUTTON_HIGHLIGHT_BG
1355#define DEF_HTML_HIGHLIGHT DEF_BUTTON_HIGHLIGHT
1356#define DEF_HTML_HIGHLIGHT_WIDTH "0"
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"
1366
1367#ifdef NAVIGATOR_TABLES
1368
1369#define DEF_HTML_TABLE_BORDER "0"
1370#define DEF_HTML_TABLE_CELLPADDING "2"
1371#define DEF_HTML_TABLE_CELLSPACING "5"
1372#define DEF_HTML_TABLE_BORDER_LIGHT_COLOR "gray80"
1373#define DEF_HTML_TABLE_BORDER_DARK_COLOR "gray40"
1374
1375#endif // NAVIGATOR_TABLES
1376
1377
1378//----------------------------------------------------------------------
1379
1380// Messages generated by the HTML widget
1381/*
1382class TGHtmlMessage : public OWidgetMessage {
1383public:
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 }
1390
1391public:
1392 const char *uri;
1393 //ORectangle bbox;
1394 int x_root, y_root;
1395};
1396*/
1397
1398#endif // ROOT_TGHtml
Handle_t Cursor_t
Cursor handle.
Definition GuiTypes.h:34
Handle_t Pixmap_t
Pixmap handle.
Definition GuiTypes.h:30
Handle_t Drawable_t
Drawable handle.
Definition GuiTypes.h:31
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
#define d(i)
Definition RSha256.hxx:102
#define h(i)
Definition RSha256.hxx:106
const Bool_t kFALSE
Definition RtypesCore.h:92
long Long_t
Definition RtypesCore.h:54
bool Bool_t
Definition RtypesCore.h:63
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
static void indent(ostringstream &buf, int indent_level)
include TDocParser_001 C image html pict1_TDocParser_001 png width
#define N
@ Html_Block
@ Html_Space
int HtmlDepth
Definition TGHtml.cxx:63
int HtmlTraceMask
Definition TGHtml.cxx:62
unsigned char Html_u8_t
Definition TGHtml.h:135
#define HTML_MAX_COLUMNS
Definition TGHtml.h:342
int Html_32_t
Definition TGHtml.h:138
short Html_16_t
Definition TGHtml.h:136
#define N_CACHE_GC
Definition TGHtml.h:818
#define N_COLOR
Definition TGHtml.h:194
unsigned short Html_u16_t
Definition TGHtml.h:137
#define N_FONT
Definition TGHtml.h:165
char name[80]
Definition TGX11.cxx:110
int type
Definition TGX11.cxx:121
Html_32_t fY
Definition TGHtml.h:667
TGHtmlBlock * fBNext
Definition TGHtml.h:720
Html_u16_t fN
Definition TGHtml.h:719
Html_u16_t fRight
Definition TGHtml.h:718
char * fZ
Definition TGHtml.h:716
Html_u16_t fLeft
Definition TGHtml.h:718
TGHtmlBlock * fBPrev
Definition TGHtml.h:720
virtual ~TGHtmlBlock()
dtor.
TGHtmlBlock()
ctor.
int fBottom
Definition TGHtml.h:717
Html_32_t fH
Definition TGHtml.h:391
TImage * fBgImage
Definition TGHtml.h:395
Html_16_t fColspan
Definition TGHtml.h:387
Html_16_t fX
Definition TGHtml.h:388
Html_16_t fW
Definition TGHtml.h:389
Html_16_t fRowspan
Definition TGHtml.h:386
TGHtmlTable * fPTable
Definition TGHtml.h:392
TGHtmlElement * fPEnd
Definition TGHtml.h:394
Html_32_t fY
Definition TGHtml.h:390
~TGHtmlCell()
HTML cell element destructor.
TGHtmlElement * fPRow
Definition TGHtml.h:393
Html_u8_t fFlags
Definition TGHtml.h:265
Html_u8_t fType
Definition TGHtml.h:264
virtual int GetVerticalAlignment(int dflt)
Definition TGHtml.h:258
virtual int GetUnorderedListType(int dflt)
Definition TGHtml.h:257
SHtmlStyle_t fStyle
Definition TGHtml.h:263
virtual const char * MarkupArg(const char *, const char *)
Definition TGHtml.h:254
TGHtmlElement * fPPrev
Definition TGHtml.h:262
Html_16_t fCount
Definition TGHtml.h:266
virtual int GetAlignment(int dflt)
Definition TGHtml.h:255
virtual int GetOrderedListType(int dflt)
Definition TGHtml.h:256
virtual int IsMarkup() const
Definition TGHtml.h:253
TGHtmlElement * fPNext
Definition TGHtml.h:261
unsigned int fHasctl
Definition TGHtml.h:640
TGHtmlElement * fPEnd
Definition TGHtml.h:642
Html_u16_t fFormId
Definition TGHtml.h:638
unsigned int fElements
Definition TGHtml.h:639
TGHtmlElement * fPFirst
Definition TGHtml.h:641
Html_32_t fY
Definition TGHtml.h:653
Html_u16_t fW
Definition TGHtml.h:655
Html_u16_t fX
Definition TGHtml.h:654
Html_u8_t fIs3D
Definition TGHtml.h:656
Html_u16_t fH
Definition TGHtml.h:655
TGHtmlImage * fPImage
Definition TGHtml.h:551
TGHtmlImageMarkup * fINext
Definition TGHtml.h:553
Html_16_t fAscent
Definition TGHtml.h:546
Html_u8_t fRedrawNeeded
Definition TGHtml.h:542
Html_32_t fY
Definition TGHtml.h:549
Html_16_t fW
Definition TGHtml.h:545
Html_u8_t fTextAscent
Definition TGHtml.h:540
TGHtmlElement * fPMap
Definition TGHtml.h:552
Html_16_t fDescent
Definition TGHtml.h:547
Html_16_t fH
Definition TGHtml.h:544
Html_u8_t fAlign
Definition TGHtml.h:539
Html_16_t fX
Definition TGHtml.h:548
Html_u8_t fTextDescent
Definition TGHtml.h:541
const char * fZAlt
Definition TGHtml.h:550
char * fZUrl
Definition TGHtml.h:521
Html_32_t fW
Definition TGHtml.h:519
TImage * fImage
Definition TGHtml.h:518
char * fZHeight
Definition TGHtml.h:522
char * fZWidth
Definition TGHtml.h:522
virtual ~TGHtmlImage()
dtor.
TTimer * fTimer
Definition TGHtml.h:526
TGHtmlImageMarkup * fPList
Definition TGHtml.h:524
TGHtmlImage * fPNext
Definition TGHtml.h:523
TGHtmlImage & operator=(const TGHtmlImage &)=delete
TGHtmlImage(const TGHtmlImage &)=delete
TGHtml * fHtml
Definition TGHtml.h:517
Html_32_t fH
Definition TGHtml.h:520
void Empty()
Mark this element as being empty.
Html_u8_t fTextAscent
Definition TGHtml.h:600
Html_u16_t fW
Definition TGHtml.h:597
Html_u8_t fTextDescent
Definition TGHtml.h:601
Html_u8_t fItype
Definition TGHtml.h:602
Html_u8_t fSized
Definition TGHtml.h:603
Html_u16_t fH
Definition TGHtml.h:597
TGFrame * fFrame
Definition TGHtml.h:590
Html_u16_t fX
Definition TGHtml.h:596
TGHtml * fHtml
Definition TGHtml.h:591
Html_u8_t fAlign
Definition TGHtml.h:599
TGHtmlElement * fPEnd
Definition TGHtml.h:592
Html_u16_t fInpId
Definition TGHtml.h:593
Html_u16_t fCnt
Definition TGHtml.h:604
Html_u8_t fPadLeft
Definition TGHtml.h:598
TGHtmlForm * fPForm
Definition TGHtml.h:588
Html_u16_t fSubId
Definition TGHtml.h:594
TGHtmlInput * fINext
Definition TGHtml.h:589
Html_32_t fY
Definition TGHtml.h:595
TGHtmlElement * fPStart
Definition TGHtml.h:795
int InWrapAround()
Return TRUE (non-zero) if we are currently wrapping text around one or more images.
TGHtmlElement * GetLine(TGHtmlElement *pStart, TGHtmlElement *pEnd, int width, int minX, int *actualWidth)
This routine gathers as many tokens as will fit on one line.
TGHtmlLayoutContext()
Html Layout Context constructor.
void ComputeMargins(int *pX, int *pY, int *pW)
Compute the current margins for layout.
TGHtmlElement * TableLayout(TGHtmlTable *p)
Do all layout for a single table.
void PopOneMargin(SHtmlMargin_t **ppMargin)
Pop one margin off of the given margin stack.
void PopMargin(SHtmlMargin_t **ppMargin, int tag)
Pop as many margins as necessary until the margin that was created with "tag" is popped off.
void LayoutBlock()
Do as much layout as possible on the block of text defined by the HtmlLayoutContext.
SHtmlMargin_t * fRightMargin
Definition TGHtml.h:805
void PushMargin(SHtmlMargin_t **ppMargin, int indent, int bottom, int tag)
Push a new margin onto the given margin stack.
void ClearMarginStack(SHtmlMargin_t **ppMargin)
Clear a margin stack to reclaim memory.
TGHtmlElement * DoBreakMarkup(TGHtmlElement *p)
Break markup is any kind of markup that might force a line-break.
void Paragraph(TGHtmlElement *p)
Increase the headroom to create a paragraph break at the current token.
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 PopIndent()
Adjust (pop) ident.
void ClearObstacle(int mode)
Clear a wrap-around obstacle.
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.
void PopExpiredMargins(SHtmlMargin_t **ppMarginStack, int y)
Pop all expired margins from the stack.
void FixAnchors(TGHtmlElement *p, TGHtmlElement *pEnd, int y)
Set the y coordinate for every anchor in the given list.
TGHtmlElement * fPEnd
Definition TGHtml.h:796
SHtmlMargin_t * fLeftMargin
Definition TGHtml.h:804
void Reset()
Reset the layout context.
void PushIndent()
Adjust (push) ident.
Html_u8_t fDescent
Definition TGHtml.h:425
Html_u8_t fAscent
Definition TGHtml.h:424
Html_32_t fY
Definition TGHtml.h:428
Html_16_t fX
Definition TGHtml.h:427
Html_16_t fCnt
Definition TGHtml.h:426
Html_u8_t fLtype
Definition TGHtml.h:423
TGHtmlListStart * fLPrev
Definition TGHtml.h:459
Html_u8_t fLtype
Definition TGHtml.h:455
Html_u16_t fWidth
Definition TGHtml.h:458
Html_u16_t fCnt
Definition TGHtml.h:457
Html_u8_t fCompact
Definition TGHtml.h:456
int * fCoords
Definition TGHtml.h:473
virtual int GetAlignment(int dflt)
Return an alignment or justification flag associated with the given markup.
virtual int GetVerticalAlignment(int dflt)
Return the vertical alignment specified by the given element.
virtual ~TGHtmlMarkupElement()
HTML markup element destructor.
virtual const char * MarkupArg(const char *tag, const char *zDefault)
Lookup an argument in the given markup with the name given.
virtual int GetOrderedListType(int dflt)
The "type" argument to the given element might describe the type for an ordered list.
virtual int GetUnorderedListType(int dflt)
The "type" argument to the given element might describe a type for an unordered list.
TImage * fBgImage
Definition TGHtml.h:411
~TGHtmlRef()
HTML ref element destructor.
TGHtmlElement * fPOther
Definition TGHtml.h:410
int fNStart
Definition TGHtml.h:683
int fNScript
Definition TGHtml.h:684
Html_u8_t fDescent
Definition TGHtml.h:310
Html_u8_t fAscent
Definition TGHtml.h:309
Html_16_t fW
Definition TGHtml.h:308
Html_u8_t fBorderWidth
Definition TGHtml.h:359
int fHasbg
Definition TGHtml.h:370
int fMinW[HTML_MAX_COLUMNS+1]
Definition TGHtml.h:366
TGHtmlElement * fPEnd
Definition TGHtml.h:368
Html_32_t fY
Definition TGHtml.h:362
Html_16_t fX
Definition TGHtml.h:364
~TGHtmlTable()
HTML table element destructor.
Html_16_t fW
Definition TGHtml.h:365
Html_u8_t fNCol
Definition TGHtml.h:360
Html_u16_t fNRow
Definition TGHtml.h:361
Html_32_t fH
Definition TGHtml.h:363
int fMaxW[HTML_MAX_COLUMNS+1]
Definition TGHtml.h:367
TImage * fBgImage
Definition TGHtml.h:369
TGHtmlTextElement & operator=(const TGHtmlTextElement &)=delete
Html_16_t fW
Definition TGHtml.h:296
TGHtmlTextElement(const TGHtmlTextElement &)=delete
Html_u8_t fDescent
Definition TGHtml.h:298
Html_u8_t fSpaceWidth
Definition TGHtml.h:299
virtual ~TGHtmlTextElement()
HTML element destructor.
Html_32_t fY
Definition TGHtml.h:294
Html_16_t fX
Definition TGHtml.h:295
Html_u8_t fAscent
Definition TGHtml.h:297
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:1677
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a html widget as a C++ statement(s) on output stream out.
Definition TGHtml.cxx:2065
TGHtmlElement * GetMap(const char *name)
Returns html map element.
Definition TGHtml.cxx:1536
int IsDarkColor(ColorStruct_t *p)
Check to see if the given color is too dark to be easily distinguished from black.
Definition TGHtml.cxx:1621
void MoveVertically(TGHtmlElement *p, TGHtmlElement *pLast, int dy)
Move all elements in the given list vertically by the amount dy.
int fAddEndTags
Definition TGHtml.h:1245
TGString * ListTokens(TGHtmlElement *p, TGHtmlElement *pEnd)
Return all tokens between the two elements as a string list.
ColorStruct_t * fFgColor
Definition TGHtml.h:1229
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:779
int fICol
Definition TGHtml.h:1173
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...
int GotoAnchor(const char *name)
Go to anchor position.
Definition TGHtml.cxx:451
TGHtmlBlock * fLastBlock
Definition TGHtml.h:1136
void AppToken(TGHtmlElement *pNew, TGHtmlElement *p, int offs)
Insert token pNew before token p.
int SetInsert(const char *insIx)
Set the position of the insertion cursor.
Definition TGHtml.cxx:2040
virtual ~TGHtml()
HTML widget destructor.
Definition TGHtml.cxx:222
virtual void RadioChanged(const char *name, const char *val)
Emit RadioChanged() signal.
Definition TGHtml.cxx:1303
TGHtmlElement * fLoEndPtr
Definition TGHtml.h:1200
SHtmlIndex_t fSelBegin
Definition TGHtml.h:1148
char * fZGoto
Definition TGHtml.h:1272
int fParaAlignment
Definition TGHtml.h:1189
virtual int FormCreate(TGHtmlForm *, const char *, const char *)
Definition TGHtml.h:945
TGHtmlBlock * fPSelStartBlock
Definition TGHtml.h:1150
int fIdind
Definition TGHtml.h:1270
int fRadioIdx
Definition TGHtml.h:1144
int fInputIdx
Definition TGHtml.h:1143
const char * fZBase
Definition TGHtml.h:1259
int fUnderlineLinks
Definition TGHtml.h:1242
int TextInsertCmd(int argc, char **argv)
Insert text into text token, or break token into two text tokens.
int IsLightColor(ColorStruct_t *p)
Check to see if the given color is too light to be easily distinguished from white.
Definition TGHtml.cxx:1668
void TokenizerAppend(const char *text)
Append text to the tokenizer engine.
TGHtmlImage * fImageList
Definition TGHtml.h:1236
TGHtmlElement * fPFirst
Definition TGHtml.h:1128
void AddStyle(TGHtmlElement *p)
This routine adds information to the input texts that doesn't change when the display is resized or w...
int fNForm
Definition TGHtml.h:1140
virtual void MouseDown(const char *uri)
Definition TGHtml.h:1116
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.
void ScheduleRedraw()
Make sure that a call to the Redraw() routine has been queued.
Definition TGHtml.cxx:752
virtual char * ProcessScript(TGHtmlScript *)
Definition TGHtml.h:957
void LostSelection()
Clear selection.
Definition TGHtml.cxx:1970
const char * fLastUri
Definition TGHtml.h:1278
int fNToken
Definition TGHtml.h:1130
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:1774
virtual TGFont * GetFont(int iFont)
The rendering and layout routines should call this routine in order to get a font structure.
Definition TGHtml.cxx:1408
SHtmlIndex_t fIns
Definition TGHtml.h:1162
void UpdateInsert()
Recompute the position of the insertion cursor based on the position in fIns.
Definition TGHtml.cxx:2027
int fAnchorFlags
Definition TGHtml.h:1191
char fFontValid[(N_FONT+7)/8]
Definition TGHtml.h:1220
int fExiting
Definition TGHtml.h:1279
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...
TGHtmlElement * fLastSized
Definition TGHtml.h:1132
void LayoutDoc()
Advance the layout as far as possible.
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.
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 ...
void IndexToBlockIndex(SHtmlIndex_t sIndex, TGHtmlBlock **ppBlock, int *piIndex)
Convert an Element-based index into a Block-based index.
int fLastGC
Definition TGHtml.h:1235
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:1572
void DrawImage(TGHtmlImageMarkup *image, Drawable_t wid, int left, int top, int right, int bottom)
Draw all or part of an image.
TGHtmlInput * fFormElemLast
Definition TGHtml.h:1198
void AnimateImage(TGHtmlImage *image)
TGImage *img = image->image;.
TGHtmlBlock * fPInsBlock
Definition TGHtml.h:1163
virtual void InputSelected(const char *name, const char *val)
Emit Selected() signal.
Definition TGHtml.cxx:1316
const char * TypeToName(int type)
Convert a type into a symbolic name.
virtual void CheckToggled(const char *name, Bool_t on, const char *val)
Emit CheckToggled() signal.
Definition TGHtml.cxx:1289
void EncodeText(TGString *str, const char *z)
Append to the given TString an encoded version of the given text.
int SelectionSet(const char *startIx, const char *endIx)
Set selection.
Definition TGHtml.cxx:1985
virtual void Clear(Option_t *="")
Erase all HTML from this widget and clear the screen.
Definition TGHtml.cxx:300
void UpdateSelectionDisplay()
The fPSelStartBlock and fPSelEndBlock values have been changed.
Definition TGHtml.cxx:1924
TGHtmlBlock * fPSelEndBlock
Definition TGHtml.h:1154
ColorStruct_t * fSelectionColor
Definition TGHtml.h:1232
int Tokenize()
Process as much of the input HTML as possible.
virtual Bool_t HandleFocusChange(Event_t *event)
Handle focus change event.
Definition TGHtml.cxx:1122
int fInsOffTime
Definition TGHtml.h:1159
void FormBlocks()
Add additional blocks to the block list in order to cover all elements on the element list.
TGInsets fMargins
Definition TGHtml.h:1214
TGFont * fAFont[N_FONT]
Definition TGHtml.h:1219
int NextMarkupType(TGHtmlElement *p)
Return the next markup type [TGHtmlElement::NextMarkupType].
void MaxIndex(TGHtmlElement *p, int *pIndex, int isLast)
Find the maximum index for the given token.
virtual Bool_t ProcessMessage(Long_t, Long_t, Long_t)
Process messages (GUI events) in the html widget.
void StringHW(const char *str, int *h, int *w)
Return the height and width of string.
int fVarind
Definition TGHtml.h:1247
int fFlags
Definition TGHtml.h:1269
virtual void ButtonClicked(const char *name, const char *val)
Emit ButtonClicked() signal.
Definition TGHtml.cxx:1276
ColorStruct_t * fHighlightBgColorPtr
Definition TGHtml.h:1216
int NameToType(char *zType)
Convert a markup name into a type integer.
void SetRuleRelief(int relief)
Sets relief mode of html rule.
Definition TGHtml.cxx:386
virtual void UpdateBackgroundStart()
Start background update.
Definition TGHtml.cxx:240
int CellSpacing(TGHtmlElement *pTable)
Return the appropriate cell spacing for the given table.
int fInsOnTime
Definition TGHtml.h:1158
int fVarId
Definition TGHtml.h:1141
TGHtmlElement * FillOutBlock(TGHtmlBlock *p)
Recompute the following fields of the given block structure:
int fDirtyBottom
Definition TGHtml.h:1268
SHtmlStyleStack_t * fStyleStack
Definition TGHtml.h:1188
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:315
virtual Bool_t HandleTimer(TTimer *timer)
Handle timer event.
Definition TGHtml.cxx:994
ColorStruct_t * fNewLinkColor
Definition TGHtml.h:1230
TGHtmlListStart * fInnerList
Definition TGHtml.h:1199
int fIPlaintext
Definition TGHtml.h:1175
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:877
int IndexMod(TGHtmlElement **pp, int *ip, char *cp)
Modify an index for both pointer and char +/-/=N.
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event.
Definition TGHtml.cxx:1337
int fOverrideColors
Definition TGHtml.h:1241
virtual void MouseOver(const char *uri)
Definition TGHtml.h:1115
Bool_t HandleRadioButton(TGHtmlInput *p)
Handle radio button event.
Definition TGHtml.cxx:1257
int fMaxY
Definition TGHtml.h:1262
Cursor_t fCursor
Definition TGHtml.h:1261
void AppendArglist(TGString *str, TGHtmlMarkupElement *pElem)
Append all the arguments of the given markup to the given TGString.
virtual int FormAction(TGHtmlForm *, int)
Definition TGHtml.h:949
virtual Bool_t HandleMotion(Event_t *event)
handle mouse motion events
Definition TGHtml.cxx:1381
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:1141
char * fZText
Definition TGHtml.h:1168
int fInsIndex
Definition TGHtml.h:1164
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...
int fILight[N_COLOR]
Definition TGHtml.h:1227
int fNInput
Definition TGHtml.h:1139
void TableBgndImage(TGHtmlElement *p)
Set background picture of a html table.
void UpdateSelection(int forceUpdate)
Given the selection end-points in fSelBegin and fSelEnd, recompute pSelBeginBlock and fPSelEndBlock,...
Definition TGHtml.cxx:1871
int fNAlloc
Definition TGHtml.h:1170
TGHtmlElement * TokenByIndex(int N, int flag)
Return a pointer to the Nth TGHtmlElement in the list.
void SetBaseUri(const char *uri)
Sets base URI.
Definition TGHtml.cxx:441
void AppendElement(TGHtmlElement *pElem)
Append the given TGHtmlElement to the tokenizers list of elements.
int fDirtyRight
Definition TGHtml.h:1268
int GetMarginHeight()
Definition TGHtml.h:964
void DeleteControls()
Delete all input controls.
void ImageChanged(TGHtmlImage *image, int newWidth, int newHeight)
This routine is called when an image changes.
virtual TImage * LoadImage(const char *uri, int w=0, int h=0)
This is the default LoadImage() procedure.
ColorStruct_t * AllocColorByValue(ColorStruct_t *color)
Allocate system color by value.
Definition TGHtml.cxx:281
void MakeInvisible(TGHtmlElement *p_first, TGHtmlElement *p_last)
Add the STY_Invisible style to every token between p_first and p_last.
virtual Bool_t HandleIdleEvent(TGIdleHandler *i)
Handles idle event.
Definition TGHtml.cxx:763
TGHtmlInput * fFirstInput
Definition TGHtml.h:1137
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 SetTableRelief(int relief)
Sets relief mode of html table.
Definition TGHtml.cxx:374
void AppendText(TGString *str, TGHtmlElement *pFirst, TGHtmlElement *pEnd)
Append all text and space tokens between pStart and pEnd to the given TString.
void UnmapControls()
Unmap any input control that is currently mapped.
ColorStruct_t * AllocColor(const char *name)
Allocate system color by name.
Definition TGHtml.cxx:262
TGString * TableText(TGHtmlTable *pTable, int flags)
Return text and images from a table as lists.
void DrawRect(Drawable_t drawable, TGHtmlElement *src, int x, int y, int w, int h, int depth, int relief)
Draw a rectangle.
int GetImageAlignment(TGHtmlElement *p)
Find the alignment for an image.
virtual int ProcessToken(TGHtmlElement *, const char *, int)
Definition TGHtml.h:927
void HClear()
Erase all data from the HTML widget. Bring it back to an empty screen.
Definition TGHtml.cxx:891
int fRowAlignment
Definition TGHtml.h:1190
THashTable * fUidTable
Definition TGHtml.h:1276
ColorStruct_t * fHighlightColorPtr
Definition TGHtml.h:1218
int fFormPadding
Definition TGHtml.h:1239
void AddSelectOptions(TGListBox *lb, TGHtmlElement *p, TGHtmlElement *pEnd)
The "p" argument points to a <select>.
GContext_t GetAnyGC()
Retrieve any valid GC.
Definition TGHtml.cxx:1107
TGHtmlElement * FindStartOfNextBlock(TGHtmlElement *p, int *pCnt)
Scan ahead looking for a place to put a block.
Html_16_t fSelStartIndex
Definition TGHtml.h:1151
virtual Bool_t ItemLayout()
Layout html widget.
Definition TGHtml.cxx:824
TGHtmlScript * fPScript
Definition TGHtml.h:1179
virtual int ProcessFrame()
Definition TGHtml.h:937
TGHtmlBlock * fFirstBlock
Definition TGHtml.h:1135
void DrawTableBgnd(int x, int y, int w, int h, Drawable_t d, TImage *image)
Draw table background.
void RedrawBlock(TGHtmlBlock *p)
Redraw the TGHtmlBlock given.
Definition TGHtml.cxx:856
int fInTr
Definition TGHtml.h:1193
TGIdleHandler * fIdle
Definition TGHtml.h:1181
int fMaxX
Definition TGHtml.h:1262
const char * GetUid(const char *string)
Given a string, this procedure returns a unique identifier for the string.
Definition TGHtml.cxx:480
void Redraw()
This routine is invoked in order to redraw all or part of the HTML widget.
Definition TGHtml.cxx:534
int GetLinkColor(const char *zURL)
For the markup <a href=XXX>, find out if the URL has been visited before or not.
Html_16_t fSelEndIndex
Definition TGHtml.h:1153
virtual char * GetFontName()
Definition TGHtml.h:953
TGHtmlAnchor * fAnchorStart
Definition TGHtml.h:1195
int GetColorByValue(ColorStruct_t *pRef)
Find a color integer for the color whose color components are given by pRef.
Definition TGHtml.cxx:1710
void Sizer()
Compute the size of all elements in the widget.
int fIDark[N_COLOR]
Definition TGHtml.h:1226
int fDirtyTop
Definition TGHtml.h:1265
const char * GetBaseUri() const
Definition TGHtml.h:906
int fHasFrames
Definition TGHtml.h:1244
Long_t fColorUsed
Definition TGHtml.h:1224
void DrawSelectionBackground(TGHtmlBlock *pBlock, Drawable_t Drawable_t, int x, int y)
Draw the selection background for the given block.
int fDirtyLeft
Definition TGHtml.h:1265
TGHtmlMarkupElement * MakeMarkupEntry(int objType, int type, int argc, int arglen[], char *argv[])
Make one markup entry.
GcCache_t fAGcCache[N_CACHE_GC]
Definition TGHtml.h:1233
TTimer * fInsTimer
Definition TGHtml.h:1161
TGHtmlElement * fPLast
Definition TGHtml.h:1129
SHtmlStyle_t PopStyleStack(int tag)
Pop a rendering style off of the stack.
void FreeColor(ColorStruct_t *color)
Free system color.
Definition TGHtml.cxx:253
void ComputeVirtualSize()
Computes virtual size of html area.
Definition TGHtml.cxx:498
int FormCount(TGHtmlInput *p, int radio)
Return the number of elments of type p in a form.
int TokenNumber(TGHtmlElement *p)
Return the token number for the given TGHtmlElement.
int fInTd
Definition TGHtml.h:1194
int fRulePadding
Definition TGHtml.h:1258
int fRuleRelief
Definition TGHtml.h:1257
TGHtmlElement * AttrElem(const char *name, char *value)
Returns html element matching attribute name and value.
Definition TGHtml.cxx:1850
int fGcNextToFree
Definition TGHtml.h:1234
virtual int IsVisited(const char *)
Definition TGHtml.h:923
GContext_t GetGC(int color, int font)
Return a GC from the cache.
Definition TGHtml.cxx:1037
virtual char * ResolveUri(const char *uri)
This function resolves the specified URI and returns the result in a newly allocated string.
int GetRulePadding() const
Definition TGHtml.h:901
int InArea(TGHtmlMapArea *p, int left, int top, int x, int y)
Only support rect and circles for now.
Definition TGHtml.cxx:1517
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:795
void PushStyleStack(int tag, SHtmlStyle_t style)
Push a new rendering style onto the stack.
TGHtmlElement * fNextPlaced
Definition TGHtml.h:1133
int fOverrideFonts
Definition TGHtml.h:1240
SHtmlTokenMap_t * GetMarkupMap(int n)
Returns token map at location n.
void SizeAndLink(TGFrame *frame, TGHtmlInput *pElem)
'frame' is the child widget that is used to implement an input element.
TImage * fBgImage
Definition TGHtml.h:1237
int fNComplete
Definition TGHtml.h:1171
int ControlSize(TGHtmlInput *p)
This routine implements the Sizer() function for <INPUT>, <SELECT> and <TEXTAREA> markup.
SHtmlTokenMap_t * NameToPmap(char *zType)
Returns token map matching zType name.
int fInDt
Definition TGHtml.h:1192
TGHtmlLayoutContext fLayoutContext
Definition TGHtml.h:1207
TGHtmlElement * FindEndNest(TGHtmlElement *sp, int en, TGHtmlElement *lp)
Find End tag en, but ignore intervening begin/end tag pairs.
int fExportSelection
Definition TGHtml.h:1251
ColorStruct_t * fBgColor
Definition TGHtml.h:1228
void RedrawEverything()
Call this routine to force the entire widget to be redrawn.
Definition TGHtml.cxx:867
char * DumpToken(TGHtmlElement *p)
For debugging purposes, print information about a token.
virtual void SubmitClicked(const char *val)
Emit SubmitClicked() signal.
Definition TGHtml.cxx:1329
void UnderlineLinks(int onoff)
Set/reset html links underline.
Definition TGHtml.cxx:398
int fHighlightWidth
Definition TGHtml.h:1211
SHtmlIndex_t fSelEnd
Definition TGHtml.h:1149
SHtmlStyle_t GetCurrentStyle()
Get the current rendering style.
int GetTableRelief() const
Definition TGHtml.h:897
int MapControls()
Map any control that should be visible according to the current scroll position.
TGHtmlImage * GetImage(TGHtmlImageMarkup *p)
Given an.
char * GetTokenName(TGHtmlElement *p)
Returns token name of html element p.
const char * GetText() const
Definition TGHtml.h:961
void ClearGcCache()
Clear the cache of GCs.
Definition TGHtml.cxx:506
void ResetBlocks()
Definition TGHtml.h:974
int GetIndex(const char *zIndex, TGHtmlElement **ppToken, int *pIndex)
This routine decodes a complete index specification.
ColorStruct_t * fOldLinkColor
Definition TGHtml.h:1231
TGHtmlForm * fLoFormStart
Definition TGHtml.h:1201
TGHtmlInput * fFormElemStart
Definition TGHtml.h:1197
ColorStruct_t * fApColor[N_COLOR]
Definition TGHtml.h:1223
virtual TGFrame * ProcessApplet(TGHtmlInput *)
Definition TGHtml.h:941
int ElementCoords(TGHtmlElement *p, int i, int pct, int *coords)
Return coordinates of item.
Definition TGHtml.cxx:1820
int fHasScript
Definition TGHtml.h:1243
TGHtmlElement * TableDimensions(TGHtmlTable *pStart, int lineWidth)
pStart points to a
int fTableRelief
Definition TGHtml.h:1256
void PrintList(TGHtmlElement *first, TGHtmlElement *last)
Print a list of tokens.
TGHtmlForm * fFormStart
Definition TGHtml.h:1196
float ColorDistance(ColorStruct_t *pA, ColorStruct_t *pB)
Compute the squared distance between two colors.
Definition TGHtml.cxx:1556
void FlashCursor()
Flash the insertion cursor.
Definition TGHtml.cxx:1016
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:1635
int GetRuleRelief() const
Definition TGHtml.h:900
int fInsStatus
Definition TGHtml.h:1160
Bool_t HandleHtmlInput(TGHtmlInput *pr, Event_t *event)
Handle html input (button, checkbox, ...) event.
Definition TGHtml.cxx:1166
int fInParse
Definition TGHtml.h:1271
void AddFormInfo(TGHtmlElement *p)
Add the DOM control information for form elements.
int DecodeBaseIndex(const char *zBase, TGHtmlElement **ppToken, int *pIndex)
Given a base index name (without any modifiers) return a pointer to the token described,...
void UnlinkAndFreeBlock(TGHtmlBlock *pBlock)
Destroy the given Block after first unlinking it from the element list.
int GetMarginWidth()
Definition TGHtml.h:963
int fTableBorderMin
Definition TGHtml.h:1246
SHtmlExtensions_t * fExts
Definition TGHtml.h:1274
char * fZBaseHref
Definition TGHtml.h:1260
TGHtmlInput * fLastInput
Definition TGHtml.h:1138
void ResetLayoutContext()
Reset the main layout context in the main widget.
Definition TGHtml.cxx:523
int fNText
Definition TGHtml.h:1169
Int_t fR
Definition TGDimension.h:84
Int_t fL
Definition TGDimension.h:83
Int_t fB
Definition TGDimension.h:86
Int_t fT
Definition TGDimension.h:85
THashTable implements a hash table to store TObject's.
Definition THashTable.h:35
An abstract interface to image processing library.
Definition TImage.h:29
Mother of all ROOT objects.
Definition TObject.h:37
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
Handles synchronous and a-synchronous timer events.
Definition TTimer.h:51
TText * text
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
Definition first.py:1
Event structure.
Definition GuiTypes.h:174
Html_u8_t fIndex
Definition TGHtml.h:824
Html_u8_t fFont
Definition TGHtml.h:822
Html_u8_t fColor
Definition TGHtml.h:823
GContext_t fGc
Definition TGHtml.h:821
SHtmlExtensions_t * fNext
Definition TGHtml.h:486
TGHtmlElement * fP
Definition TGHtml.h:832
SHtmlMargin_t * fPNext
Definition TGHtml.h:746
SHtmlStyle_t fStyle
Definition TGHtml.h:735
SHtmlStyleStack_t * fPNext
Definition TGHtml.h:733
unsigned int fColor
Definition TGHtml.h:145
signed int fSubscript
Definition TGHtml.h:146
unsigned int fExpbg
Definition TGHtml.h:149
unsigned int fAlign
Definition TGHtml.h:147
unsigned int fBgcolor
Definition TGHtml.h:148
unsigned int fFont
Definition TGHtml.h:144
unsigned int fFlags
Definition TGHtml.h:150
Html_16_t fObjType
Definition TGHtml.h:842
Html_16_t fType
Definition TGHtml.h:841
SHtmlTokenMap_t * fPCollide
Definition TGHtml.h:843
const char * fZName
Definition TGHtml.h:840
TCanvas * style()
Definition style.C:1