Logo ROOT  
Reference Guide
TGHtmlSizer.cxx
Go to the documentation of this file.
1// $Id: TGHtmlSizer.cxx,v 1.2 2007/05/04 20:33:16 rdm Exp $
2// Author: Valeriy Onuchin 03/05/2007
3
4/**************************************************************************
5
6 HTML widget for xclass. Based on tkhtml 1.28
7 Copyright (C) 1997-2000 D. Richard Hipp <drh@acm.org>
8 Copyright (C) 2002-2003 Hector Peraza.
9
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Library General Public
12 License as published by the Free Software Foundation; either
13 version 2 of the License, or (at your option) any later version.
14
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Library General Public License for more details.
19
20 You should have received a copy of the GNU Library General Public
21 License along with this library; if not, write to the Free
22 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23
24**************************************************************************/
25
26// Routines used to compute the style and size of individual elements.
27
28#include <cstring>
29#include <cstdlib>
30#include <cctype>
31
32#include "TGHtml.h"
33#include "TImage.h"
34#include "TVirtualX.h"
35#include "snprintf.h"
36
37////////////////////////////////////////////////////////////////////////////////
38/// Get the current rendering style. In other words, get the style
39/// that is currently on the top of the style stack.
40
42{
44
45 if (fStyleStack) {
47 } else {
48 style.fFont = NormalFont(2);
49 style.fColor = COLOR_Normal;
50 style.fBgcolor = COLOR_Background;
51 style.fSubscript = 0;
52 style.fAlign = ALIGN_Left;
53 style.fFlags = 0;
54 style.fExpbg = 0;
55 }
56
57 return style;
58}
59
60////////////////////////////////////////////////////////////////////////////////
61/// Push a new rendering style onto the stack.
62///
63/// tag - Tag for this style. Normally the end-tag such as </h3> or </em>.
64/// style - The style to push
65
67{
69
70 p = new SHtmlStyleStack_t;
72 p->fType = tag;
73 p->fStyle = style;
74 fStyleStack = p;
75}
76
77////////////////////////////////////////////////////////////////////////////////
78/// Pop a rendering style off of the stack.
79///
80/// The top-most style on the stack should have a tag equal to "tag".
81/// If not, then we have an HTML coding error. Perhaps something
82/// like this: "Some text <em>Enphasized</i> more text". It is an
83/// interesting problem to figure out how to respond sanely to this
84/// kind of error. Our solution is to keep popping the stack until
85/// we find the correct tag, or until the stack is empty.
86
88{
89 int i, type;
91 static Html_u8_t priority[Html_TypeCount+1];
92
93 if (priority[Html_TABLE] == 0) {
94 for (i = 0; i <= Html_TypeCount; i++) priority[i] = 1;
95 priority[Html_TD] = 2;
96 priority[Html_EndTD] = 2;
97 priority[Html_TH] = 2;
98 priority[Html_EndTH] = 2;
99 priority[Html_TR] = 3;
100 priority[Html_EndTR] = 3;
101 priority[Html_TABLE] = 4;
102 priority[Html_EndTABLE] = 4;
103 }
104 if (tag <= 0 || tag > Html_TypeCount) {
106 return GetCurrentStyle();
107 }
108 while ((p = fStyleStack) != 0) {
109 type = p->fType;
110 if (type <= 0 || type > Html_TypeCount) {
112 return GetCurrentStyle();
113 }
114 if (type != tag && priority[type] > priority[tag]) {
115 return GetCurrentStyle();
116 }
117 fStyleStack = p->fPNext;
118 delete p;
119 if (type == tag) break;
120 }
121
122 return GetCurrentStyle();
123}
124
125////////////////////////////////////////////////////////////////////////////////
126/// Change the font size on the given style by the delta-amount given
127
128static void ScaleFont(SHtmlStyle_t *pStyle, int delta)
129{
130 int size = FontSize(pStyle->fFont) + delta;
131
132 if (size < 0) {
133 delta -= size;
134 } else if (size > 6) {
135 delta -= size-6;
136 }
137
138 pStyle->fFont += delta;
139}
140
141////////////////////////////////////////////////////////////////////////////////
142/// Add the STY_Invisible style to every token between p_first and p_last.
143
145{
146 if (p_first == 0) return;
147 p_first = p_first->fPNext;
148 while (p_first && p_first != p_last) {
149 p_first->fStyle.fFlags |= STY_Invisible;
150 p_first = p_first->fPNext;
151 }
152}
153
154////////////////////////////////////////////////////////////////////////////////
155/// For the markup <a href=XXX>, find out if the URL has been visited
156/// before or not. Return COLOR_Visited or COLOR_Unvisited, as
157/// appropriate.
158
159int TGHtml::GetLinkColor(const char *zURL)
160{
161 return IsVisited(zURL) ? COLOR_Visited : COLOR_Unvisited;
162}
163
164////////////////////////////////////////////////////////////////////////////////
165/// Returns coordinates of string str.
166
167static int *GetCoords(const char *str, int *nptr)
168{
169 const char *cp = str;
170 char *ncp;
171 int *cr, i, n = 0, sz = 4;
172
173 cr = new int[sz];
174 while (cp) {
175 while (*cp && (!isdigit(*cp))) cp++;
176 if ((!*cp) || (!isdigit(*cp))) break;
177 cr[n] = (int) strtol(cp, &ncp, 10);
178 if (cp == ncp) break;
179 cp = ncp;
180 n++;
181 if (n >= sz) {
182 int *tmp = new int[sz+4];
183 for (i = 0; i < sz; ++i) tmp[i] = cr[i];
184 delete[] cr;
185 cr = tmp;
186 sz += 4;
187 }
188 }
189 *nptr = n;
190
191 return cr;
192}
193
194////////////////////////////////////////////////////////////////////////////////
195/// This routine adds information to the input texts that doesn't change
196/// when the display is resized or when new fonts are selected, etc.
197/// Mostly this means adding style attributes. But other constant
198/// information (such as numbering on <li> and images used for <IMG>)
199/// is also obtained. The key is that this routine is only called
200/// once, where the sizer and layout routines can be called many times.
201///
202/// This routine is called whenever the list of elements grows. The
203/// style stack is stored as part of the HTML widget so that we can
204/// always continue where we left off the last time.
205///
206/// In addition to adding style, this routine will invoke methods
207/// needed to acquire information about a markup. The IsVisitied()
208/// method is called for each <a> and the GetImage() is called
209/// for each <IMG> or for each <LI> that has a SRC= field.
210///
211/// When a markup is inserted or deleted from the token list, the
212/// style routine must be completely rerun from the beginning. So
213/// what we said above, that this routine is only run once, is not
214/// strictly true.
215
217{
218 SHtmlStyle_t style; // Current style
219 int size; // A new font size
220 int i; // Loop counter
221 int paraAlign; // Current paragraph alignment
222 int rowAlign; // Current table row alignment
223 SHtmlStyle_t nextStyle; // Style for next token if useNextStyle==1
224 int useNextStyle = 0; // True if nextStyle is valid
225 const char *z; // A tag parameter's value
226
227 // The size of header fonts relative to the current font size
228 static int header_sizes[] = { +2, +1, 1, 1, -1, -1 };
229
230 // Don't allow recursion
231 if (fFlags & STYLER_RUNNING) return;
233
234 // Load the style state out of the TGHtml object and into local
235 // variables. This is purely a matter of convenience...
236
238 nextStyle = style; //ia: nextStyle was not initialized
239 paraAlign = fParaAlignment;
240 rowAlign = fRowAlignment;
241
242 // Loop over tokens
243 while (fPFirst && p) {
244 switch (p->fType) {
245 case Html_A:
246 if (fAnchorStart) {
248 fAnchorStart = 0;
249 fAnchorFlags = 0;
250 }
251 z = p->MarkupArg("href", 0);
252 if (z) {
253 style.fColor = GetLinkColor(z);
254 if (fUnderlineLinks) style.fFlags |= STY_Underline;
258 }
259 break;
260
261 case Html_EndA:
262 if (fAnchorStart) {
263 ((TGHtmlRef *)p)->fPOther = fAnchorStart;
265 fAnchorStart = 0;
266 fAnchorFlags = 0;
267 }
268 break;
269
270 case Html_MAP:
271 break;
272
273 case Html_EndMAP:
274 break;
275
276 case Html_AREA: {
277 TGHtmlMapArea *area = (TGHtmlMapArea *) p;
278 z = p->MarkupArg("shape", 0);
279 area->fMType = HTML_MAP_RECT;
280 if (z) {
281 if (strcasecmp(z, "circle") == 0) {
282 area->fMType = HTML_MAP_CIRCLE;
283 } else if (strcasecmp(z,"poly") == 0) {
284 area->fMType = HTML_MAP_POLY;
285 }
286 }
287 z = p->MarkupArg("coords", 0);
288 if (z) {
289 area->fCoords = GetCoords(z, &area->fNum);
290 }
291 break;
292 }
293
294 case Html_ADDRESS:
295 case Html_EndADDRESS:
296 case Html_BLOCKQUOTE:
298 paraAlign = ALIGN_None;
299 break;
300
301 case Html_APPLET:
302 if (0 /* has ProcessApplet() */) {
303 nextStyle = style;
304 nextStyle.fFlags |= STY_Invisible;
305 PushStyleStack(Html_EndAPPLET, nextStyle);
306 useNextStyle = 1;
307 } else {
309 }
310 break;
311
312 case Html_B:
313 style.fFont = BoldFont(style.fFont);
315 break;
316
317 case Html_BODY:
318 z = p->MarkupArg("text", 0);
319 if (z) {
320 //FreeColor(fApColor[COLOR_Normal]);
322 }
323 z = p->MarkupArg("bgcolor", 0);
324 if (z) {
325 //FreeColor(fApColor[COLOR_Background]);
329 }
330 z = p->MarkupArg("link", 0);
331 if (z) {
332 //FreeColor(fApColor[COLOR_Unvisited]);
334 }
335 z = p->MarkupArg("vlink", 0);
336 if (z) {
337 //FreeColor(fApColor[COLOR_Visited]);
339 }
340 z = p->MarkupArg("alink", 0);
341 if (z) {
342 }
343 z = p->MarkupArg("background", 0);
344 if (z) {
345 z = ResolveUri(z);
346 if (z) {
347 TImage *img = LoadImage(z, 0, 0);
348 if (img) {
349#if 0
350 SetupBackgroundPic(img->GetPicture());
351#else
352 GCValues_t gcv;
353 // unsigned int mask;
354
355 // mask = kGCTile | kGCFillStyle | kGCGraphicsExposures;
356 gcv.fTile = img->GetPixmap();
360
361 gVirtualX->ChangeGC(fWhiteGC.GetGC(), &gcv);
362
363 //NeedRedraw(TGRectangle(fVisible, fCanvas->GetSize()));
364#endif
365 fBgImage = img;//delete img;
366 }
367 delete [] z;
368 }
369 }
370 break;
371
372 case Html_EndBODY:
373 break;
374
375 case Html_EndAPPLET:
376 case Html_EndB:
377 case Html_EndBIG:
378 case Html_EndCENTER:
379 case Html_EndCITE:
380 case Html_EndCODE:
381 case Html_EndCOMMENT:
382 case Html_EndDFN:
383 case Html_EndEM:
384 case Html_EndFONT:
385 case Html_EndI:
386 case Html_EndKBD:
387 case Html_EndMARQUEE:
388 case Html_EndNOBR:
389 case Html_EndNOFRAMES:
390 case Html_EndNOSCRIPT:
391 case Html_EndNOEMBED:
392 case Html_EndS:
393 case Html_EndSAMP:
394 case Html_EndSMALL:
395 case Html_EndSTRIKE:
396 case Html_EndSTRONG:
397 case Html_EndSUB:
398 case Html_EndSUP:
399 case Html_EndTITLE:
400 case Html_EndTT:
401 case Html_EndU:
402 case Html_EndVAR:
404 break;
405
406 case Html_BASE:
407 z = p->MarkupArg("href", 0);
408 if (z) {
409 char *z1 = ResolveUri(z);
410 if (z1 != 0) {
411 if (fZBaseHref) delete[] fZBaseHref;
412 fZBaseHref = z1;
413 }
414 }
415 break;
416
417 case Html_EndDIV:
418 paraAlign = ALIGN_None;
420 break;
421
422 case Html_EndBASEFONT:
424 style.fFont = FontFamily(style.fFont) + 2;
425 break;
426
427 case Html_BIG:
428 ScaleFont(&style, 1);
430 break;
431
432 case Html_CAPTION:
433 paraAlign = p->GetAlignment(paraAlign);
434 break;
435
436 case Html_EndCAPTION:
437 paraAlign = ALIGN_None;
438 break;
439
440 case Html_CENTER:
441 paraAlign = ALIGN_None;
442 style.fAlign = ALIGN_Center;
444 break;
445
446 case Html_CITE:
447 style.fFont = ItalicFont(style.fFont);
449 break;
450
451 case Html_CODE:
452 style.fFont = CWFont(style.fFont);
454 break;
455
456 case Html_COMMENT:
457 style.fFlags |= STY_Invisible;
459 break;
460
461 case Html_DD:
462 if (fInnerList && fInnerList->fType == Html_DL) {
463 ((TGHtmlRef *)p)->fPOther = fInnerList;
464 } else {
465 ((TGHtmlRef *)p)->fPOther = 0;
466 }
467 fInDt = 0;
468 break;
469
470 case Html_DFN:
471 style.fFont = ItalicFont(style.fFont);
473 break;
474
475 case Html_DIR:
476 case Html_MENU:
477 case Html_UL: {
478 TGHtmlListStart *list = (TGHtmlListStart *) p;
479 list->fLPrev = fInnerList;
480 list->fCnt = 0;
481 fInnerList = list;
482 if (list->fLPrev == 0) {
483 list->fLtype = LI_TYPE_Bullet1;
484 list->fCompact = (list->MarkupArg("compact", 0) != 0);
485 } else if (list->fLPrev->fLPrev == 0) {
486 list->fLtype = LI_TYPE_Bullet2;
487 list->fCompact = 1;
488 } else {
489 list->fLtype = LI_TYPE_Bullet3;
490 list->fCompact = 1;
491 }
492 list->fLtype = list->GetUnorderedListType(list->fLtype);
493 break;
494 }
495
496 case Html_EndDL:
497 fInDt = 0;
498 /* Fall thru into the next case */
499 case Html_EndDIR:
500 case Html_EndMENU:
501 case Html_EndOL:
502 case Html_EndUL:
503 ((TGHtmlRef *)p)->fPOther = fInnerList;
505 break;
506
507 case Html_DIV:
508 paraAlign = ALIGN_None;
509 style.fAlign = p->GetAlignment(style.fAlign);
511 break;
512
513 case Html_DT:
514 if (fInnerList && fInnerList->fType == Html_DL) {
515 ((TGHtmlRef *)p)->fPOther = fInnerList;
516 } else {
517 ((TGHtmlRef *)p)->fPOther = 0;
518 }
519 fInDt = STY_DT;
520 break;
521
522 case Html_EndDD:
523 case Html_EndDT:
524 fInDt = 0;
525 break;
526
527 case Html_DL: {
528 TGHtmlListStart *list = (TGHtmlListStart *) p;
529 list->fLPrev = fInnerList;
530 list->fCnt = 0;
531 fInnerList = list;
532 list->fCompact = (list->MarkupArg("compact", 0) != 0);
533 fInDt = 0;
534 break;
535 }
536
537 case Html_EM:
538 style.fFont = ItalicFont(style.fFont);
540 break;
541
542 case Html_EMBED:
543 break;
544
545 case Html_BASEFONT:
546 case Html_FONT:
547 z = p->MarkupArg("size", 0);
548 if (z && !fOverrideFonts) {
549 if (*z == '-') {
550 size = FontSize(style.fFont) - atoi(&z[1]) +1;
551 } else if (*z == '+') {
552 size = FontSize(style.fFont) + atoi(&z[1]) +1;
553 } else {
554 size = atoi(z);
555 }
556 if (size <= 0) size = 1;
557 if (size >= N_FONT_SIZE) size = N_FONT_SIZE - 1;
558 style.fFont = FontFamily(style.fFont) + size - 1;
559 }
560 z = p->MarkupArg("color", 0);
561 if (z && *z && !fOverrideColors) style.fColor = GetColorByName(z);
564 break;
565
566 case Html_FORM: {
567 TGHtmlForm *form = (TGHtmlForm *) p;
568
569 const char *zUrl;
570 const char *zMethod;
571 TGString cmd("");
572 // int result;
573 char zToken[50];
574
575 fFormStart = 0;
576 //form->fFormId = 0;
577
578 zUrl = p->MarkupArg("action", 0);
579 if (zUrl == 0) zUrl = fZBase;
580 zUrl = ResolveUri(zUrl);
581 if (zUrl == 0) zUrl = StrDup("");
582 zMethod = p->MarkupArg("method", "GET");
583 snprintf(zToken, 50, " %d form ", form->fFormId);
584 cmd.Append("Form:");
585 cmd.Append(zToken);
586 cmd.Append(zUrl);
587 cmd.Append(" ");
588 cmd.Append(zMethod);
589 cmd.Append(" { ");
591 cmd.Append("} ");
592 /* result = */ FormCreate(form, zUrl, cmd.GetString());
593 delete[] zUrl;
594
595 /*if (result)*/ fFormStart = form;
596
597 break;
598 }
599
600 case Html_EndFORM:
601 ((TGHtmlRef *)p)->fPOther = fFormStart;
602 if (fFormStart) fFormStart->fPEnd = p;
603 fFormStart = 0;
604 break;
605
606 case Html_H1:
607 case Html_H2:
608 case Html_H3:
609 case Html_H4:
610 case Html_H5:
611 case Html_H6:
612 if (!fInTr) paraAlign = ALIGN_None;
613 i = (p->fType - Html_H1) / 2 + 1;
614 if (i >= 1 && i <= 6) {
615 ScaleFont(&style, header_sizes[i-1]);
616 }
617 style.fFont = BoldFont(style.fFont);
618 style.fAlign = p->GetAlignment(style.fAlign);
620 break;
621
622 case Html_EndH1:
623 case Html_EndH2:
624 case Html_EndH3:
625 case Html_EndH4:
626 case Html_EndH5:
627 case Html_EndH6:
628 paraAlign = ALIGN_None;
630 break;
631
632 case Html_HR:
633 nextStyle = style;
634 style.fAlign = p->GetAlignment(ALIGN_None);
635 useNextStyle = 1;
636 break;
637
638 case Html_I:
639 style.fFont = ItalicFont(style.fFont);
641 break;
642
643 case Html_IMG:
644 if (style.fFlags & STY_Invisible) break;
645 ((TGHtmlImageMarkup *)p)->fPImage = GetImage((TGHtmlImageMarkup *) p);
646 break;
647
648 case Html_OPTION:
649 break;
650
651 case Html_INPUT:
652 ((TGHtmlInput *)p)->fPForm = fFormStart;
653 ////ControlSize((TGHtmlInput *) p);
654 break;
655
656 case Html_KBD:
657 style.fFont = CWFont(style.fFont);
659 break;
660
661 case Html_LI:
662 if (fInnerList) {
663 TGHtmlLi *li = (TGHtmlLi *) p;
664 li->fLtype = fInnerList->fLtype;
665 if (fInnerList->fType == Html_OL) {
666 z = li->MarkupArg("value", 0);
667 if (z) {
668 int n = atoi(z);
669 if (n > 0) {
670 li->fCnt = n;
671 fInnerList->fCnt = n+1;
672 }
673 } else {
674 li->fCnt = fInnerList->fCnt++;
675 }
676 li->fLtype = li->GetOrderedListType(li->fLtype);
677 } else {
678 li->fLtype = li->GetUnorderedListType(li->fLtype);
679 }
680 } else {
681 p->fFlags &= ~HTML_Visible;
682 }
683 break;
684
685 case Html_MARQUEE:
686 style.fFlags |= STY_Invisible;
688 break;
689
690 case Html_NOBR:
691 style.fFlags |= STY_NoBreak;
693 break;
694
695 case Html_NOFRAMES:
696 if (0 /* has ProcessFrame()*/) {
697 nextStyle = style;
698 nextStyle.fFlags |= STY_Invisible;
700 useNextStyle = 1;
701 } else {
703 }
704 break;
705
706 case Html_NOEMBED:
707 if (0 /* has ProcessScript() && HasScript */) {
708 nextStyle = style;
709 nextStyle.fFlags |= STY_Invisible;
711 useNextStyle = 1;
712 } else {
714 }
715 break;
716
717 case Html_NOSCRIPT:
718 if (0 /* has ProcessScript() && HasScript */) {
719 nextStyle = style;
720 nextStyle.fFlags |= STY_Invisible;
722 useNextStyle = 1;
723 } else {
725 }
726 break;
727
728 case Html_OL: {
729 TGHtmlListStart *list = (TGHtmlListStart *) p;
730 list->fLPrev = fInnerList;
732 list->fCnt = 1;
733 z = list->MarkupArg("start", 0);
734 if (z) {
735 int n = atoi(z);
736 if (n > 0) list->fCnt = n;
737 }
738 list->fCompact = (fInnerList != 0 || list->MarkupArg("compact", 0) != 0);
739 fInnerList = list;
740 break;
741 }
742
743 case Html_P:
744 paraAlign = p->GetAlignment(ALIGN_None);
745 break;
746
747 case Html_EndP:
748 paraAlign = ALIGN_None;
749 break;
750
751 case Html_PRE:
752 case Html_LISTING:
753 case Html_XMP:
754 case Html_PLAINTEXT:
755 paraAlign = ALIGN_None;
756 style.fFont = CWFont(style.fFont);
757 style.fFlags |= STY_Preformatted;
759 break;
760
761 case Html_EndPRE:
762 case Html_EndLISTING:
763 case Html_EndXMP:
765 break;
766
767 case Html_S:
768 style.fFlags |= STY_StrikeThru;
770 break;
771
772 case Html_SCRIPT: {
773 char *result;
774 result = ProcessScript((TGHtmlScript *) p); // fZText[script->nStart .. script->nScript]
775 if (result) {
776 TGHtmlElement *b2 = p->fPNext, *b3, *e1 = p, *e2 = b2, *e3;
777 if (e2) while (e2->fPNext) e2 = e2->fPNext;
778 TokenizerAppend(result);
779 if (e2 && e2 != p && ((e3 = b3 = e2->fPNext))) {
780 while (e3->fPNext) e3 = e3->fPNext;
781 e1->fPNext = b3;
782 e2->fPNext = 0; b2->fPPrev = e3;
783 e3->fPNext = b2; b3->fPPrev = e1;
784 }
785 delete[] result;
786 }
787 nextStyle = style;
788 style.fFlags |= STY_Invisible;
789 useNextStyle = 1;
790 break;
791 }
792
793 case Html_SELECT:
794 ((TGHtmlInput *)p)->fPForm = fFormStart;
795 nextStyle.fFlags |= STY_Invisible;
796 useNextStyle = 1;
799 break;
800
801 case Html_EndSELECT:
804 ((TGHtmlRef *)p)->fPOther = fFormElemStart;
805 MakeInvisible(((TGHtmlRef *)p)->fPOther, p);
806 } else {
807 ((TGHtmlRef *)p)->fPOther = 0;
808 }
809 fFormElemStart = 0;
810 break;
811
812 case Html_STRIKE:
813 style.fFlags |= STY_StrikeThru;
815 break;
816
817 case Html_STYLE:
818 // Ignore style sheets
819 break;
820
821 case Html_SAMP:
822 style.fFont = CWFont(style.fFont);
824 break;
825
826 case Html_SMALL:
827 ScaleFont(&style, -1);
829 break;
830
831 case Html_STRONG:
832 style.fFont = BoldFont(style.fFont);
834 break;
835
836 case Html_SUB:
837 ScaleFont(&style, -1);
838 if (style.fSubscript > -6 ) style.fSubscript--;
840 break;
841
842 case Html_SUP:
843 ScaleFont(&style, -1);
844 if (style.fSubscript < 6) style.fSubscript++;
846 break;
847
848 case Html_TABLE:
849 paraAlign = ALIGN_None;
850 nextStyle = style;
851 if (style.fFlags & STY_Preformatted) {
852 nextStyle.fFlags &= ~STY_Preformatted;
853 style.fFlags |= STY_Preformatted;
854 }
855 nextStyle.fAlign = ALIGN_Left;
856 z = p->MarkupArg("bgcolor", 0);
857 if (z && *z && !fOverrideColors) {
858 style.fBgcolor = nextStyle.fBgcolor = GetColorByName(z);
859 style.fExpbg = 1;
860// } else {
861// nextStyle.fBgcolor = COLOR_Background;
862 }
864 PushStyleStack(Html_EndTABLE, nextStyle);
865 useNextStyle = 1;
866 fInTd = 0;
867 fInTr = 0;
868 break;
869
870 case Html_EndTABLE:
871 paraAlign = ALIGN_None;
872 if (fInTd) {
874 fInTd = 0;
875 }
876 if (fInTr) {
878 fInTr = 0;
879 }
881 break;
882
883 case Html_TD:
885 fInTd = 1;
886 paraAlign = p->GetAlignment(rowAlign);
887 z = p->MarkupArg("bgcolor", 0);
888 if (z && *z && !fOverrideColors) {
889 style.fBgcolor = GetColorByName(z);
890 style.fExpbg = 1;
891 }
894 break;
895
896 case Html_TEXTAREA:
897 ((TGHtmlInput *)p)->fPForm = fFormStart;
898 nextStyle = style;
899 nextStyle.fFlags |= STY_Invisible;
902 useNextStyle = 1;
903 break;
904
905 case Html_EndTEXTAREA:
908 ((TGHtmlRef *)p)->fPOther = fFormElemStart;
909 } else {
910 ((TGHtmlRef *)p)->fPOther = 0;
911 }
912 fFormElemStart = 0;
913 break;
914
915 case Html_TH:
916 //paraAlign = p->GetAlignment(rowAlign);
918 paraAlign = p->GetAlignment(ALIGN_Center);
919 style.fFont = BoldFont(style.fFont);
920 z = p->MarkupArg("bgcolor", 0);
921 if (z && *z && !fOverrideColors) {
922 style.fBgcolor = GetColorByName(z);
923 style.fExpbg = 1;
924 }
926 fInTd = 1;
927 break;
928
929 case Html_TR:
930 if (fInTd) {
932 fInTd = 0;
933 }
934 if (fInTr) {
936 }
937 rowAlign = p->GetAlignment(ALIGN_None);
938 z = p->MarkupArg("bgcolor", 0);
939 if (z && *z && !fOverrideColors) {
940 style.fBgcolor = GetColorByName(z);
941 style.fExpbg = 1;
942 }
945 fInTr = 1;
946 break;
947
948 case Html_EndTR:
949 if (fInTd) {
951 fInTd = 0;
952 }
954 fInTr = 0;
955 paraAlign = ALIGN_None;
956 rowAlign = ALIGN_None;
957 break;
958
959 case Html_EndTD:
960 case Html_EndTH:
962 fInTd = 0;
963 paraAlign = ALIGN_None;
964 //rowAlign = ALIGN_None;
965 break;
966
967 case Html_TITLE:
968 style.fFlags |= STY_Invisible;
970 break;
971
972 case Html_TT:
973 style.fFont = CWFont(style.fFont);
975 break;
976
977 case Html_U:
978 style.fFlags |= STY_Underline;
980 break;
981
982 case Html_VAR:
983 style.fFont = ItalicFont(style.fFont);
985 break;
986
987 default:
988 break;
989 }
990
991 p->fStyle = style;
993 if (paraAlign != ALIGN_None) {
994 p->fStyle.fAlign = paraAlign;
995 }
996 if (useNextStyle) {
997 style = nextStyle;
998 style.fExpbg = 0;
999 useNextStyle = 0;
1000 }
1001
1003 ("Style font=%02d color=%02d bg=%02d "
1004 "align=%d flags=0x%04x token=%s\n",
1006 p->fStyle.fAlign, p->fStyle.fFlags, DumpToken(p)));
1007
1008 p = p->fPNext;
1009 }
1010
1011 // Copy state information back into the TGHtml object for safe keeping.
1012
1013 fParaAlignment = paraAlign;
1014 fRowAlignment = rowAlign;
1015
1016 fFlags &= ~STYLER_RUNNING;
1017}
1018
1019////////////////////////////////////////////////////////////////////////////////
1020/// Set background picture of a html table.
1021
1023{
1024 const char *z;
1025
1026 z = p->MarkupArg("background", 0);
1027 if (!z) return;
1028
1029 char *z1 = ResolveUri(z);
1030 TImage *img = LoadImage(z1, 0, 0);
1031 delete [] z1;
1032
1033 switch (p->fType) {
1034 case Html_TABLE: {
1035 TGHtmlTable *table = (TGHtmlTable *) p;
1036 if (table->fBgImage) delete table->fBgImage;
1037 table->fBgImage = img;
1038 break;
1039 }
1040 case Html_TR: {
1041 TGHtmlRef *ref = (TGHtmlRef *) p;
1042 if (ref->fBgImage) delete ref->fBgImage;
1043 ref->fBgImage = img;
1044 break;
1045 }
1046 case Html_TH:
1047 case Html_TD: {
1048 TGHtmlCell *cell = (TGHtmlCell *) p;
1049 if (cell->fBgImage) delete cell->fBgImage;
1050 cell->fBgImage = img;
1051 break;
1052 }
1053 default:
1054 if (img) delete img;
1055 break;
1056 }
1057}
1058
1059////////////////////////////////////////////////////////////////////////////////
1060/// Compute the size of all elements in the widget. Assume that a style has
1061/// already been assigned to all elements.
1062///
1063/// Some of the elements might have already been sized. Refer to the
1064/// fLastSized and only compute sizes for elements that follow this one. If
1065/// fLastSized is 0, then size everything.
1066///
1067/// This routine only computes the sizes of individual elements. The size of
1068/// aggregate elements (like tables) are computed separately.
1069///
1070/// The HTML_Visible flag is also set on every element that results in ink on
1071/// the page.
1072///
1073/// This routine may invoke a callback procedure which could delete the HTML
1074/// widget.
1075
1077{
1078 TGHtmlElement *p;
1079 int iFont = -1;
1080 TGFont *font=0;
1081 int spaceWidth = 0;
1082 FontMetrics_t fontMetrics;
1083 const char *z;
1084 int stop = 0;
1085
1086 if (fPFirst == 0) return;
1087
1088 if (fLastSized == 0) {
1089 p = fPFirst;
1090 } else {
1091 p = fLastSized->fPNext;
1092 }
1093
1094 // coverity[dead_error_line]
1095 for (; !stop && p; p = p ? p->fPNext : 0) {
1096 if (p->fStyle.fFlags & STY_Invisible) {
1097 p->fFlags &= ~HTML_Visible;
1098 continue;
1099 }
1100 if (iFont != (int)p->fStyle.fFont) {
1101 iFont = p->fStyle.fFont;
1102 font = GetFont(iFont);
1103 font->GetFontMetrics(&fontMetrics);
1104 spaceWidth = 0;
1105 }
1106 if (!font)
1107 continue;
1108 switch (p->fType) {
1109 case Html_Text: {
1111 text->fW = font->TextWidth(text->fZText, p->fCount);
1112 p->fFlags |= HTML_Visible;
1113 text->fDescent = fontMetrics.fDescent;
1114 text->fAscent = fontMetrics.fAscent;
1115 if (spaceWidth == 0) spaceWidth = font->TextWidth(" ", 1);
1116 text->fSpaceWidth = spaceWidth;
1117 break;
1118 }
1119
1120 case Html_Space: {
1122 if (spaceWidth == 0) spaceWidth = font->TextWidth(" ", 1);
1123 space->fW = spaceWidth;
1124 space->fDescent = fontMetrics.fDescent;
1125 space->fAscent = fontMetrics.fAscent;
1126 p->fFlags &= ~HTML_Visible;
1127 break;
1128 }
1129
1130 case Html_TD:
1131 case Html_TH: {
1132 TGHtmlCell *cell = (TGHtmlCell *) p;
1133 z = p->MarkupArg("rowspan", "1");
1134 cell->fRowspan = z ? atoi(z) : 1;
1135 z = p->MarkupArg("colspan", "1");
1136 cell->fColspan = z ? atoi(z) : 1;
1137 p->fFlags |= HTML_Visible;
1138 break;
1139 }
1140
1141 case Html_LI: {
1142 TGHtmlLi *li = (TGHtmlLi *) p;
1143 li->fDescent = fontMetrics.fDescent;
1144 li->fAscent = fontMetrics.fAscent;
1145 p->fFlags |= HTML_Visible;
1146 break;
1147 }
1148
1149 case Html_IMG: {
1150 TGHtmlImageMarkup *image = (TGHtmlImageMarkup *) p;
1151 z = p->MarkupArg("usemap", 0);
1152 if (z && *z == '#') {
1153 image->fPMap = GetMap(z+1);
1154 } else {
1155 image->fPMap = 0;
1156 }
1157 p->fFlags |= HTML_Visible;
1158 image->fRedrawNeeded = 0;
1159 image->fTextAscent = fontMetrics.fAscent;
1160 image->fTextDescent = fontMetrics.fDescent;
1161 image->fAlign = GetImageAlignment(p);
1162 if (image->fPImage == 0) {
1163 image->fAscent = fontMetrics.fAscent;
1164 image->fDescent = fontMetrics.fDescent;
1165 image->fZAlt = p->MarkupArg("alt", "<image>");
1166 if (image->fZAlt == 0) image->fZAlt = "<image>";
1167 image->fW = font->TextWidth(image->fZAlt, strlen(image->fZAlt));
1168 } else {
1169 int w, h;
1170 image->fINext = image->fPImage->fPList;
1171 image->fPImage->fPList = image;
1172 w = image->fPImage->fImage->GetWidth();
1173 h = image->fPImage->fImage->GetHeight();
1174 image->fH = h;
1175 image->fW = w;
1176 image->fAscent = h / 2;
1177 image->fDescent = h - image->fAscent;
1178 }
1179 if ((z = p->MarkupArg("width", 0)) != 0) {
1180 int w = atoi(z);
1181 if (z[strlen(z)-1] == '%') w = 0; //// -- HP
1182 if (w > 0) image->fW = w;
1183 }
1184 if ((z = p->MarkupArg("height", 0)) != 0) {
1185 int h = atoi(z);
1186 if (h > 0) image->fH = h;
1187 }
1188
1189#if 1 // --HP
1190 if (image->fPImage == 0 && !*image->fZAlt) {
1191 image->fAscent = image->fH / 2;
1192 image->fDescent = image->fH - image->fAscent;
1193 }
1194#endif
1195 break;
1196 }
1197
1198 case Html_TABLE:
1199 p->fFlags |= HTML_Visible;
1200 break;
1201
1202 case Html_HR:
1203 p->fFlags |= HTML_Visible;
1204 break;
1205
1206 case Html_APPLET:
1207 case Html_EMBED:
1208 case Html_INPUT: {
1209 TGHtmlInput *input = (TGHtmlInput *) p;
1210 input->fTextAscent = fontMetrics.fAscent;
1211 input->fTextDescent = fontMetrics.fDescent;
1212 stop = ControlSize(input);
1213 break;
1214 }
1215
1216 case Html_SELECT:
1217 case Html_TEXTAREA: {
1218 TGHtmlInput *input = (TGHtmlInput *) p;
1219 input->fTextAscent = fontMetrics.fAscent;
1220 input->fTextDescent = fontMetrics.fDescent;
1221 break;
1222 }
1223
1224 case Html_EndSELECT:
1225 case Html_EndTEXTAREA: {
1226 TGHtmlRef *ref = (TGHtmlRef *) p;
1227 if (ref->fPOther) {
1228 ((TGHtmlInput *)ref->fPOther)->fPEnd = p;
1229 stop = ControlSize((TGHtmlInput *) ref->fPOther);
1230 }
1231 break;
1232 }
1233
1234 default:
1235 p->fFlags &= ~HTML_Visible;
1236 break;
1237 }
1238 }
1239
1240 if (p) {
1241 fLastSized = p;
1242 } else {
1244 }
1245}
@ kFillTiled
Definition: GuiTypes.h:51
#define h(i)
Definition: RSha256.hxx:106
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
const Bool_t kTRUE
Definition: RtypesCore.h:100
static void ScaleFont(SHtmlStyle_t *pStyle, int delta)
Change the font size on the given style by the delta-amount given.
static int * GetCoords(const char *str, int *nptr)
Returns coordinates of string str.
#define Html_TypeCount
Definition: TGHtmlTokens.h:198
@ Html_EndBODY
Definition: TGHtmlTokens.h:64
@ Html_NOEMBED
Definition: TGHtmlTokens.h:137
@ Html_SUP
Definition: TGHtmlTokens.h:170
@ Html_H3
Definition: TGHtmlTokens.h:103
@ Html_MARQUEE
Definition: TGHtmlTokens.h:129
@ Html_EndH4
Definition: TGHtmlTokens.h:106
@ Html_FORM
Definition: TGHtmlTokens.h:93
@ Html_U
Definition: TGHtmlTokens.h:186
@ Html_DFN
Definition: TGHtmlTokens.h:78
@ Html_COMMENT
Definition: TGHtmlTokens.h:74
@ Html_EndTT
Definition: TGHtmlTokens.h:185
@ Html_EndTH
Definition: TGHtmlTokens.h:179
@ Html_EndMENU
Definition: TGHtmlTokens.h:132
@ Html_BODY
Definition: TGHtmlTokens.h:63
@ Html_EM
Definition: TGHtmlTokens.h:88
@ Html_BLOCKQUOTE
Definition: TGHtmlTokens.h:61
@ Html_HR
Definition: TGHtmlTokens.h:111
@ Html_STRIKE
Definition: TGHtmlTokens.h:163
@ Html_EndTABLE
Definition: TGHtmlTokens.h:173
@ Html_I
Definition: TGHtmlTokens.h:114
@ Html_KBD
Definition: TGHtmlTokens.h:120
@ Html_DL
Definition: TGHtmlTokens.h:84
@ Html_EndTEXTAREA
Definition: TGHtmlTokens.h:177
@ Html_TEXTAREA
Definition: TGHtmlTokens.h:176
@ Html_XMP
Definition: TGHtmlTokens.h:193
@ Html_EndNOSCRIPT
Definition: TGHtmlTokens.h:142
@ Html_DT
Definition: TGHtmlTokens.h:86
@ Html_NOBR
Definition: TGHtmlTokens.h:135
@ Html_TD
Definition: TGHtmlTokens.h:174
@ Html_EMBED
Definition: TGHtmlTokens.h:90
@ Html_STYLE
Definition: TGHtmlTokens.h:167
@ Html_CENTER
Definition: TGHtmlTokens.h:68
@ Html_TITLE
Definition: TGHtmlTokens.h:180
@ Html_SCRIPT
Definition: TGHtmlTokens.h:158
@ Html_LI
Definition: TGHtmlTokens.h:122
@ Html_EndBLOCKQUOTE
Definition: TGHtmlTokens.h:62
@ Html_EndSELECT
Definition: TGHtmlTokens.h:160
@ Html_EndSTRIKE
Definition: TGHtmlTokens.h:164
@ Html_EndSUB
Definition: TGHtmlTokens.h:169
@ Html_EndNOEMBED
Definition: TGHtmlTokens.h:138
@ Html_CAPTION
Definition: TGHtmlTokens.h:66
@ Html_EndLISTING
Definition: TGHtmlTokens.h:126
@ Html_AREA
Definition: TGHtmlTokens.h:52
@ Html_S
Definition: TGHtmlTokens.h:154
@ Html_EndDFN
Definition: TGHtmlTokens.h:79
@ Html_EndADDRESS
Definition: TGHtmlTokens.h:49
@ Html_UL
Definition: TGHtmlTokens.h:188
@ Html_LISTING
Definition: TGHtmlTokens.h:125
@ Html_TABLE
Definition: TGHtmlTokens.h:172
@ Html_EndUL
Definition: TGHtmlTokens.h:189
@ Html_EndOL
Definition: TGHtmlTokens.h:144
@ Html_NOFRAMES
Definition: TGHtmlTokens.h:139
@ Html_PLAINTEXT
Definition: TGHtmlTokens.h:151
@ Html_EndS
Definition: TGHtmlTokens.h:155
@ Html_EndDIR
Definition: TGHtmlTokens.h:81
@ Html_OPTION
Definition: TGHtmlTokens.h:145
@ Html_EndI
Definition: TGHtmlTokens.h:115
@ Html_H2
Definition: TGHtmlTokens.h:101
@ Html_EndSTRONG
Definition: TGHtmlTokens.h:166
@ Html_EndNOBR
Definition: TGHtmlTokens.h:136
@ Html_APPLET
Definition: TGHtmlTokens.h:50
@ Html_EndSUP
Definition: TGHtmlTokens.h:171
@ Html_EndNOFRAMES
Definition: TGHtmlTokens.h:140
@ Html_TH
Definition: TGHtmlTokens.h:178
@ Html_EndFORM
Definition: TGHtmlTokens.h:94
@ Html_EndFONT
Definition: TGHtmlTokens.h:92
@ Html_EndTD
Definition: TGHtmlTokens.h:175
@ Html_MENU
Definition: TGHtmlTokens.h:131
@ Html_CODE
Definition: TGHtmlTokens.h:72
@ Html_TR
Definition: TGHtmlTokens.h:182
@ Html_H6
Definition: TGHtmlTokens.h:109
@ Html_ADDRESS
Definition: TGHtmlTokens.h:48
@ Html_DIV
Definition: TGHtmlTokens.h:82
@ Html_EndB
Definition: TGHtmlTokens.h:54
@ Html_Space
Definition: TGHtmlTokens.h:43
@ Html_EndVAR
Definition: TGHtmlTokens.h:191
@ Html_EndDT
Definition: TGHtmlTokens.h:87
@ Html_EndH3
Definition: TGHtmlTokens.h:104
@ Html_SAMP
Definition: TGHtmlTokens.h:156
@ Html_SELECT
Definition: TGHtmlTokens.h:159
@ Html_H5
Definition: TGHtmlTokens.h:107
@ Html_Text
Definition: TGHtmlTokens.h:42
@ Html_H1
Definition: TGHtmlTokens.h:99
@ Html_EndDIV
Definition: TGHtmlTokens.h:83
@ Html_VAR
Definition: TGHtmlTokens.h:190
@ Html_EndBASEFONT
Definition: TGHtmlTokens.h:57
@ Html_OL
Definition: TGHtmlTokens.h:143
@ Html_A
Definition: TGHtmlTokens.h:46
@ Html_P
Definition: TGHtmlTokens.h:147
@ Html_B
Definition: TGHtmlTokens.h:53
@ Html_IMG
Definition: TGHtmlTokens.h:117
@ Html_CITE
Definition: TGHtmlTokens.h:70
@ Html_EndAPPLET
Definition: TGHtmlTokens.h:51
@ Html_EndDL
Definition: TGHtmlTokens.h:85
@ Html_EndCAPTION
Definition: TGHtmlTokens.h:67
@ Html_BIG
Definition: TGHtmlTokens.h:59
@ Html_SUB
Definition: TGHtmlTokens.h:168
@ Html_EndKBD
Definition: TGHtmlTokens.h:121
@ Html_EndCODE
Definition: TGHtmlTokens.h:73
@ Html_NOSCRIPT
Definition: TGHtmlTokens.h:141
@ Html_EndCITE
Definition: TGHtmlTokens.h:71
@ Html_DIR
Definition: TGHtmlTokens.h:80
@ Html_EndSMALL
Definition: TGHtmlTokens.h:162
@ Html_H4
Definition: TGHtmlTokens.h:105
@ Html_EndH1
Definition: TGHtmlTokens.h:100
@ Html_EndH2
Definition: TGHtmlTokens.h:102
@ Html_EndH5
Definition: TGHtmlTokens.h:108
@ Html_STRONG
Definition: TGHtmlTokens.h:165
@ Html_BASE
Definition: TGHtmlTokens.h:55
@ Html_FONT
Definition: TGHtmlTokens.h:91
@ Html_DD
Definition: TGHtmlTokens.h:76
@ Html_EndBIG
Definition: TGHtmlTokens.h:60
@ Html_EndXMP
Definition: TGHtmlTokens.h:194
@ Html_EndDD
Definition: TGHtmlTokens.h:77
@ Html_EndP
Definition: TGHtmlTokens.h:148
@ Html_EndH6
Definition: TGHtmlTokens.h:110
@ Html_EndA
Definition: TGHtmlTokens.h:47
@ Html_EndPRE
Definition: TGHtmlTokens.h:153
@ Html_EndTITLE
Definition: TGHtmlTokens.h:181
@ Html_PRE
Definition: TGHtmlTokens.h:152
@ Html_TT
Definition: TGHtmlTokens.h:184
@ Html_INPUT
Definition: TGHtmlTokens.h:118
@ Html_EndMAP
Definition: TGHtmlTokens.h:128
@ Html_EndMARQUEE
Definition: TGHtmlTokens.h:130
@ Html_EndCOMMENT
Definition: TGHtmlTokens.h:75
@ Html_EndSAMP
Definition: TGHtmlTokens.h:157
@ Html_MAP
Definition: TGHtmlTokens.h:127
@ Html_SMALL
Definition: TGHtmlTokens.h:161
@ Html_EndCENTER
Definition: TGHtmlTokens.h:69
@ Html_EndU
Definition: TGHtmlTokens.h:187
@ Html_BASEFONT
Definition: TGHtmlTokens.h:56
@ Html_EndTR
Definition: TGHtmlTokens.h:183
@ Html_EndEM
Definition: TGHtmlTokens.h:89
#define STYLER_RUNNING
Definition: TGHtml.h:1338
#define HTML_MAP_CIRCLE
Definition: TGHtml.h:465
#define LI_TYPE_Bullet2
Definition: TGHtml.h:440
#define COLOR_Unvisited
Definition: TGHtml.h:198
#define HTML_Visible
Definition: TGHtml.h:275
unsigned char Html_u8_t
Definition: TGHtml.h:136
#define ALIGN_Left
Definition: TGHtml.h:209
#define STY_Invisible
Definition: TGHtml.h:240
#define HTML_MAP_RECT
Definition: TGHtml.h:464
#define LI_TYPE_Bullet1
Definition: TGHtml.h:439
#define LI_TYPE_Enum_1
Definition: TGHtml.h:442
#define CWFont(X)
Definition: TGHtml.h:170
#define HTML_MAP_POLY
Definition: TGHtml.h:466
#define STY_NoBreak
Definition: TGHtml.h:237
#define CANT_HAPPEN
Definition: TGHtml.h:60
#define COLOR_Background
Definition: TGHtml.h:201
#define ItalicFont(X)
Definition: TGHtml.h:169
#define STY_DT
Definition: TGHtml.h:239
#define BoldFont(X)
Definition: TGHtml.h:168
#define STY_Anchor
Definition: TGHtml.h:238
#define ALIGN_Center
Definition: TGHtml.h:211
#define STY_StrikeThru
Definition: TGHtml.h:235
#define N_FONT_SIZE
Definition: TGHtml.h:165
#define STY_Underline
Definition: TGHtml.h:236
#define STY_Preformatted
Definition: TGHtml.h:234
#define FontFamily(X)
Definition: TGHtml.h:172
#define HtmlTrace_Style
Definition: TGHtml.h:96
#define LI_TYPE_Bullet3
Definition: TGHtml.h:441
#define FontSize(X)
Definition: TGHtml.h:171
#define COLOR_Normal
Definition: TGHtml.h:197
#define TRACE(Flag, Args)
Definition: TGHtml.h:121
#define NormalFont(X)
Definition: TGHtml.h:167
#define ALIGN_None
Definition: TGHtml.h:212
#define COLOR_Visited
Definition: TGHtml.h:199
int type
Definition: TGX11.cxx:121
char * StrDup(const char *str)
Duplicate the string str.
Definition: TString.cxx:2515
#define gVirtualX
Definition: TVirtualX.h:338
#define snprintf
Definition: civetweb.c:1540
Encapsulate fonts used in the GUI system.
Definition: TGFont.h:140
void GetFontMetrics(FontMetrics_t *m) const
Get font metrics.
Definition: TGFont.cxx:286
Int_t TextWidth(const char *string, Int_t numChars=-1) const
A wrapper function for the more complicated interface of MeasureChars.
Definition: TGFont.cxx:575
GContext_t GetGC() const
Definition: TGGC.h:41
TImage * fBgImage
Definition: TGHtml.h:396
Html_16_t fColspan
Definition: TGHtml.h:388
Html_16_t fRowspan
Definition: TGHtml.h:387
Html_u8_t fFlags
Definition: TGHtml.h:266
Html_u8_t fType
Definition: TGHtml.h:265
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
TGHtmlElement * fPNext
Definition: TGHtml.h:262
TGHtmlElement * fPEnd
Definition: TGHtml.h:643
Html_u16_t fFormId
Definition: TGHtml.h:639
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_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_u8_t fTextDescent
Definition: TGHtml.h:542
const char * fZAlt
Definition: TGHtml.h:551
TImage * fImage
Definition: TGHtml.h:519
TGHtmlImageMarkup * fPList
Definition: TGHtml.h:525
Html_u8_t fTextAscent
Definition: TGHtml.h:601
Html_u8_t fTextDescent
Definition: TGHtml.h:602
Html_u8_t fDescent
Definition: TGHtml.h:426
Html_u8_t fAscent
Definition: TGHtml.h:425
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 fCnt
Definition: TGHtml.h:458
Html_u8_t fCompact
Definition: TGHtml.h:457
int fMType
Definition: TGHtml.h:473
int * fCoords
Definition: TGHtml.h:474
virtual int GetAlignment(int dflt)
Return an alignment or justification flag associated with the given markup.
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:412
TGHtmlElement * fPOther
Definition: TGHtml.h:411
Html_u8_t fDescent
Definition: TGHtml.h:311
Html_u8_t fAscent
Definition: TGHtml.h:310
Html_16_t fW
Definition: TGHtml.h:309
TImage * fBgImage
Definition: TGHtml.h:370
TGHtmlElement * GetMap(const char *name)
Returns html map element.
Definition: TGHtml.cxx:1593
int fParaAlignment
Definition: TGHtml.h:1198
virtual int FormCreate(TGHtmlForm *, const char *, const char *)
Definition: TGHtml.h:946
const char * fZBase
Definition: TGHtml.h:1268
int fUnderlineLinks
Definition: TGHtml.h:1251
void TokenizerAppend(const char *text)
Append text to the tokenizer engine.
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...
virtual char * ProcessScript(TGHtmlScript *)
Definition: TGHtml.h:958
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
int fAnchorFlags
Definition: TGHtml.h:1200
TGHtmlElement * fLastSized
Definition: TGHtml.h:1140
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
int fFlags
Definition: TGHtml.h:1278
SHtmlStyleStack_t * fStyleStack
Definition: TGHtml.h:1197
TGHtmlListStart * fInnerList
Definition: TGHtml.h:1208
int fOverrideColors
Definition: TGHtml.h:1250
void AppendArglist(TGString *str, TGHtmlMarkupElement *pElem)
Append all the arguments of the given markup to the given TGString.
void TableBgndImage(TGHtmlElement *p)
Set background picture of a html table.
virtual TImage * LoadImage(const char *uri, int w=0, int h=0)
This is the default LoadImage() procedure.
void MakeInvisible(TGHtmlElement *p_first, TGHtmlElement *p_last)
Add the STY_Invisible style to every token between p_first and p_last.
ColorStruct_t * AllocColor(const char *name)
Allocate system color by name.
Definition: TGHtml.cxx:272
int GetImageAlignment(TGHtmlElement *p)
Find the alignment for an image.
Definition: TGHtmlImage.cxx:84
int fRowAlignment
Definition: TGHtml.h:1199
int fInTr
Definition: TGHtml.h:1202
int GetLinkColor(const char *zURL)
For the markup <a href=XXX>, find out if the URL has been visited before or not.
TGHtmlAnchor * fAnchorStart
Definition: TGHtml.h:1204
void Sizer()
Compute the size of all elements in the widget.
TGHtmlElement * fPLast
Definition: TGHtml.h:1137
SHtmlStyle_t PopStyleStack(int tag)
Pop a rendering style off of the stack.
Definition: TGHtmlSizer.cxx:87
int fInTd
Definition: TGHtml.h:1203
virtual int IsVisited(const char *)
Definition: TGHtml.h:924
virtual char * ResolveUri(const char *uri)
This function resolves the specified URI and returns the result in a newly allocated string.
Definition: TGHtmlUri.cxx:284
void PushStyleStack(int tag, SHtmlStyle_t style)
Push a new rendering style onto the stack.
Definition: TGHtmlSizer.cxx:66
int fOverrideFonts
Definition: TGHtml.h:1249
TImage * fBgImage
Definition: TGHtml.h:1246
int ControlSize(TGHtmlInput *p)
This routine implements the Sizer() function for <INPUT>, <SELECT> and <TEXTAREA> markup.
Definition: TGHtmlForm.cxx:357
int fInDt
Definition: TGHtml.h:1201
char * DumpToken(TGHtmlElement *p)
For debugging purposes, print information about a token.
SHtmlStyle_t GetCurrentStyle()
Get the current rendering style.
Definition: TGHtmlSizer.cxx:41
TGHtmlImage * GetImage(TGHtmlImageMarkup *p)
Given an.
TGHtmlInput * fFormElemStart
Definition: TGHtml.h:1206
ColorStruct_t * fApColor[N_COLOR]
Definition: TGHtml.h:1232
TGHtmlForm * fFormStart
Definition: TGHtml.h:1205
char * fZBaseHref
Definition: TGHtml.h:1269
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition: TGString.h:20
const char * GetString() const
Definition: TGString.h:30
virtual void SetBackgroundColor(Pixel_t)
Set background color of the canvas frame.
Definition: TGView.cxx:581
TGViewFrame * fCanvas
frame containing the text
Definition: TGView.h:42
TGGC fWhiteGC
graphics context used for scrolling generates GraphicsExposure events
Definition: TGView.h:46
virtual void SetBackgroundPixmap(Pixmap_t p)
Set backgound pixmap.
Definition: TGView.cxx:591
virtual void SetBackgroundPixmap(Pixmap_t pixmap)
set background pixmap
Definition: TGWindow.cxx:248
An abstract interface to image processing library.
Definition: TImage.h:29
virtual UInt_t GetWidth() const
Definition: TImage.h:228
virtual Pixmap_t GetPixmap()
Definition: TImage.h:235
virtual UInt_t GetHeight() const
Definition: TImage.h:229
TString & Append(const char *cs)
Definition: TString.h:564
TText * text
const Int_t n
Definition: legend1.C:16
Int_t fAscent
Definition: TGFont.h:53
Int_t fDescent
Definition: TGFont.h:54
Graphics context structure.
Definition: GuiTypes.h:224
Pixmap_t fTile
tile pixmap for tiling operations
Definition: GuiTypes.h:238
Bool_t fGraphicsExposures
boolean, should exposures be generated
Definition: GuiTypes.h:244
Int_t fFillStyle
kFillSolid, kFillTiled, kFillStippled, kFillOpaeueStippled
Definition: GuiTypes.h:234
SHtmlStyle_t fStyle
Definition: TGHtml.h:736
SHtmlStyleStack_t * fPNext
Definition: TGHtml.h:734
unsigned int fColor
Definition: TGHtml.h:146
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
TCanvas * style()
Definition: style.C:1