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;
47class TGPopupMenu;
48
49//----------------------------------------------------------------------
50
51#define HTML_RELIEF_FLAT 0
52#define HTML_RELIEF_SUNKEN 1
53#define HTML_RELIEF_RAISED 2
54
55//#define TABLE_TRIM_BLANK 1
56
57// Debug must be turned on for testing to work.
58//#define DEBUG
59
60#define CANT_HAPPEN \
61 fprintf(stderr, \
62 "Unplanned behavior in the HTML Widget in file %s line %d\n", \
63 __FILE__, __LINE__)
64
65#define UNTESTED \
66 fprintf(stderr, \
67 "Untested code executed in the HTML Widget in file %s line %d\n", \
68 __FILE__, __LINE__)
69
70// Sanity checking macros.
71
72#ifdef DEBUG
73#define HtmlAssert(X) \
74 if(!(X)){ \
75 fprintf(stderr,"Assertion failed on line %d of %s\n",__LINE__,__FILE__); \
76 }
77#define HtmlCantHappen \
78 fprintf(stderr,"Can't happen on line %d of %s\n",__LINE__,__FILE__);
79#else
80#define HtmlAssert(X)
81#define HtmlCantHappen
82#endif
83
84// Bitmasks for the HtmlTraceMask global variable
85
86#define HtmlTrace_Table1 0x00000001
87#define HtmlTrace_Table2 0x00000002
88#define HtmlTrace_Table3 0x00000004
89#define HtmlTrace_Table4 0x00000008
90#define HtmlTrace_Table5 0x00000010
91#define HtmlTrace_Table6 0x00000020
92#define HtmlTrace_GetLine 0x00000100
93#define HtmlTrace_GetLine2 0x00000200
94#define HtmlTrace_FixLine 0x00000400
95#define HtmlTrace_BreakMarkup 0x00001000
96#define HtmlTrace_Style 0x00002000
97#define HtmlTrace_Input1 0x00004000
98
99// The TRACE macro is used to print internal information about the
100// HTML layout engine during testing and debugging. The amount of
101// information printed is governed by a global variable named
102// HtmlTraceMask. If bits in the first argument to the TRACE macro
103// match any bits in HtmlTraceMask variable, then the trace message
104// is printed.
105//
106// All of this is completely disabled, of course, if the DEBUG macro
107// is not defined.
108
109#ifdef DEBUG
110extern int HtmlTraceMask;
111extern int HtmlDepth;
112# define TRACE_INDENT printf("%*s",HtmlDepth-3,"")
113# define TRACE(Flag, Args) \
114 if( (Flag)&HtmlTraceMask ){ \
115 TRACE_INDENT; printf Args; fflush(stdout); \
116 }
117# define TRACE_PUSH(Flag) if( (Flag)&HtmlTraceMask ){ HtmlDepth+=3; }
118# define TRACE_POP(Flag) if( (Flag)&HtmlTraceMask ){ HtmlDepth-=3; }
119#else
120# define TRACE_INDENT
121# define TRACE(Flag, Args)
122# define TRACE_PUSH(Flag)
123# define TRACE_POP(Flag)
124#endif
125
126
127//----------------------------------------------------------------------
128
129// Various data types. This code is designed to run on a modern cached
130// architecture where the CPU runs a lot faster than the memory bus. Hence
131// we try to pack as much data into as small a space as possible so that it
132// is more likely to fit in cache. The extra CPU instruction or two needed
133// to unpack the data is not normally an issue since we expect the speed of
134// the memory bus to be the limiting factor.
135
136typedef unsigned char Html_u8_t; // 8-bit unsigned integer
137typedef short Html_16_t; // 16-bit signed integer
138typedef unsigned short Html_u16_t; // 16-bit unsigned integer
139typedef int Html_32_t; // 32-bit signed integer
140
141// An instance of the following structure is used to record style
142// information on each Html element.
143
145 unsigned int fFont : 6; // Font to use for display
146 unsigned int fColor : 6; // Foreground color
147 signed int fSubscript : 4; // Positive for <sup>, negative for <sub>
148 unsigned int fAlign : 2; // Horizontal alignment
149 unsigned int fBgcolor : 6; // Background color
150 unsigned int fExpbg : 1; // Set to 1 if bgcolor explicitly set
151 unsigned int fFlags : 7; // the STY_ flags below
152};
153
154
155// We allow 8 different font families: Normal, Bold, Italic and Bold-Italic
156// in either variable or constant width. Within each family there can be up
157// to 7 font sizes from 1 (the smallest) up to 7 (the largest). Hence, the
158// widget can use a maximum of 56 fonts. The ".font" field of the style is
159// an integer between 0 and 55 which indicates which font to use.
160
161// HP: we further subdivide the .font field into two 3-bit subfields (size
162// and family). That makes easier to manipulate the family field.
163
164#define N_FONT_FAMILY 8
165#define N_FONT_SIZE 7
166#define N_FONT 71
167#define NormalFont(X) (X)
168#define BoldFont(X) ((X) | 8)
169#define ItalicFont(X) ((X) | 16)
170#define CWFont(X) ((X) | 32)
171#define FontSize(X) ((X) & 007)
172#define FontFamily(X) ((X) & 070)
173#define FONT_Any -1
174#define FONT_Default 3
175#define FontSwitch(Size, Bold, Italic, Cw) \
176 ((Size) | ((Bold+(Italic)*2+(Cw)*4) << 3))
177
178// Macros for manipulating the fontValid bitmap of an TGHtml object.
179
180#define FontIsValid(I) ((fFontValid[(I)>>3] & (1<<((I)&3)))!=0)
181#define FontSetValid(I) (fFontValid[(I)>>3] |= (1<<((I)&3)))
182#define FontClearValid(I) (fFontValid[(I)>>3] &= ~(1<<((I)&3)))
183
184
185// Information about available colors.
186//
187// The widget will use at most N_COLOR colors. 4 of these colors are
188// predefined. The rest are user selectable by options to various markups.
189// (Ex: <font color=red>)
190//
191// All colors are stored in the apColor[] array of the main widget object.
192// The ".color" field of the SHtmlStyle_t is an integer between 0 and
193// N_COLOR-1 which indicates which of these colors to use.
194
195#define N_COLOR 32 // Total number of colors
196
197#define COLOR_Normal 0 // Index for normal color (black)
198#define COLOR_Unvisited 1 // Index for unvisited hyperlinks
199#define COLOR_Visited 2 // Color for visited hyperlinks
200#define COLOR_Selection 3 // Background color for the selection
201#define COLOR_Background 4 // Default background color
202#define N_PREDEFINED_COLOR 5 // Number of predefined colors
203
204
205// The "align" field of the style determines how text is justified
206// horizontally. ALIGN_None means that the alignment is not specified.
207// (It should probably default to ALIGN_Left in this case.)
208
209#define ALIGN_Left 1
210#define ALIGN_Right 2
211#define ALIGN_Center 3
212#define ALIGN_None 0
213
214
215// Possible value of the "flags" field of SHtmlStyle_t are shown below.
216//
217// STY_Preformatted If set, the current text occurred within
218// <pre>..</pre>
219//
220// STY_StrikeThru Draw a solid line thru the middle of this text.
221//
222// STY_Underline This text should drawn with an underline.
223//
224// STY_NoBreak This text occurs within <nobr>..</nobr>
225//
226// STY_Anchor This text occurs within <a href=X>..</a>.
227//
228// STY_DT This text occurs within <dt>..</dt>.
229//
230// STY_Invisible This text should not appear in the main HTML
231// window. (For example, it might be within
232// <title>..</title> or <marquee>..</marquee>.)
233
234#define STY_Preformatted 0x001
235#define STY_StrikeThru 0x002
236#define STY_Underline 0x004
237#define STY_NoBreak 0x008
238#define STY_Anchor 0x010
239#define STY_DT 0x020
240#define STY_Invisible 0x040
241#define STY_FontMask (STY_StrikeThru|STY_Underline)
242
243
244//----------------------------------------------------------------------
245// The first thing done with input HTML text is to parse it into
246// TGHtmlElements. All sizing and layout is done using these elements.
247
248// Every element contains at least this much information:
249
250class TGHtmlElement : public TObject {
251public:
252 TGHtmlElement(int etype = 0);
253
254 virtual int IsMarkup() const { return (fType > Html_Block); }
255 virtual const char *MarkupArg(const char * /*tag*/, const char * /*zDefault*/) { return nullptr; }
256 virtual int GetAlignment(int dflt) { return dflt; }
257 virtual int GetOrderedListType(int dflt) { return dflt; }
258 virtual int GetUnorderedListType(int dflt) { return dflt; }
259 virtual int GetVerticalAlignment(int dflt) { return dflt; }
260
261public:
262 TGHtmlElement *fPNext; // Next input token in a list of them all
263 TGHtmlElement *fPPrev; // Previous token in a list of them all
264 SHtmlStyle_t fStyle; // The rendering style for this token
265 Html_u8_t fType; // The token type.
266 Html_u8_t fFlags; // The HTML_ flags below
267 Html_16_t fCount; // Various uses, depending on "type"
268 int fElId; // Unique identifier
269 int fOffs; // Offset within zText
270};
271
272
273// Bitmasks for the "flags" field of the TGHtmlElement
274
275#define HTML_Visible 0x01 // This element produces "ink"
276#define HTML_NewLine 0x02 // type == Html_Space and ends with newline
277#define HTML_Selected 0x04 // Some or all of this Html_Block is selected
278 // Used by Html_Block elements only.
279
280
281// Each text element holds additional information as shown here. Notice that
282// extra space is allocated so that zText[] will be large enough to hold the
283// complete text of the element. X and y coordinates are relative to the
284// virtual canvas. The y coordinate refers to the baseline.
285
287private:
290
291public:
293 ~TGHtmlTextElement() override;
294
295 Html_32_t fY; // y coordinate where text should be rendered
296 Html_16_t fX; // x coordinate where text should be rendered
297 Html_16_t fW; // width of this token in pixels
298 Html_u8_t fAscent; // height above the baseline
299 Html_u8_t fDescent; // depth below the baseline
300 Html_u8_t fSpaceWidth; // Width of one space in the current font
301 char *fZText; // Text for this element. Null terminated
302};
303
304
305// Each space element is represented like this:
306
308public:
309 Html_16_t fW; // Width of a single space in current font
310 Html_u8_t fAscent; // height above the baseline
311 Html_u8_t fDescent; // depth below the baseline
312
313public:
315};
316
317// Most markup uses this class. Some markup extends this class with
318// additional information, but most use it as is, at the very least.
319//
320// If the markup doesn't have arguments (the "count" field of
321// TGHtmlElement is 0) then the extra "argv" field of this class
322// is not allocated and should not be used.
323
325public:
326 TGHtmlMarkupElement(int type, int argc, int arglen[], char *argv[]);
327 ~TGHtmlMarkupElement() override;
328
329 const char *MarkupArg(const char *tag, const char *zDefault) override;
330 int GetAlignment(int dflt) override;
331 int GetOrderedListType(int dflt) override;
332 int GetUnorderedListType(int dflt) override;
333 int GetVerticalAlignment(int dflt) override;
334
335public://protected:
336 char **fArgv;
337};
338
339
340// The maximum number of columns allowed in a table. Any columns beyond
341// this number are ignored.
342
343#define HTML_MAX_COLUMNS 40
344
345
346// This class is used for each <table> element.
347//
348// In the minW[] and maxW[] arrays, the [0] element is the overall
349// minimum and maximum width, including cell padding, spacing and
350// the "hspace". All other elements are the minimum and maximum
351// width for the contents of individual cells without any spacing or
352// padding.
353
355public:
356 TGHtmlTable(int type, int argc, int arglen[], char *argv[]);
357 ~TGHtmlTable() override;
358
359public:
360 Html_u8_t fBorderWidth; // Width of the border
361 Html_u8_t fNCol; // Number of columns
362 Html_u16_t fNRow; // Number of rows
363 Html_32_t fY; // top edge of table border
364 Html_32_t fH; // height of the table border
365 Html_16_t fX; // left edge of table border
366 Html_16_t fW; // width of the table border
367 int fMinW[HTML_MAX_COLUMNS+1]; // minimum width of each column
368 int fMaxW[HTML_MAX_COLUMNS+1]; // maximum width of each column
369 TGHtmlElement *fPEnd; // Pointer to the end tag element
370 TImage *fBgImage; // A background for the entire table
371 int fHasbg; // 1 if a table above has bgImage
372};
373
374
375// Each <td> or <th> markup is represented by an instance of the
376// following class.
377//
378// Drawing for a cell is a sunken 3D border with the border width given
379// by the borderWidth field in the associated <table> object.
380
382public:
383 TGHtmlCell(int type, int argc, int arglen[], char *argv[]);
384 ~TGHtmlCell() override;
385
386public:
387 Html_16_t fRowspan; // Number of rows spanned by this cell
388 Html_16_t fColspan; // Number of columns spanned by this cell
389 Html_16_t fX; // X coordinate of left edge of border
390 Html_16_t fW; // Width of the border
391 Html_32_t fY; // Y coordinate of top of border indentation
392 Html_32_t fH; // Height of the border
393 TGHtmlTable *fPTable; // Pointer back to the <table>
394 TGHtmlElement *fPRow; // Pointer back to the <tr>
395 TGHtmlElement *fPEnd; // Element that ends this cell
396 TImage *fBgImage; // Background for the cell
397};
398
399
400// This class is used for </table>, </td>, <tr>, </tr> and </th> elements.
401// It points back to the <table> element that began the table. It is also
402// used by </a> to point back to the original <a>. I'll probably think of
403// other uses before all is said and done...
404
406public:
407 TGHtmlRef(int type, int argc, int arglen[], char *argv[]);
408 ~TGHtmlRef() override;
409
410public:
411 TGHtmlElement *fPOther; // Pointer to some other Html element
412 TImage *fBgImage; // A background for the entire row
413};
414
415
416// An instance of the following class is used to represent
417// each <LI> markup.
418
420public:
421 TGHtmlLi(int type, int argc, int arglen[], char *argv[]);
422
423public:
424 Html_u8_t fLtype; // What type of list is this?
425 Html_u8_t fAscent; // height above the baseline
426 Html_u8_t fDescent; // depth below the baseline
427 Html_16_t fCnt; // Value for this element (if inside <OL>)
428 Html_16_t fX; // X coordinate of the bullet
429 Html_32_t fY; // Y coordinate of the bullet
430};
431
432
433// The ltype field of an TGHtmlLi or TGHtmlListStart object can take on
434// any of the following values to indicate what type of bullet to draw.
435// The value in TGHtmlLi will take precedence over the value in
436// TGHtmlListStart if the two values differ.
437
438#define LI_TYPE_Undefined 0 // If in TGHtmlLi, use the TGHtmlListStart value
439#define LI_TYPE_Bullet1 1 // A solid circle
440#define LI_TYPE_Bullet2 2 // A hollow circle
441#define LI_TYPE_Bullet3 3 // A hollow square
442#define LI_TYPE_Enum_1 4 // Arabic numbers
443#define LI_TYPE_Enum_A 5 // A, B, C, ...
444#define LI_TYPE_Enum_a 6 // a, b, c, ...
445#define LI_TYPE_Enum_I 7 // Capitalized roman numerals
446#define LI_TYPE_Enum_i 8 // Lower-case roman numerals
447
448
449// An instance of this class is used for <UL> or <OL> markup.
450
452public:
453 TGHtmlListStart(int type, int argc, int arglen[], char *argv[]);
454
455public:
456 Html_u8_t fLtype; // One of the LI_TYPE_ defines above
457 Html_u8_t fCompact; // True if the COMPACT flag is present
458 Html_u16_t fCnt; // Next value for <OL>
459 Html_u16_t fWidth; // How much space to allow for indentation
460 TGHtmlListStart *fLPrev; // Next higher level list, or NULL
461};
462
463
464#define HTML_MAP_RECT 1
465#define HTML_MAP_CIRCLE 2
466#define HTML_MAP_POLY 3
467
469public:
470 TGHtmlMapArea(int type, int argc, int arglen[], char *argv[]);
471
472public:
475 int fNum;
476};
477
478
479//----------------------------------------------------------------------
480
481// Structure to chain extension data onto.
482
484 void *fExts;
485 int fTyp;
488};
489
490
491//----------------------------------------------------------------------
492
493// Information about each image on the HTML widget is held in an instance
494// of the following class. All images are held on a list attached to the
495// main widget object.
496//
497// This class is NOT an element. The <IMG> element is represented by an
498// TGHtmlImageMarkup object below. There is one TGHtmlImageMarkup for each
499// <IMG> in the source HTML. There is one of these objects for each unique
500// image loaded. (If two <IMG> specify the same image, there are still two
501// TGHtmlImageMarkup objects but only one TGHtmlImage object that is shared
502// between them.)
503
504class TGHtml;
506
507class TGHtmlImage : public TObject {
508private:
509 TGHtmlImage(const TGHtmlImage&) = delete;
511
512public:
513 TGHtmlImage(TGHtml *htm, const char *url, const char *width,
514 const char *height);
515 ~TGHtmlImage() override;
516
517public:
518 TGHtml *fHtml; // The owner of this image
519 TImage *fImage; // The image token
520 Html_32_t fW; // Requested width of this image (0 if none)
521 Html_32_t fH; // Requested height of this image (0 if none)
522 char *fZUrl; // The URL for this image.
523 char *fZWidth, *fZHeight; // Width and height in the <img> markup.
524 TGHtmlImage *fPNext; // Next image on the list
525 TGHtmlImageMarkup *fPList; // List of all <IMG> markups that use this
526 // same image
527 TTimer *fTimer; // for animations
528};
529
530// Each <img> markup is represented by an instance of the following
531// class.
532//
533// If pImage == 0, then we use the alternative text in zAlt.
534
536public:
537 TGHtmlImageMarkup(int type, int argc, int arglen[], char *argv[]);
538
539public:
540 Html_u8_t fAlign; // Alignment. See IMAGE_ALIGN_ defines below
541 Html_u8_t fTextAscent; // Ascent of text font in force at the <IMG>
542 Html_u8_t fTextDescent; // Descent of text font in force at the <IMG>
543 Html_u8_t fRedrawNeeded; // Need to redraw this image because the image
544 // content changed.
545 Html_16_t fH; // Actual height of the image
546 Html_16_t fW; // Actual width of the image
547 Html_16_t fAscent; // How far image extends above "y"
548 Html_16_t fDescent; // How far image extends below "y"
549 Html_16_t fX; // X coordinate of left edge of the image
550 Html_32_t fY; // Y coordinate of image baseline
551 const char *fZAlt; // Alternative text
552 TGHtmlImage *fPImage; // Corresponding TGHtmlImage object
554 TGHtmlImageMarkup *fINext; // Next markup using the same TGHtmlImage object
555};
556
557
558// Allowed alignments for images. These represent the allowed arguments
559// to the "align=" field of the <IMG> markup.
560
561#define IMAGE_ALIGN_Bottom 0
562#define IMAGE_ALIGN_Middle 1
563#define IMAGE_ALIGN_Top 2
564#define IMAGE_ALIGN_TextTop 3
565#define IMAGE_ALIGN_AbsMiddle 4
566#define IMAGE_ALIGN_AbsBottom 5
567#define IMAGE_ALIGN_Left 6
568#define IMAGE_ALIGN_Right 7
569
570
571// All kinds of form markup, including <INPUT>, <TEXTAREA> and <SELECT>
572// are represented by instances of the following class.
573//
574// (later...) We also use this for the <APPLET> markup. That way,
575// the window we create for an <APPLET> responds to the TGHtml::MapControls()
576// and TGHtml::UnmapControls() function calls. For an <APPLET>, the
577// pForm field is NULL. (Later still...) <EMBED> works just like
578// <APPLET> so it uses this class too.
579
580class TGHtmlForm;
581
583public:
584 TGHtmlInput(int type, int argc, int arglen[], char *argv[]);
585
586 void Empty();
587
588public:
589 TGHtmlForm *fPForm; // The <FORM> to which this belongs
590 TGHtmlInput *fINext; // Next element in a list of all input elements
591 TGFrame *fFrame; // The xclass window that implements this control
592 TGHtml *fHtml; // The HTML widget this control is attached to
593 TGHtmlElement *fPEnd; // End tag for <TEXTAREA>, etc.
594 Html_u16_t fInpId; // Unique id for this element
595 Html_u16_t fSubId; // For radio - an id, for select - option count
596 Html_32_t fY; // Baseline for this input element
597 Html_u16_t fX; // Left edge
598 Html_u16_t fW, fH; // Width and height of this control
599 Html_u8_t fPadLeft; // Extra padding on left side of the control
600 Html_u8_t fAlign; // One of the IMAGE_ALIGN_xxx types
601 Html_u8_t fTextAscent; // Ascent for the current font
602 Html_u8_t fTextDescent; // descent for the current font
603 Html_u8_t fItype; // What type of input is this?
604 Html_u8_t fSized; // True if this input has been sized already
605 Html_u16_t fCnt; // Used to derive widget name. 0 if no widget
606};
607
608
609// An input control can be one of the following types. See the
610// comment about <APPLET> on the TGHtmlInput class insight into
611// INPUT_TYPE_Applet.
612
613#define INPUT_TYPE_Unknown 0
614#define INPUT_TYPE_Checkbox 1
615#define INPUT_TYPE_File 2
616#define INPUT_TYPE_Hidden 3
617#define INPUT_TYPE_Image 4
618#define INPUT_TYPE_Password 5
619#define INPUT_TYPE_Radio 6
620#define INPUT_TYPE_Reset 7
621#define INPUT_TYPE_Select 8
622#define INPUT_TYPE_Submit 9
623#define INPUT_TYPE_Text 10
624#define INPUT_TYPE_TextArea 11
625#define INPUT_TYPE_Applet 12
626#define INPUT_TYPE_Button 13
627
628
629// There can be multiple <FORM> entries on a single HTML page.
630// Each one must be given a unique number for identification purposes,
631// and so we can generate unique state variable names for radiobuttons,
632// checkbuttons, and entry boxes.
633
635public:
636 TGHtmlForm(int type, int argc, int arglen[], char *argv[]);
637
638public:
639 Html_u16_t fFormId; // Unique number assigned to this form
640 unsigned int fElements; // Number of elements
641 unsigned int fHasctl; // Has controls
642 TGHtmlElement *fPFirst; // First form element
643 TGHtmlElement *fPEnd; // Pointer to end tag element
644};
645
646
647// Information used by a <HR> markup
648
650public:
651 TGHtmlHr(int type, int argc, int arglen[], char *argv[]);
652
653public:
654 Html_32_t fY; // Baseline for this input element
655 Html_u16_t fX; // Left edge
656 Html_u16_t fW, fH; // Width and height of this control
657 Html_u8_t fIs3D; // Is it drawn 3D?
658};
659
660
661// Information used by a <A> markup
662
664public:
665 TGHtmlAnchor(int type, int argc, int arglen[], char *argv[]);
666
667public:
668 Html_32_t fY; // Top edge for this element
669};
670
671
672// Information about the <SCRIPT> markup. The parser treats <SCRIPT>
673// specially. All text between <SCRIPT> and </SCRIPT> is captured and
674// is indexed to by the nStart field of this class.
675//
676// The nStart field indexs to a spot in the zText field of the TGHtml object.
677// The nScript field determines how long the script is.
678
680public:
681 TGHtmlScript(int type, int argc, int arglen[], char *argv[]);
682
683public:
684 int fNStart; // Start of the script (index into TGHtml::zText)
685 int fNScript; // Number of characters of text in zText holding
686 // the complete text of this script
687};
688
689
690// A block is a single unit of display information. This can be one or more
691// text elements, or the border of table, or an image, etc.
692//
693// Blocks are used to improve display speed and to improve the speed of
694// linear searchs through the token list. A single block will typically
695// contain enough information to display a dozen or more Text and Space
696// elements all with a single call to OXFont::DrawChars(). The blocks are
697// linked together on their own list, so we can search them much faster than
698// elements (since there are fewer of them.)
699//
700// Of course, you can construct pathological HTML that has as many Blocks as
701// it has normal tokens. But you haven't lost anything. Using blocks just
702// speeds things up in the common case.
703//
704// Much of the information needed for display is held in the original
705// TGHtmlElement objects. "fPNext" points to the first object in the list
706// which can be used to find the "style" "x" and "y".
707//
708// If n is zero, then "fPNext" might point to a special TGHtmlElement
709// that defines some other kind of drawing, like <LI> or <IMG> or <INPUT>.
710
712public:
713 TGHtmlBlock();
714 ~TGHtmlBlock() override;
715
716public:
717 char *fZ; // Space to hold text when n > 0
718 int fTop, fBottom; // Extremes of y coordinates
719 Html_u16_t fLeft, fRight; // Left and right boundry of this object
720 Html_u16_t fN; // Number of characters in z[]
721 TGHtmlBlock *fBPrev, *fBNext; // Linked list of all Blocks
722};
723
724
725// A stack of these structures is used to keep track of nested font and
726// style changes. This allows us to easily revert to the previous style
727// when we encounter and end-tag like </em> or </h3>.
728//
729// This stack is used to keep track of the current style while walking
730// the list of elements. After all elements have been assigned a style,
731// the information in this stack is no longer used.
732
734 SHtmlStyleStack_t *fPNext; // Next style on the stack
735 int fType; // A markup that ends this style. Ex: Html_EndEM
736 SHtmlStyle_t fStyle; // The currently active style.
737};
738
739
740// A stack of the following structures is used to remember the
741// left and right margins within a layout context.
742
744 int fIndent; // Size of the current margin
745 int fBottom; // Y value at which this margin expires
746 int fTag; // Markup that will cancel this margin
747 SHtmlMargin_t *fPNext; // Previous margin
748};
749
750
751// How much space (in pixels) used for a single level of indentation due
752// to a <UL> or <DL> or <BLOCKQUOTE>, etc.
753
754#define HTML_INDENT 36
755
756
757//----------------------------------------------------------------------
758
759// A layout context holds all state information used by the layout engine.
760
762public:
764
765 void LayoutBlock();
766 void Reset();
767
768 void PopIndent();
769 void PushIndent();
770
771protected:
772 void PushMargin(SHtmlMargin_t **ppMargin, int indent, int bottom, int tag);
773 void PopOneMargin(SHtmlMargin_t **ppMargin);
774 void PopMargin(SHtmlMargin_t **ppMargin, int tag);
775 void PopExpiredMargins(SHtmlMargin_t **ppMarginStack, int y);
776 void ClearMarginStack(SHtmlMargin_t **ppMargin);
777
779 int width, int minX, int *actualWidth);
780
781 void FixAnchors(TGHtmlElement *p, TGHtmlElement *pEnd, int y);
782 int FixLine(TGHtmlElement *pStart, TGHtmlElement *pEnd,
783 int bottom, int width, int actualWidth, int leftMargin,
784 int *maxX);
786 void ComputeMargins(int *pX, int *pY, int *pW);
787 void ClearObstacle(int mode);
789 int InWrapAround();
790 void WidenLine(int reqWidth, int *pX, int *pY, int *pW);
791
793
794public:
795 TGHtml *fHtml; // The html widget undergoing layout
796 TGHtmlElement *fPStart; // Start of elements to layout
797 TGHtmlElement *fPEnd; // Stop when reaching this element
798 int fHeadRoom; // Extra space wanted above this line
799 int fTop; // Absolute top of drawing area
800 int fBottom; // Bottom of previous line
801 int fLeft, fRight; // Left and right extremes of drawing area
802 int fPageWidth; // Width of the layout field, including
803 // the margins
804 int fMaxX, fMaxY; // Maximum X and Y values of paint
805 SHtmlMargin_t *fLeftMargin; // Stack of left margins
806 SHtmlMargin_t *fRightMargin; // Stack of right margins
807};
808
809
810// With 28 different fonts and 16 colors, we could in principle have
811// as many as 448 different GCs. But in practice, a single page of
812// HTML will typically have much less than this. So we won't try to
813// keep all GCs on hand. Instead, we'll keep around the most recently
814// used GCs and allocate new ones as necessary.
815//
816// The following structure is used to build a cache of GCs in the
817// main widget object.
818
819#define N_CACHE_GC 32
820
821struct GcCache_t {
822 GContext_t fGc; // The graphics context
823 Html_u8_t fFont; // Font used for this context
824 Html_u8_t fColor; // Color used for this context
825 Html_u8_t fIndex; // Index used for LRU replacement
826};
827
828
829// An SHtmlIndex_t is a reference to a particular character within a
830// particular Text or Space token.
831
833 TGHtmlElement *fP; // The token containing the character
834 int fI; // Index of the character
835};
836
837
838// Used by the tokenizer
839
841 const char *fZName; // Name of a markup
842 Html_16_t fType; // Markup type code
843 Html_16_t fObjType; // Which kind of TGHtml... object to alocate
844 SHtmlTokenMap_t *fPCollide; // Hash table collision chain
845};
846
847
848// Markup element types to be allocated by the tokenizer.
849// Do not confuse with .type field in TGHtmlElement
850
851#define O_HtmlMarkupElement 0
852#define O_HtmlCell 1
853#define O_HtmlTable 2
854#define O_HtmlRef 3
855#define O_HtmlLi 4
856#define O_HtmlListStart 5
857#define O_HtmlImageMarkup 6
858#define O_HtmlInput 7
859#define O_HtmlForm 8
860#define O_HtmlHr 9
861#define O_HtmlAnchor 10
862#define O_HtmlScript 11
863#define O_HtmlMapArea 12
864
865
866//----------------------------------------------------------------------
867
868// The HTML widget. A derivate of TGView.
869
870class TGListBox;
871class THashTable;
872
873class TGHtml : public TGView {
874public:
875 TGHtml(const TGWindow *p, int w, int h, int id = -1);
876 ~TGHtml() override;
877
879 Bool_t HandleButton(Event_t *event) override;
880 Bool_t HandleMotion(Event_t *event) override;
881
883 Bool_t HandleTimer(TTimer *timer) override;
884
886
887 void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h) override;
888 Bool_t ItemLayout() override;
889
892
893public: // user commands
894
895 int ParseText(char *text, const char *index = nullptr);
896
897 void SetTableRelief(int relief);
898 int GetTableRelief() const { return fTableRelief; }
899
900 void SetRuleRelief(int relief);
901 int GetRuleRelief() const { return fRuleRelief; }
902 int GetRulePadding() const { return fRulePadding; }
903
904 void UnderlineLinks(int onoff);
905
906 void SetBaseUri(const char *uri);
907 const char *GetBaseUri() const { return fZBase; }
908
909 int GotoAnchor(const char *name);
910
911public: // reloadable methods
912
913 // called when the widget is cleared
914 void Clear(Option_t * = "") override;
915
916 // User function to resolve URIs
917 virtual char *ResolveUri(const char *uri);
918
919 // User function to get an image from a URL
920 virtual TImage *LoadImage(const char *uri, int w = 0, int h = 0) ;//
921 // { return 0; }
922
923 // User function to tell if a hyperlink has already been visited
924 virtual int IsVisited(const char * /*url*/)
925 { return kFALSE; }
926
927 // User function to process tokens of the given type
928 virtual int ProcessToken(TGHtmlElement * /*pElem*/, const char * /*name*/, int /*type*/)
929 { return kFALSE; }
930
931 virtual TGFont *GetFont(int iFont);
932
933 // The HTML parser will invoke the following methods from time
934 // to time to find out information it needs to complete formatting of
935 // the document.
936
937 // Method for handling <frameset> markup
938 virtual int ProcessFrame()
939 { return kFALSE; }
940
941 // Method to process applets
942 virtual TGFrame *ProcessApplet(TGHtmlInput * /*input*/)
943 { return nullptr; }
944
945 // Called when parsing forms
946 virtual int FormCreate(TGHtmlForm * /*form*/, const char * /*zUrl*/, const char * /*args*/)
947 { return kFALSE; }
948
949 // Called when user presses Submit
950 virtual int FormAction(TGHtmlForm * /*form*/, int /*id*/)
951 { return kFALSE; }
952
953 // Invoked to find font names
954 virtual char *GetFontName()
955 { return nullptr; }
956
957 // Invoked for each <SCRIPT> markup
958 virtual char *ProcessScript(TGHtmlScript * /*script*/)
959 { return nullptr; }
960
961public:
962 const char *GetText() const { return fZText; }
963
964 void HandleMenu(Int_t);
965 void SaveFileAs();
966
969
970 TGHtmlInput *GetInputElement(int x, int y);
971 const char *GetHref(int x, int y, const char **target = nullptr);
972
974
975 int InArea(TGHtmlMapArea *p, int left, int top, int x, int y);
976 TGHtmlElement *GetMap(const char *name);
977
978 void ResetBlocks() { fFirstBlock = fLastBlock = nullptr; }
979 int ElementCoords(TGHtmlElement *p, int i, int pct, int *coords);
980
981 TGHtmlElement *TableDimensions(TGHtmlTable *pStart, int lineWidth);
982 int CellSpacing(TGHtmlElement *pTable);
983 void MoveVertically(TGHtmlElement *p, TGHtmlElement *pLast, int dy);
984
986
988 char *DumpToken(TGHtmlElement *p);
989
990 void EncodeText(TGString *str, const char *z);
991
992protected:
993 void HClear();
994 void ClearGcCache();
995 void ResetLayoutContext();
996 void Redraw();
997 void ComputeVirtualSize();
998
999 void ScheduleRedraw();
1000
1001 void RedrawArea(int left, int top, int right, int bottom);
1002 void RedrawBlock(TGHtmlBlock *p);
1003 void RedrawEverything();
1004 void RedrawText(int y);
1005
1009 int GetColorByName(const char *zColor);
1010 int GetDarkShadowColor(int iBgColor);
1011 int GetLightShadowColor(int iBgColor);
1012 int GetColorByValue(ColorStruct_t *pRef);
1013
1014 void FlashCursor();
1015
1016 GContext_t GetGC(int color, int font);
1018
1019 void AnimateImage(TGHtmlImage *image);
1020 void ImageChanged(TGHtmlImage *image, int newWidth, int newHeight);
1022 int GetImageAt(int x, int y);
1023 const char *GetPctWidth(TGHtmlElement *p, char *opt, char *ret);
1025
1027 void UnlinkAndFreeBlock(TGHtmlBlock *pBlock);
1028 void AppendBlock(TGHtmlElement *pToken, TGHtmlBlock *pBlock);
1029
1030 void StringHW(const char *str, int *h, int *w);
1031 TGHtmlElement *MinMax(TGHtmlElement *p, int *pMin, int *pMax,
1032 int lineWidth, int hasbg);
1033
1035 int x, int y);
1036 void DrawRect(Drawable_t drawable, TGHtmlElement *src,
1037 int x, int y, int w, int h, int depth, int relief);
1038 void BlockDraw(TGHtmlBlock *pBlock, Drawable_t wid,
1039 int left, int top,
1040 int width, int height, Pixmap_t pixmap);
1042 int left, int top,
1043 int right, int bottom);
1044 void DrawTableBgnd(int x, int y, int w, int h, Drawable_t d, TImage *image);
1045
1047 void FormBlocks();
1048
1049 void AppendElement(TGHtmlElement *pElem);
1050 int Tokenize();
1051 void AppToken(TGHtmlElement *pNew, TGHtmlElement *p, int offs);
1052 TGHtmlMarkupElement *MakeMarkupEntry(int objType, int type, int argc,
1053 int arglen[], char *argv[]);
1054 void TokenizerAppend(const char *text);
1056 char *zType, char *zArgs, int offs);
1057 SHtmlTokenMap_t *NameToPmap(char *zType);
1058 int NameToType(char *zType);
1059 const char *TypeToName(int type);
1060 int TextInsertCmd(int argc, char **argv);
1062
1063 TGHtmlElement *TokenByIndex(int N, int flag);
1065
1066 void MaxIndex(TGHtmlElement *p, int *pIndex, int isLast);
1067 int IndexMod(TGHtmlElement **pp, int *ip, char *cp);
1068 void FindIndexInBlock(TGHtmlBlock *pBlock, int x,
1069 TGHtmlElement **ppToken, int *pIndex);
1070 void IndexToBlockIndex(SHtmlIndex_t sIndex,
1071 TGHtmlBlock **ppBlock, int *piIndex);
1072 int DecodeBaseIndex(const char *zBase,
1073 TGHtmlElement **ppToken, int *pIndex);
1074 int GetIndex(const char *zIndex, TGHtmlElement **ppToken, int *pIndex);
1075
1076 void LayoutDoc();
1077
1078 int MapControls();
1079 void UnmapControls();
1080 void DeleteControls();
1082 void SizeAndLink(TGFrame *frame, TGHtmlInput *pElem);
1083 int FormCount(TGHtmlInput *p, int radio);
1086 void AppendText(TGString *str, TGHtmlElement *pFirst, TGHtmlElement *pEnd);
1087
1088 void UpdateSelection(int forceUpdate);
1090 void LostSelection();
1091 int SelectionSet(const char *startIx, const char *endIx);
1092 void UpdateInsert();
1093 int SetInsert(const char *insIx);
1094
1095 const char *GetUid(const char *string);
1096 ColorStruct_t *AllocColor(const char *name);
1098 void FreeColor(ColorStruct_t *color);
1099
1101 void PushStyleStack(int tag, SHtmlStyle_t style);
1102 SHtmlStyle_t PopStyleStack(int tag);
1103
1104 void MakeInvisible(TGHtmlElement *p_first, TGHtmlElement *p_last);
1105 int GetLinkColor(const char *zURL);
1106 void AddStyle(TGHtmlElement *p);
1107 void Sizer();
1108
1110
1111 TGHtmlElement *AttrElem(const char *name, char *value);
1112
1113public:
1114 void AppendArglist(TGString *str, TGHtmlMarkupElement *pElem);
1117 TGString *TableText(TGHtmlTable *pTable, int flags);
1118
1119 virtual void MouseOver(const char *uri) { Emit("MouseOver(const char *)",uri); } // *SIGNAL*
1120 virtual void MouseDown(const char *uri) { Emit("MouseDown(const char *)",uri); } // *SIGNAL*
1121 virtual void ButtonClicked(const char *name, const char *val); // *SIGNAL*
1122 virtual void SubmitClicked(const char *val); // *SIGNAL*
1123 virtual void CheckToggled(const char *name, Bool_t on, const char *val); // *SIGNAL*
1124 virtual void RadioChanged(const char *name, const char *val); // *SIGNAL*
1125 virtual void InputSelected(const char *name, const char *val); //*SIGNAL*
1126 void SavePrimitive(std::ostream &out, Option_t * = "") override;
1127
1128protected:
1129 void UpdateBackgroundStart() override;
1130
1131protected:
1132 enum {
1135
1136 TGHtmlElement *fPFirst; // First HTML token on a list of them all
1137 TGHtmlElement *fPLast; // Last HTML token on the list
1138 int fNToken; // Number of HTML tokens on the list.
1139 // Html_Block tokens don't count.
1140 TGHtmlElement *fLastSized; // Last HTML element that has been sized
1141 TGHtmlElement *fNextPlaced; // Next HTML element that needs to be
1142 // positioned on canvas.
1143 TGHtmlBlock *fFirstBlock; // List of all TGHtmlBlock tokens
1144 TGHtmlBlock *fLastBlock; // Last TGHtmlBlock in the list
1145 TGHtmlInput *fFirstInput; // First <INPUT> element
1146 TGHtmlInput *fLastInput; // Last <INPUT> element
1147 int fNInput; // The number of <INPUT> elements
1148 int fNForm; // The number of <FORM> elements
1149 int fVarId; // Used to construct a unique name for a
1150 // global array used by <INPUT> elements
1151 int fInputIdx; // Unique input index
1152 int fRadioIdx; // Unique radio index
1153
1154 // Information about the selected region of text
1155
1156 SHtmlIndex_t fSelBegin; // Start of the selection
1157 SHtmlIndex_t fSelEnd; // End of the selection
1158 TGHtmlBlock *fPSelStartBlock; // Block in which selection starts
1159 Html_16_t fSelStartIndex; // Index in pSelStartBlock of first selected
1160 // character
1161 Html_16_t fSelEndIndex; // Index of last selecte char in pSelEndBlock
1162 TGHtmlBlock *fPSelEndBlock; // Block in which selection ends
1163
1164 // Information about the insertion cursor
1165
1166 int fInsOnTime; // How long the cursor states one (millisec)
1167 int fInsOffTime; // How long it is off (milliseconds)
1168 int fInsStatus; // Is it visible?
1169 TTimer *fInsTimer; // Timer used to flash the insertion cursor
1170 SHtmlIndex_t fIns; // The insertion cursor position
1171 TGHtmlBlock *fPInsBlock; // The TGHtmlBlock containing the cursor
1172 int fInsIndex; // Index in pInsBlock of the cursor
1173
1174 // The following fields hold state information used by the tokenizer.
1175
1176 char *fZText; // Complete text of the unparsed HTML
1177 int fNText; // Number of characters in zText
1178 int fNAlloc; // Space allocated for zText
1179 int fNComplete; // How much of zText has actually been
1180 // converted into tokens
1181 int fICol; // The column in which zText[nComplete]
1182 // occurs. Used to resolve tabs in input
1183 int fIPlaintext; // If not zero, this is the token type that
1184 // caused us to go into plaintext mode. One
1185 // of Html_PLAINTEXT, Html_LISTING or
1186 // Html_XMP
1187 TGHtmlScript *fPScript; // <SCRIPT> currently being parsed
1188
1190 TGPopupMenu *fMenu; // popup menu with user actions
1191
1192 // These fields hold state information used by the HtmlAddStyle routine.
1193 // We have to store this state information here since HtmlAddStyle
1194 // operates incrementally. This information must be carried from
1195 // one incremental execution to the next.
1196
1197 SHtmlStyleStack_t *fStyleStack; // The style stack
1198 int fParaAlignment; // Justification associated with <p>
1199 int fRowAlignment; // Justification associated with <tr>
1200 int fAnchorFlags; // Style flags associated with <A>...</A>
1201 int fInDt; // Style flags associated with <DT>...</DT>
1202 int fInTr; // True if within <tr>..</tr>
1203 int fInTd; // True if within <td>..</td> or <th>..</th>
1204 TGHtmlAnchor *fAnchorStart; // Most recent <a href=...>
1205 TGHtmlForm *fFormStart; // Most recent <form>
1206 TGHtmlInput *fFormElemStart; // Most recent <textarea> or <select>
1207 TGHtmlInput *fFormElemLast; // Most recent <input>, <textarea> or <select>
1208 TGHtmlListStart *fInnerList; // The inner most <OL> or <UL>
1209 TGHtmlElement *fLoEndPtr; // How far AddStyle has gone to
1210 TGHtmlForm *fLoFormStart; // For AddStyle
1211
1212 // These fields are used to hold the state of the layout engine.
1213 // Because the layout is incremental, this state must be held for
1214 // the life of the widget.
1215
1217
1218 // Information used when displaying the widget:
1219
1220 int fHighlightWidth; // Width in pixels of highlight to draw
1221 // around widget when it has the focus.
1222 // <= 0 means don't draw a highlight.
1223 TGInsets fMargins; // document margins (separation between the
1224 // edge of the clip window and rendered HTML).
1225 ColorStruct_t *fHighlightBgColorPtr; // Color for drawing traversal highlight
1226 // area when highlight is off.
1227 ColorStruct_t *fHighlightColorPtr; // Color for drawing traversal highlight.
1228 TGFont *fAFont[N_FONT]; // Information about all screen fonts
1229 char fFontValid[(N_FONT+7)/8]; // If bit N%8 of work N/8 of this field is 0
1230 // if aFont[N] needs to be reallocated before
1231 // being used.
1232 ColorStruct_t *fApColor[N_COLOR]; // Information about all colors
1233 Long_t fColorUsed; // bit N is 1 if color N is in use. Only
1234 // applies to colors that aren't predefined
1235 int fIDark[N_COLOR]; // Dark 3D shadow of color K is iDark[K]
1236 int fILight[N_COLOR]; // Light 3D shadow of color K is iLight[K]
1237 ColorStruct_t *fBgColor; // Background color of the HTML document
1238 ColorStruct_t *fFgColor; // Color of normal text. apColor[0]
1239 ColorStruct_t *fNewLinkColor; // Color of unvisitied links. apColor[1]
1240 ColorStruct_t *fOldLinkColor; // Color of visitied links. apColor[2]
1241 ColorStruct_t *fSelectionColor; // Background color for selections
1242 GcCache_t fAGcCache[N_CACHE_GC]; // A cache of GCs for general use
1244 int fLastGC; // Index of recently used GC
1245 TGHtmlImage *fImageList; // A list of all images
1246 TImage *fBgImage; // Background image
1247
1248 int fFormPadding; // Amount to pad form elements by
1249 int fOverrideFonts; // TRUE if we should override fonts
1250 int fOverrideColors; // TRUE if we should override colors
1251 int fUnderlineLinks; // TRUE if we should underline hyperlinks
1252 int fHasScript; // TRUE if we can do scripts for this page
1253 int fHasFrames; // TRUE if we can do frames for this page
1254 int fAddEndTags; // TRUE if we add /LI etc.
1255 int fTableBorderMin; // Force tables to have min border size
1256 int fVarind; // Index suffix for unique global var name
1257
1258 // Information about the selection
1259
1260 int fExportSelection; // True if the selection is automatically
1261 // exported to the clipboard
1262
1263 // Miscellaneous information:
1264
1265 int fTableRelief; // 3d effects on <TABLE>
1266 int fRuleRelief; // 3d effects on <HR>
1267 int fRulePadding; // extra pixels above and below <HR>
1268 const char *fZBase; // The base URI
1269 char *fZBaseHref; // zBase as modified by <BASE HREF=..> markup
1270 Cursor_t fCursor; // Current cursor for window, or None.
1271 int fMaxX, fMaxY; // Maximum extent of any "paint" that appears
1272 // on the virtual canvas. Used to compute
1273 // scrollbar positions.
1274 int fDirtyLeft, fDirtyTop; // Top left corner of region to redraw. These
1275 // are physical screen coordinates relative to
1276 // the clip win, not main window.
1277 int fDirtyRight, fDirtyBottom; // Bottom right corner of region to redraw
1278 int fFlags; // Various flags; see below for definitions.
1280 int fInParse; // Prevent update if parsing
1281 char *fZGoto; // Label to goto right after layout
1282
1283 SHtmlExtensions_t *fExts; // Pointer to user extension data
1284
1285 THashTable *fUidTable; // Hash table for some used string values
1286 // like color names, etc.
1287 const char *fLastUri; // Used in HandleMotion
1288 int fExiting; // True if the widget is being destroyed
1289
1290 ClassDefOverride(TGHtml, 0); // HTML widget
1291};
1292
1293
1294// Flag bits "flags" field of the Html widget:
1295//
1296// REDRAW_PENDING An idle handler has already been queued to
1297// call the TGHtml::Redraw() method.
1298//
1299// GOT_FOCUS This widget currently has input focus.
1300//
1301// HSCROLL Horizontal scrollbar position needs to be
1302// recomputed.
1303//
1304// VSCROLL Vertical scrollbar position needs to be
1305// recomputed.
1306//
1307// RELAYOUT We need to reposition every element on the
1308// virtual canvas. (This happens, for example,
1309// when the size of the widget changes and we
1310// need to recompute the line breaks.)
1311//
1312// RESIZE_ELEMENTS We need to recompute the size of every element.
1313// This happens, for example, when the fonts
1314// change.
1315//
1316// REDRAW_FOCUS We need to repaint the focus highlight border.
1317//
1318// REDRAW_TEXT Everything in the clipping window needs to be redrawn.
1319//
1320// STYLER_RUNNING There is a call to HtmlAddStyle() in process.
1321// Used to prevent a recursive call to HtmlAddStyle().
1322//
1323// INSERT_FLASHING True if there is a timer scheduled that will toggle
1324// the state of the insertion cursor.
1325//
1326// REDRAW_IMAGES One or more TGHtmlImageMarkup objects have their
1327// redrawNeeded flag set.
1328
1329#define REDRAW_PENDING 0x000001
1330#define GOT_FOCUS 0x000002
1331#define HSCROLL 0x000004
1332#define VSCROLL 0x000008
1333#define RELAYOUT 0x000010
1334#define RESIZE_ELEMENTS 0x000020
1335#define REDRAW_FOCUS 0x000040
1336#define REDRAW_TEXT 0x000080
1337#define EXTEND_LAYOUT 0x000100
1338#define STYLER_RUNNING 0x000200
1339#define INSERT_FLASHING 0x000400
1340#define REDRAW_IMAGES 0x000800
1341#define ANIMATE_IMAGES 0x001000
1342
1343
1344// Macros to set, clear or test bits of the "flags" field.
1345
1346#define HtmlHasFlag(A,F) (((A)->flags&(F))==(F))
1347#define HtmlHasAnyFlag(A,F) (((A)->flags&(F))!=0)
1348#define HtmlSetFlag(A,F) ((A)->flags|=(F))
1349#define HtmlClearFlag(A,F) ((A)->flags&=~(F))
1350
1351
1352// No coordinate is ever as big as this number
1353
1354#define LARGE_NUMBER 100000000
1355
1356
1357// Default values for configuration options
1358
1359#define DEF_HTML_BG_COLOR DEF_FRAME_BG_COLOR
1360#define DEF_HTML_BG_MONO DEF_FRAME_BG_MONO
1361#define DEF_HTML_EXPORT_SEL 1
1362#define DEF_HTML_FG DEF_BUTTON_FG
1363#define DEF_HTML_HIGHLIGHT_BG DEF_BUTTON_HIGHLIGHT_BG
1364#define DEF_HTML_HIGHLIGHT DEF_BUTTON_HIGHLIGHT
1365#define DEF_HTML_HIGHLIGHT_WIDTH "0"
1366#define DEF_HTML_INSERT_OFF_TIME 300
1367#define DEF_HTML_INSERT_ON_TIME 600
1368#define DEF_HTML_PADX (HTML_INDENT / 4)
1369#define DEF_HTML_PADY (HTML_INDENT / 4)
1370#define DEF_HTML_RELIEF "raised"
1371#define DEF_HTML_SELECTION_COLOR "skyblue"
1372#define DEF_HTML_TAKE_FOCUS "0"
1373#define DEF_HTML_UNVISITED "blue2"
1374#define DEF_HTML_VISITED "purple4"
1375
1376#ifdef NAVIGATOR_TABLES
1377
1378#define DEF_HTML_TABLE_BORDER "0"
1379#define DEF_HTML_TABLE_CELLPADDING "2"
1380#define DEF_HTML_TABLE_CELLSPACING "5"
1381#define DEF_HTML_TABLE_BORDER_LIGHT_COLOR "gray80"
1382#define DEF_HTML_TABLE_BORDER_DARK_COLOR "gray40"
1383
1384#endif // NAVIGATOR_TABLES
1385
1386
1387//----------------------------------------------------------------------
1388
1389// Messages generated by the HTML widget
1390/*
1391class TGHtmlMessage : public OWidgetMessage {
1392public:
1393 TGHtmlMessage(int t, int a, int i, const char *u, int rx, int ry) :
1394 OWidgetMessage(t, a, i) {
1395 uri = u;
1396 x_root = rx;
1397 y_root = ry;
1398 }
1399
1400public:
1401 const char *uri;
1402 //ORectangle bbox;
1403 int x_root, y_root;
1404};
1405*/
1406
1407#endif // ROOT_TGHtml
Handle_t Pixmap_t
Pixmap handle.
Definition GuiTypes.h:30
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
Handle_t Drawable_t
Drawable handle.
Definition GuiTypes.h:31
Handle_t Cursor_t
Cursor handle.
Definition GuiTypes.h:34
#define d(i)
Definition RSha256.hxx:102
#define h(i)
Definition RSha256.hxx:106
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
long Longptr_t
Definition RtypesCore.h:82
long Long_t
Definition RtypesCore.h:54
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
const char Option_t
Definition RtypesCore.h:66
static void indent(ostringstream &buf, int indent_level)
#define N
@ Html_Block
@ Html_Space
int HtmlDepth
Definition TGHtml.cxx:67
int HtmlTraceMask
Definition TGHtml.cxx:66
unsigned char Html_u8_t
Definition TGHtml.h:136
#define HTML_MAX_COLUMNS
Definition TGHtml.h:343
int Html_32_t
Definition TGHtml.h:139
short Html_16_t
Definition TGHtml.h:137
#define N_CACHE_GC
Definition TGHtml.h:819
#define N_COLOR
Definition TGHtml.h:195
unsigned short Html_u16_t
Definition TGHtml.h:138
#define N_FONT
Definition TGHtml.h:166
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void FreeColor
Option_t Option_t style
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char text
char name[80]
Definition TGX11.cxx:110
Window client.
Definition TGClient.h:37
Encapsulate fonts used in the GUI system.
Definition TGFont.h:140
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
Html_32_t fY
Definition TGHtml.h:668
TGHtmlBlock * fBNext
Definition TGHtml.h:721
Html_u16_t fN
Definition TGHtml.h:720
Html_u16_t fRight
Definition TGHtml.h:719
char * fZ
Definition TGHtml.h:717
~TGHtmlBlock() override
dtor.
Html_u16_t fLeft
Definition TGHtml.h:719
TGHtmlBlock * fBPrev
Definition TGHtml.h:721
TGHtmlBlock()
ctor.
int fBottom
Definition TGHtml.h:718
Html_32_t fH
Definition TGHtml.h:392
TImage * fBgImage
Definition TGHtml.h:396
Html_16_t fColspan
Definition TGHtml.h:388
~TGHtmlCell() override
HTML cell element destructor.
Html_16_t fX
Definition TGHtml.h:389
Html_16_t fW
Definition TGHtml.h:390
Html_16_t fRowspan
Definition TGHtml.h:387
TGHtmlTable * fPTable
Definition TGHtml.h:393
TGHtmlElement * fPEnd
Definition TGHtml.h:395
Html_32_t fY
Definition TGHtml.h:391
TGHtmlElement * fPRow
Definition TGHtml.h:394
Html_u8_t fFlags
Definition TGHtml.h:266
Html_u8_t fType
Definition TGHtml.h:265
virtual int GetVerticalAlignment(int dflt)
Definition TGHtml.h:259
virtual int GetUnorderedListType(int dflt)
Definition TGHtml.h:258
SHtmlStyle_t fStyle
Definition TGHtml.h:264
virtual const char * MarkupArg(const char *, const char *)
Definition TGHtml.h:255
TGHtmlElement * fPPrev
Definition TGHtml.h:263
Html_16_t fCount
Definition TGHtml.h:267
virtual int GetAlignment(int dflt)
Definition TGHtml.h:256
virtual int GetOrderedListType(int dflt)
Definition TGHtml.h:257
virtual int IsMarkup() const
Definition TGHtml.h:254
TGHtmlElement * fPNext
Definition TGHtml.h:262
unsigned int fHasctl
Definition TGHtml.h:641
TGHtmlElement * fPEnd
Definition TGHtml.h:643
Html_u16_t fFormId
Definition TGHtml.h:639
unsigned int fElements
Definition TGHtml.h:640
TGHtmlElement * fPFirst
Definition TGHtml.h:642
Html_32_t fY
Definition TGHtml.h:654
Html_u16_t fW
Definition TGHtml.h:656
Html_u16_t fX
Definition TGHtml.h:655
Html_u8_t fIs3D
Definition TGHtml.h:657
Html_u16_t fH
Definition TGHtml.h:656
TGHtmlImage * fPImage
Definition TGHtml.h:552
TGHtmlImageMarkup * fINext
Definition TGHtml.h:554
Html_16_t fAscent
Definition TGHtml.h:547
Html_u8_t fRedrawNeeded
Definition TGHtml.h:543
Html_32_t fY
Definition TGHtml.h:550
Html_16_t fW
Definition TGHtml.h:546
Html_u8_t fTextAscent
Definition TGHtml.h:541
TGHtmlElement * fPMap
Definition TGHtml.h:553
Html_16_t fDescent
Definition TGHtml.h:548
Html_16_t fH
Definition TGHtml.h:545
Html_u8_t fAlign
Definition TGHtml.h:540
Html_16_t fX
Definition TGHtml.h:549
Html_u8_t fTextDescent
Definition TGHtml.h:542
const char * fZAlt
Definition TGHtml.h:551
char * fZUrl
Definition TGHtml.h:522
Html_32_t fW
Definition TGHtml.h:520
TImage * fImage
Definition TGHtml.h:519
char * fZHeight
Definition TGHtml.h:523
char * fZWidth
Definition TGHtml.h:523
TTimer * fTimer
Definition TGHtml.h:527
TGHtmlImageMarkup * fPList
Definition TGHtml.h:525
TGHtmlImage * fPNext
Definition TGHtml.h:524
TGHtmlImage & operator=(const TGHtmlImage &)=delete
TGHtmlImage(const TGHtmlImage &)=delete
TGHtml * fHtml
Definition TGHtml.h:518
Html_32_t fH
Definition TGHtml.h:521
~TGHtmlImage() override
dtor.
void Empty()
Mark this element as being empty.
Html_u8_t fTextAscent
Definition TGHtml.h:601
Html_u16_t fW
Definition TGHtml.h:598
Html_u8_t fTextDescent
Definition TGHtml.h:602
Html_u8_t fItype
Definition TGHtml.h:603
Html_u8_t fSized
Definition TGHtml.h:604
Html_u16_t fH
Definition TGHtml.h:598
TGFrame * fFrame
Definition TGHtml.h:591
Html_u16_t fX
Definition TGHtml.h:597
TGHtml * fHtml
Definition TGHtml.h:592
Html_u8_t fAlign
Definition TGHtml.h:600
TGHtmlElement * fPEnd
Definition TGHtml.h:593
Html_u16_t fInpId
Definition TGHtml.h:594
Html_u16_t fCnt
Definition TGHtml.h:605
Html_u8_t fPadLeft
Definition TGHtml.h:599
TGHtmlForm * fPForm
Definition TGHtml.h:589
Html_u16_t fSubId
Definition TGHtml.h:595
TGHtmlInput * fINext
Definition TGHtml.h:590
Html_32_t fY
Definition TGHtml.h:596
TGHtmlElement * fPStart
Definition TGHtml.h:796
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:806
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:797
SHtmlMargin_t * fLeftMargin
Definition TGHtml.h:805
void Reset()
Reset the layout context.
void PushIndent()
Adjust (push) ident.
Html_u8_t fDescent
Definition TGHtml.h:426
Html_u8_t fAscent
Definition TGHtml.h:425
Html_32_t fY
Definition TGHtml.h:429
Html_16_t fX
Definition TGHtml.h:428
Html_16_t fCnt
Definition TGHtml.h:427
Html_u8_t fLtype
Definition TGHtml.h:424
TGHtmlListStart * fLPrev
Definition TGHtml.h:460
Html_u8_t fLtype
Definition TGHtml.h:456
Html_u16_t fWidth
Definition TGHtml.h:459
Html_u16_t fCnt
Definition TGHtml.h:458
Html_u8_t fCompact
Definition TGHtml.h:457
int * fCoords
Definition TGHtml.h:474
int GetAlignment(int dflt) override
Return an alignment or justification flag associated with the given markup.
int GetOrderedListType(int dflt) override
The "type" argument to the given element might describe the type for an ordered list.
~TGHtmlMarkupElement() override
HTML markup element destructor.
int GetVerticalAlignment(int dflt) override
Return the vertical alignment specified by the given element.
int GetUnorderedListType(int dflt) override
The "type" argument to the given element might describe a type for an unordered list.
const char * MarkupArg(const char *tag, const char *zDefault) override
Lookup an argument in the given markup with the name given.
TImage * fBgImage
Definition TGHtml.h:412
~TGHtmlRef() override
HTML ref element destructor.
TGHtmlElement * fPOther
Definition TGHtml.h:411
int fNStart
Definition TGHtml.h:684
int fNScript
Definition TGHtml.h:685
Html_u8_t fDescent
Definition TGHtml.h:311
Html_u8_t fAscent
Definition TGHtml.h:310
Html_16_t fW
Definition TGHtml.h:309
Html_u8_t fBorderWidth
Definition TGHtml.h:360
int fHasbg
Definition TGHtml.h:371
int fMaxW[40+1]
Definition TGHtml.h:368
TGHtmlElement * fPEnd
Definition TGHtml.h:369
Html_32_t fY
Definition TGHtml.h:363
~TGHtmlTable() override
HTML table element destructor.
int fMinW[40+1]
Definition TGHtml.h:367
Html_16_t fX
Definition TGHtml.h:365
Html_16_t fW
Definition TGHtml.h:366
Html_u8_t fNCol
Definition TGHtml.h:361
Html_u16_t fNRow
Definition TGHtml.h:362
Html_32_t fH
Definition TGHtml.h:364
TImage * fBgImage
Definition TGHtml.h:370
TGHtmlTextElement & operator=(const TGHtmlTextElement &)=delete
Html_16_t fW
Definition TGHtml.h:297
TGHtmlTextElement(const TGHtmlTextElement &)=delete
Html_u8_t fDescent
Definition TGHtml.h:299
Html_u8_t fSpaceWidth
Definition TGHtml.h:300
Html_32_t fY
Definition TGHtml.h:295
~TGHtmlTextElement() override
HTML element destructor.
Html_16_t fX
Definition TGHtml.h:296
Html_u8_t fAscent
Definition TGHtml.h:298
The ROOT HTML widget.
Definition TGHtml.h:873
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:1734
TGHtmlElement * GetMap(const char *name)
Returns html map element.
Definition TGHtml.cxx:1593
int IsDarkColor(ColorStruct_t *p)
Check to see if the given color is too dark to be easily distinguished from black.
Definition TGHtml.cxx:1678
Bool_t HandleButton(Event_t *event) override
Handle mouse button event.
Definition TGHtml.cxx:1389
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:1254
TGString * ListTokens(TGHtmlElement *p, TGHtmlElement *pEnd)
Return all tokens between the two elements as a string list.
ColorStruct_t * fFgColor
Definition TGHtml.h:1238
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:789
int fICol
Definition TGHtml.h:1181
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:461
TGHtmlBlock * fLastBlock
Definition TGHtml.h:1144
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:2097
virtual void RadioChanged(const char *name, const char *val)
Emit RadioChanged() signal.
Definition TGHtml.cxx:1313
TGHtmlElement * fLoEndPtr
Definition TGHtml.h:1209
SHtmlIndex_t fSelBegin
Definition TGHtml.h:1156
char * fZGoto
Definition TGHtml.h:1281
int fParaAlignment
Definition TGHtml.h:1198
virtual int FormCreate(TGHtmlForm *, const char *, const char *)
Definition TGHtml.h:946
TGHtmlBlock * fPSelStartBlock
Definition TGHtml.h:1158
const char * GetHref(int x, int y, const char **target=nullptr)
This routine searches for a hyperlink beneath the coordinates x,y and returns a pointer to the HREF f...
Definition TGHtml.cxx:1831
int fIdind
Definition TGHtml.h:1279
int fRadioIdx
Definition TGHtml.h:1152
int fInputIdx
Definition TGHtml.h:1151
const char * fZBase
Definition TGHtml.h:1268
int fUnderlineLinks
Definition TGHtml.h:1251
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:1725
void TokenizerAppend(const char *text)
Append text to the tokenizer engine.
TGHtmlImage * fImageList
Definition TGHtml.h:1245
TGHtmlElement * fPFirst
Definition TGHtml.h:1136
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:1148
virtual void MouseDown(const char *uri)
Definition TGHtml.h:1120
Bool_t ItemLayout() override
Layout html widget.
Definition TGHtml.cxx:834
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:762
TGPopupMenu * fMenu
Definition TGHtml.h:1190
virtual char * ProcessScript(TGHtmlScript *)
Definition TGHtml.h:958
void LostSelection()
Clear selection.
Definition TGHtml.cxx:2027
const char * fLastUri
Definition TGHtml.h:1287
int fNToken
Definition TGHtml.h:1138
virtual TGFont * GetFont(int iFont)
The rendering and layout routines should call this routine in order to get a font structure.
Definition TGHtml.cxx:1465
ColorStruct_t * fApColor[32]
Definition TGHtml.h:1232
SHtmlIndex_t fIns
Definition TGHtml.h:1170
void UpdateInsert()
Recompute the position of the insertion cursor based on the position in fIns.
Definition TGHtml.cxx:2084
int fAnchorFlags
Definition TGHtml.h:1200
int fExiting
Definition TGHtml.h:1288
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:1140
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:1244
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:1629
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:1207
void AnimateImage(TGHtmlImage *image)
TGImage *img = image->image;.
Bool_t HandleTimer(TTimer *timer) override
Handle timer event.
Definition TGHtml.cxx:1004
TGHtmlBlock * fPInsBlock
Definition TGHtml.h:1171
virtual void InputSelected(const char *name, const char *val)
Emit Selected() signal.
Definition TGHtml.cxx:1326
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:1299
Bool_t HandleMotion(Event_t *event) override
handle mouse motion events
Definition TGHtml.cxx:1438
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:2042
void UpdateSelectionDisplay()
The fPSelStartBlock and fPSelEndBlock values have been changed.
Definition TGHtml.cxx:1981
Bool_t HandleFocusChange(Event_t *event) override
Handle focus change event.
Definition TGHtml.cxx:1132
TGHtmlBlock * fPSelEndBlock
Definition TGHtml.h:1162
ColorStruct_t * fSelectionColor
Definition TGHtml.h:1241
int Tokenize()
Process as much of the input HTML as possible.
void SaveFileAs()
Save file.
Definition TGHtml.cxx:1348
int fInsOffTime
Definition TGHtml.h:1167
void FormBlocks()
Add additional blocks to the block list in order to cover all elements on the element list.
TGInsets fMargins
Definition TGHtml.h:1223
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.
void StringHW(const char *str, int *h, int *w)
Return the height and width of string.
int fVarind
Definition TGHtml.h:1256
TGFont * fAFont[71]
Definition TGHtml.h:1228
int fFlags
Definition TGHtml.h:1278
virtual void ButtonClicked(const char *name, const char *val)
Emit ButtonClicked() signal.
Definition TGHtml.cxx:1286
ColorStruct_t * fHighlightBgColorPtr
Definition TGHtml.h:1225
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:396
int CellSpacing(TGHtmlElement *pTable)
Return the appropriate cell spacing for the given table.
int fInsOnTime
Definition TGHtml.h:1166
int fVarId
Definition TGHtml.h:1149
TGHtmlElement * FillOutBlock(TGHtmlBlock *p)
Recompute the following fields of the given block structure:
int fDirtyBottom
Definition TGHtml.h:1277
SHtmlStyleStack_t * fStyleStack
Definition TGHtml.h:1197
ColorStruct_t * fNewLinkColor
Definition TGHtml.h:1239
TGHtmlListStart * fInnerList
Definition TGHtml.h:1208
int fIPlaintext
Definition TGHtml.h:1183
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:887
int IndexMod(TGHtmlElement **pp, int *ip, char *cp)
Modify an index for both pointer and char +/-/=N.
int fOverrideColors
Definition TGHtml.h:1250
virtual void MouseOver(const char *uri)
Definition TGHtml.h:1119
Bool_t HandleRadioButton(TGHtmlInput *p)
Handle radio button event.
Definition TGHtml.cxx:1267
int fMaxY
Definition TGHtml.h:1271
Cursor_t fCursor
Definition TGHtml.h:1270
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:950
TGHtmlInput * GetInputElement(int x, int y)
This routine searches for a hyperlink beneath the coordinates x,y and returns a pointer to the HREF f...
Definition TGHtml.cxx:1151
char * fZText
Definition TGHtml.h:1176
int fInsIndex
Definition TGHtml.h:1172
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 ParseText(char *text, const char *index=nullptr)
Appends (or insert at the specified position) the given HTML text to the end of any HTML text that ma...
Definition TGHtml.cxx:325
int fNInput
Definition TGHtml.h:1147
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:1928
int fNAlloc
Definition TGHtml.h:1178
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:451
void AppendElement(TGHtmlElement *pElem)
Append the given TGHtmlElement to the tokenizers list of elements.
int fDirtyRight
Definition TGHtml.h:1277
int GetMarginHeight()
Definition TGHtml.h:968
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:291
void MakeInvisible(TGHtmlElement *p_first, TGHtmlElement *p_last)
Add the STY_Invisible style to every token between p_first and p_last.
TGHtmlInput * fFirstInput
Definition TGHtml.h:1145
int GetImageAt(int x, int y)
This routine searchs for an image beneath the coordinates x,y and returns the token number of the ima...
void UpdateBackgroundStart() override
Start background update.
Definition TGHtml.cxx:250
~TGHtml() override
HTML widget destructor.
Definition TGHtml.cxx:231
void SavePrimitive(std::ostream &out, Option_t *="") override
Save a html widget as a C++ statement(s) on output stream out.
Definition TGHtml.cxx:2122
void SetTableRelief(int relief)
Sets relief mode of html table.
Definition TGHtml.cxx:384
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:272
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:928
void HClear()
Erase all data from the HTML widget. Bring it back to an empty screen.
Definition TGHtml.cxx:901
int fRowAlignment
Definition TGHtml.h:1199
THashTable * fUidTable
Definition TGHtml.h:1285
ColorStruct_t * fHighlightColorPtr
Definition TGHtml.h:1227
int fFormPadding
Definition TGHtml.h:1248
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:1117
TGHtmlElement * FindStartOfNextBlock(TGHtmlElement *p, int *pCnt)
Scan ahead looking for a place to put a block.
Html_16_t fSelStartIndex
Definition TGHtml.h:1159
TGHtmlScript * fPScript
Definition TGHtml.h:1187
virtual int ProcessFrame()
Definition TGHtml.h:938
TGHtmlBlock * fFirstBlock
Definition TGHtml.h:1143
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:866
int fInTr
Definition TGHtml.h:1202
TGIdleHandler * fIdle
Definition TGHtml.h:1189
int fMaxX
Definition TGHtml.h:1271
int fILight[32]
Definition TGHtml.h:1236
const char * GetUid(const char *string)
Given a string, this procedure returns a unique identifier for the string.
Definition TGHtml.cxx:490
void Redraw()
This routine is invoked in order to redraw all or part of the HTML widget.
Definition TGHtml.cxx:544
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:1161
virtual char * GetFontName()
Definition TGHtml.h:954
TGHtmlAnchor * fAnchorStart
Definition TGHtml.h:1204
int GetColorByValue(ColorStruct_t *pRef)
Find a color integer for the color whose color components are given by pRef.
Definition TGHtml.cxx:1767
char fFontValid[(71+7)/8]
Definition TGHtml.h:1229
void Sizer()
Compute the size of all elements in the widget.
int fDirtyTop
Definition TGHtml.h:1274
const char * GetBaseUri() const
Definition TGHtml.h:907
int fHasFrames
Definition TGHtml.h:1253
Long_t fColorUsed
Definition TGHtml.h:1233
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:1274
TGHtmlMarkupElement * MakeMarkupEntry(int objType, int type, int argc, int arglen[], char *argv[])
Make one markup entry.
TTimer * fInsTimer
Definition TGHtml.h:1169
TGHtmlElement * fPLast
Definition TGHtml.h:1137
SHtmlStyle_t PopStyleStack(int tag)
Pop a rendering style off of the stack.
void ComputeVirtualSize()
Computes virtual size of html area.
Definition TGHtml.cxx:508
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:1203
ClassDefOverride(TGHtml, 0)
int fRulePadding
Definition TGHtml.h:1267
@ kM_FILE_PRINT
Definition TGHtml.h:1133
@ kM_FILE_SAVEAS
Definition TGHtml.h:1133
int fRuleRelief
Definition TGHtml.h:1266
TGHtmlElement * AttrElem(const char *name, char *value)
Returns html element matching attribute name and value.
Definition TGHtml.cxx:1907
int fGcNextToFree
Definition TGHtml.h:1243
virtual int IsVisited(const char *)
Definition TGHtml.h:924
GContext_t GetGC(int color, int font)
Return a GC from the cache.
Definition TGHtml.cxx:1047
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:902
int InArea(TGHtmlMapArea *p, int left, int top, int x, int y)
Only support rect and circles for now.
Definition TGHtml.cxx:1574
void PushStyleStack(int tag, SHtmlStyle_t style)
Push a new rendering style onto the stack.
TGHtmlElement * fNextPlaced
Definition TGHtml.h:1141
int fOverrideFonts
Definition TGHtml.h:1249
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:1246
int fNComplete
Definition TGHtml.h:1179
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:1201
TGHtmlLayoutContext fLayoutContext
Definition TGHtml.h:1216
TGHtmlElement * FindEndNest(TGHtmlElement *sp, int en, TGHtmlElement *lp)
Find End tag en, but ignore intervening begin/end tag pairs.
int fExportSelection
Definition TGHtml.h:1260
ColorStruct_t * fBgColor
Definition TGHtml.h:1237
void RedrawEverything()
Call this routine to force the entire widget to be redrawn.
Definition TGHtml.cxx:877
char * DumpToken(TGHtmlElement *p)
For debugging purposes, print information about a token.
virtual void SubmitClicked(const char *val)
Emit SubmitClicked() signal.
Definition TGHtml.cxx:1339
void UnderlineLinks(int onoff)
Set/reset html links underline.
Definition TGHtml.cxx:408
int fHighlightWidth
Definition TGHtml.h:1220
SHtmlIndex_t fSelEnd
Definition TGHtml.h:1157
SHtmlStyle_t GetCurrentStyle()
Get the current rendering style.
int GetTableRelief() const
Definition TGHtml.h:898
void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h) override
Draw region defined by [x,y] [w,h].
Definition TGHtml.cxx:805
int MapControls()
Map any control that should be visible according to the current scroll position.
TGHtmlImage * GetImage(TGHtmlImageMarkup *p)
Given an <IMG> markup, find or create an appropriate TGHtmlImage object and return a pointer to that ...
char * GetTokenName(TGHtmlElement *p)
Returns token name of html element p.
void Clear(Option_t *="") override
Erase all HTML from this widget and clear the screen.
Definition TGHtml.cxx:310
const char * GetText() const
Definition TGHtml.h:962
void ClearGcCache()
Clear the cache of GCs.
Definition TGHtml.cxx:516
void ResetBlocks()
Definition TGHtml.h:978
int GetIndex(const char *zIndex, TGHtmlElement **ppToken, int *pIndex)
This routine decodes a complete index specification.
ColorStruct_t * fOldLinkColor
Definition TGHtml.h:1240
TGHtmlForm * fLoFormStart
Definition TGHtml.h:1210
TGHtmlInput * fFormElemStart
Definition TGHtml.h:1206
virtual TGFrame * ProcessApplet(TGHtmlInput *)
Definition TGHtml.h:942
int ElementCoords(TGHtmlElement *p, int i, int pct, int *coords)
Return coordinates of item.
Definition TGHtml.cxx:1877
int fHasScript
Definition TGHtml.h:1252
Bool_t HandleIdleEvent(TGIdleHandler *i) override
Handles idle event.
Definition TGHtml.cxx:773
TGHtmlElement * TableDimensions(TGHtmlTable *pStart, int lineWidth)
pStart points to a <table>.
int fTableRelief
Definition TGHtml.h:1265
GcCache_t fAGcCache[32]
Definition TGHtml.h:1242
void PrintList(TGHtmlElement *first, TGHtmlElement *last)
Print a list of tokens.
TGHtmlForm * fFormStart
Definition TGHtml.h:1205
void HandleMenu(Int_t)
Handle context menu entries events.
Definition TGHtml.cxx:1373
float ColorDistance(ColorStruct_t *pA, ColorStruct_t *pB)
Compute the squared distance between two colors.
Definition TGHtml.cxx:1613
void FlashCursor()
Flash the insertion cursor.
Definition TGHtml.cxx:1026
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:1692
int GetRuleRelief() const
Definition TGHtml.h:901
int fInsStatus
Definition TGHtml.h:1168
Bool_t HandleHtmlInput(TGHtmlInput *pr, Event_t *event)
Handle html input (button, checkbox, ...) event.
Definition TGHtml.cxx:1176
int fInParse
Definition TGHtml.h:1280
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:967
int fTableBorderMin
Definition TGHtml.h:1255
SHtmlExtensions_t * fExts
Definition TGHtml.h:1283
int fIDark[32]
Definition TGHtml.h:1235
char * fZBaseHref
Definition TGHtml.h:1269
TGHtmlInput * fLastInput
Definition TGHtml.h:1146
void ResetLayoutContext()
Reset the main layout context in the main widget.
Definition TGHtml.cxx:533
int fNText
Definition TGHtml.h:1177
Bool_t ProcessMessage(Longptr_t, Longptr_t, Longptr_t) override
Process messages (GUI events) in the html widget.
Handle idle events, i.e.
Int_t fR
right
Definition TGDimension.h:75
Int_t fL
left
Definition TGDimension.h:74
Int_t fB
bottom
Definition TGDimension.h:77
Int_t fT
top
Definition TGDimension.h:76
A listbox is a box, possibly with scrollbar, containing entries.
Definition TGListBox.h:221
This class creates a popup menu object.
Definition TGMenu.h:110
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition TGString.h:20
A TGView provides the infrastructure for text viewer and editor widgets.
Definition TGView.h:23
ROOT GUI Window base class.
Definition TGWindow.h:23
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:41
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
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:825
Html_u8_t fFont
Definition TGHtml.h:823
Html_u8_t fColor
Definition TGHtml.h:824
GContext_t fGc
Definition TGHtml.h:822
SHtmlExtensions_t * fNext
Definition TGHtml.h:487
TGHtmlElement * fP
Definition TGHtml.h:833
SHtmlMargin_t * fPNext
Definition TGHtml.h:747
SHtmlStyle_t fStyle
Definition TGHtml.h:736
SHtmlStyleStack_t * fPNext
Definition TGHtml.h:734
unsigned int fColor
Definition TGHtml.h:146
signed int fSubscript
Definition TGHtml.h:147
unsigned int fExpbg
Definition TGHtml.h:150
unsigned int fAlign
Definition TGHtml.h:148
unsigned int fBgcolor
Definition TGHtml.h:149
unsigned int fFont
Definition TGHtml.h:145
unsigned int fFlags
Definition TGHtml.h:151
Html_16_t fObjType
Definition TGHtml.h:843
Html_16_t fType
Definition TGHtml.h:842
SHtmlTokenMap_t * fPCollide
Definition TGHtml.h:844
const char * fZName
Definition TGHtml.h:841