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