Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGHtml.cxx
Go to the documentation of this file.
1// $Id: TGHtml.cxx,v 1.4 2007/05/07 15:19:07 brun Exp $
2// Author: Valeriy Onuchin 03/05/2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2001, Rene Brun, Fons Rademakers and Reiner Rohlfs *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
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#include <cctype>
35#include <cstdlib>
36#include <cstring>
37#include <iostream>
38
39#include "TGHtml.h"
40#include "THashTable.h"
41#include "TObjString.h"
42#include "TGIdleHandler.h"
43#include "TImage.h"
44#include "TTimer.h"
45#include "TGTextEntry.h"
46#include "TGText.h"
47#include "TGComboBox.h"
48#include "TGListBox.h"
49#include "TGFileDialog.h"
50#include "TGMenu.h"
51#include "TVirtualX.h"
52#include "strlcpy.h"
53#include "snprintf.h"
54
55
56/** \class TGHtml
57 \ingroup guihtml
58
59The ROOT HTML widget. A derivate of TGView.
60
61*/
62
63
65
66int HtmlTraceMask = 0; //HtmlTrace_Table1 | HtmlTrace_Table4;
67int HtmlDepth = 0;
68
69#define DEF_FRAME_BG_COLOR "#c0c0c0"
70#define DEF_FRAME_CURSOR ""
71#define DEF_BUTTON_FG "black"
72#define DEF_BUTTON_HIGHLIGHT_BG "#d9d9d9"
73#define DEF_BUTTON_HIGHLIGHT "black"
74
75
76////////////////////////////////////////////////////////////////////////////////
77/// HTML Widget constructor.
78
79TGHtml::TGHtml(const TGWindow *p, int w, int h, int id) : TGView(p, w, h, id)
80{
82
83 int i;
84
85 fExiting = 0;
86 fPFirst = 0;
87 fPLast = 0;
88 fNToken = 0;
89 fLastSized = 0;
90 fNextPlaced = 0;
91 fFirstBlock = 0;
92 fLastBlock = 0;
93 fFirstInput = 0;
94 fLastInput = 0;
95 fNInput = 0;
96 fNForm = 0;
97 fVarId = 0; // do we need this??
98 fInputIdx = 0;
99 fRadioIdx = 0;
100 fSelBegin.fI = 0;
101 fSelBegin.fP = 0;
102 fSelEnd.fI = 0;
103 fSelEnd.fP = 0;
104 fPSelStartBlock = 0;
105 fPSelEndBlock = 0;
108 fInsStatus = 0;
109 fInsTimer = 0;
110 fIns.fI = 0;
111 fIns.fP = 0;
112 fPInsBlock = 0;
113 fInsIndex = 0;
114 fZText = 0;
115 fNText = 0;
116 fNAlloc = 0;
117 fNComplete = 0;
118 fICol = 0;
119 fIPlaintext = 0;
120 fPScript = 0;
121 fIdle = 0;
122 fStyleStack = 0;
125 fAnchorFlags = 0;
126 fInDt = 0;
127 fInTr = 0;
128 fInTd = 0;
129 fAnchorStart = 0;
130 fFormStart = 0;
131 fFormElemStart = 0;
132 fFormElemLast = 0;
133 fLoEndPtr = 0;
134 fLoFormStart = 0;
135 fInnerList = 0;
137 fHighlightWidth = 0;
140 for (i = 0; i < N_FONT; ++i) fAFont[i] = 0;
141 memset(fFontValid, 0, sizeof(fFontValid));
142 for (i = 0; i < N_COLOR; ++i) {
143 fApColor[i] = 0;
144 fIDark[i] = 0;
145 fILight[i] = 0;
146 }
147 fFgColor = AllocColor("black");
148 fBgColor = AllocColor("white"); //AllocColor("#c0c0c0");
152
158
159 fBgImage = 0;
160
162 SetBackgroundPixmap(0); // force usage of solid color
163
164 fColorUsed = 0;
165
166 for (i = 0; i < N_CACHE_GC; ++i) {
167 fAGcCache[i].fIndex = 0;
168 fAGcCache[i].fColor = 0;
169 fAGcCache[i].fFont = 0;
170 fAGcCache[i].fGc = 0;
171 }
172 fLastGC = 0;
173 fSelEndIndex =0;
174 fSelStartIndex = 0;
175 fGcNextToFree = 0;
176 fImageList = 0;
177 fZBaseHref = 0;
178 fInnerList = 0;
179 fFormPadding = 5;
180 fOverrideFonts = 0;
181 fOverrideColors = 0;
182 fHasScript = 0;
183 fHasFrames = 0;
184 fAddEndTags = 0;
185 fTableBorderMin = 0;
186 fVarind = 0;
187 fIdind = 0;
188 fInParse = 0;
189 fZGoto = 0;
190 fExts = 0;
195 fRulePadding = 5;
196 fZBase = 0;
197 fZBaseHref = 0;
199 fMaxX = 0;
200 fMaxY = 0;
201
202 fXMargin = fYMargin = 0; //HTML_INDENT/4;
203
205
207 fDirtyRight = 0;
209 fDirtyBottom = 0;
210
211 fMenu = new TGPopupMenu(gClient->GetDefaultRoot());
212 fMenu->AddEntry(" Save &As...\tCtrl+A", kM_FILE_SAVEAS, 0, gClient->GetPicture("ed_save.png"));
213 fMenu->AddEntry(" &Print...\tCtrl+P", kM_FILE_PRINT, 0, gClient->GetPicture("ed_print.png"));
215 fMenu->Connect("Activated(Int_t)", "TGHtml", this, "HandleMenu(Int_t)");
216
219
220 fLastUri = 0;
221
224
225 fUidTable = new THashTable(100);
226}
227
228////////////////////////////////////////////////////////////////////////////////
229/// HTML widget destructor.
230
232{
233 int i;
234
235 fExiting = 1;
236 HClear();
237 for (i = 0; i < N_FONT; i++) {
238 if (fAFont[i] != 0) fClient->FreeFont(fAFont[i]);
239 }
240 if (fInsTimer) delete fInsTimer;
241 if (fIdle) delete fIdle;
242 delete fMenu;
243
244 // TODO: should also free colors!
245}
246
247////////////////////////////////////////////////////////////////////////////////
248/// Start background update.
249
251{
252 //GCValues_t gcv;
253 //unsigned int mask = GCTileStipXOrigin | GCTileStipYOrigin;
254//
255 //gcv.ts_x_origin = -fVvisible.fX;
256 //gcv.ts_y_origin = -fVisibleStart.fY;
257 //XChangeGC(GetDisplay(), _backGC, mask, &gcv);
258}
259
260////////////////////////////////////////////////////////////////////////////////
261/// Free system color.
262
264{
265 gVirtualX->FreeColor(gClient->GetDefaultColormap(), color->fPixel);
266 delete color;
267}
268
269////////////////////////////////////////////////////////////////////////////////
270/// Allocate system color by name.
271
273{
274 ColorStruct_t *color = new ColorStruct_t;
275
276 color->fPixel = 0;
277 if (gVirtualX->ParseColor(fClient->GetDefaultColormap(), name, *color)) {
278 if (!gVirtualX->AllocColor(fClient->GetDefaultColormap(), *color)) {
279 // force allocation of pixel 0
280 gVirtualX->QueryColor(fClient->GetDefaultColormap(), *color);
281 gVirtualX->AllocColor(fClient->GetDefaultColormap(), *color);
282 }
283 }
284
285 return color;
286}
287
288////////////////////////////////////////////////////////////////////////////////
289/// Allocate system color by value.
290
292{
294 *c = *color;
295
296 if (!gVirtualX->AllocColor(gClient->GetDefaultColormap(), *c)) {
297 // force allocation of pixel 0
298 c->fPixel = 0;
299 gVirtualX->QueryColor(gClient->GetDefaultColormap(), *c);
300 gVirtualX->AllocColor(gClient->GetDefaultColormap(), *c);
301 }
302
303 return c;
304}
305
306////////////////////////////////////////////////////////////////////////////////
307/// Erase all HTML from this widget and clear the screen. This is
308/// typically done before loading a new document.
309
311{
312 HClear();
316}
317
318////////////////////////////////////////////////////////////////////////////////
319/// Appends (or insert at the specified position) the given HTML text to the
320/// end of any HTML text that may have been inserted by prior calls to this
321/// command. Then it runs the tokenizer, parser and layout engine as far as
322/// possible with the text that is available. The display is updated
323/// appropriately.
324
325int TGHtml::ParseText(char *text, const char *index)
326{
327 SHtmlIndex_t iStart;
328 TGHtmlElement *savePtr=0;
329
330 iStart.fP = 0;
331 iStart.fI = 0;
332
334
335 if (index) {
336 int rc = GetIndex(index, &iStart.fP, &iStart.fI);
337 if (rc != 0) return kFALSE; // malformed index
338 if (iStart.fP) {
339 savePtr = iStart.fP->fPNext;
340 fPLast = iStart.fP;
341 iStart.fP->fPNext = 0;
342 }
343 }
344
346
347 if (fLoEndPtr) {
349 if (iStart.fP && savePtr) {
351 fPLast->fPNext = savePtr;
352 savePtr->fPPrev = fPLast;
356 } else if (fLoEndPtr->fPNext) {
358 }
359 } else if (fPFirst) {
362 fAnchorFlags = 0;
363 fInDt = 0;
364 fAnchorStart = 0;
365 fFormStart = 0;
366 fInnerList = 0;
367 fNInput = 0;
369 }
370#if 1
373#endif
374
377
378 return kTRUE;
379}
380
381////////////////////////////////////////////////////////////////////////////////
382/// Sets relief mode of html table.
383
385{
386 if (fTableRelief != relief) {
387 fTableRelief = relief;
388 fFlags |= RELAYOUT;
390 }
391}
392
393////////////////////////////////////////////////////////////////////////////////
394/// Sets relief mode of html rule.
395
396void TGHtml::SetRuleRelief(int relief)
397{
398 if (fRuleRelief != relief) {
399 fRuleRelief = relief;
400 fFlags |= RELAYOUT;
402 }
403}
404
405////////////////////////////////////////////////////////////////////////////////
406/// Set/reset html links underline.
407
409{
410 if (fUnderlineLinks != onoff) {
411 fUnderlineLinks = onoff;
412// fFlags |= RESIZE_ELEMENTS | RELAYOUT;
413// AddStyle(fPFirst);
414
415 TGHtmlElement *p;
417 for (p = fPFirst; p; p = p->fPNext) {
418 if (p->fType == Html_A) {
419 if (fAnchorStart) {
421 fAnchorStart = 0;
422 fAnchorFlags = 0;
423 }
424 const char *z = p->MarkupArg("href", 0);
425 if (z) {
426 style.fColor = GetLinkColor(z);
427 if (fUnderlineLinks) style.fFlags |= STY_Underline;
431 }
432 } else if (p->fType == Html_EndA) {
433 if (fAnchorStart) {
434 ((TGHtmlRef *)p)->fPOther = fAnchorStart;
436 fAnchorStart = 0;
437 fAnchorFlags = 0;
438 }
439 }
440 p->fStyle.fFlags &= ~STY_Underline;
441 p->fStyle.fFlags |= (style.fFlags & STY_Underline);
442 }
443
445 }
446}
447
448////////////////////////////////////////////////////////////////////////////////
449/// Sets base URI.
450
451void TGHtml::SetBaseUri(const char *uri)
452{
453 if (fZBase) delete[] fZBase;
454 fZBase = 0;
455 if (uri) fZBase = StrDup(uri);
456}
457
458////////////////////////////////////////////////////////////////////////////////
459/// Go to anchor position.
460
461int TGHtml::GotoAnchor(const char *name)
462{
463 const char *z;
464 TGHtmlElement *p;
465
466 for (p = fPFirst; p; p = p->fPNext) {
467 if (p->fType == Html_A) {
468 z = p->MarkupArg("name", 0);
469 if (z && strcmp(z, name) == 0) {
471 return kTRUE;
472 }
473 }
474 }
475
476 return kFALSE;
477}
478
479////////////////////////////////////////////////////////////////////////////////
480/// Given a string, this procedure returns a unique identifier for the
481/// string.
482///
483/// This procedure returns a pointer to a new char string corresponding to
484/// the "string" argument. The new string has a value identical to string
485/// (strcmp will return 0), but it's guaranteed that any other calls to this
486/// procedure with a string equal to "string" will return exactly the same
487/// result (i.e. can compare pointer *values* directly, without having to
488/// call strcmp on what they point to).
489
490const char *TGHtml::GetUid(const char *string)
491{
492 //int dummy;
493
494 TObjString *obj = 0;
495 obj = (TObjString*)fUidTable->FindObject(string);
496
497 if (!obj) {
498 obj = new TObjString(string);
499 fUidTable->Add(obj);
500 }
501
502 return (const char *)obj->GetName();
503}
504
505////////////////////////////////////////////////////////////////////////////////
506/// Computes virtual size of html area.
507
509{
511}
512
513////////////////////////////////////////////////////////////////////////////////
514/// Clear the cache of GCs
515
517{
518 int i;
519
520 for (i = 0; i < N_CACHE_GC; i++) {
521 if (fAGcCache[i].fIndex) {
522 gVirtualX->DeleteGC(fAGcCache[i].fGc);
523 fAGcCache[i].fIndex = 0;
524 }
525 }
526 fGcNextToFree = 0;
527}
528
529////////////////////////////////////////////////////////////////////////////////
530/// Reset the main layout context in the main widget. This happens
531/// before we redo the layout, or just before deleting the widget.
532
534{
536}
537
538////////////////////////////////////////////////////////////////////////////////
539/// This routine is invoked in order to redraw all or part of the HTML
540/// widget. This might happen because the display has changed, or in
541/// response to an expose event. In all cases, though, this routine
542/// is called by an idle handler.
543
545{
546 Pixmap_t pixmap; // The buffer on which to render HTML
547 int x, y, w, h; // Virtual canvas coordinates of area to draw
548 int hw; // highlight thickness
549 int clipwinH, clipwinW; // Width and height of the clipping window
550 TGHtmlBlock *pBlock; // For looping over blocks to be drawn
551 int redoSelection = 0; // kTRUE to recompute the selection
552
553 // Don't do anything if we are in the middle of a parse.
554
555 if (fInParse) {
556 fFlags &= ~REDRAW_PENDING;
557 return;
558 }
559
560 // Recompute the layout, if necessary or requested.
561 //
562 // Calling LayoutDoc() is tricky because LayoutDoc() may invoke one
563 // or more user-overriden methods, and these methods could, in theory,
564 // do nasty things. So we have to take precautions:
565 //
566 // * Do not remove the REDRAW_PENDING flag until after LayoutDoc()
567 // has been called, to prevent a recursive call to Redraw().
568
569 if ((fFlags & RESIZE_ELEMENTS) != 0 && (fFlags & STYLER_RUNNING) == 0) {
570 TGHtmlImage *pImage;
571 for (pImage = fImageList; pImage; pImage = pImage->fPNext) {
572 pImage->fPList = 0;
573 }
574 fLastSized = 0;
575 fFlags &= ~RESIZE_ELEMENTS;
576 fFlags |= RELAYOUT;
577 }
578
579 // We used to make a distinction between RELAYOUT and EXTEND_LAYOUT.
580 // RELAYOUT would be used when the widget was resized, but the
581 // less compute-intensive EXTEND_LAYOUT would be used when new
582 // text was appended.
583 //
584 // Unfortunately, EXTEND_LAYOUT has some problem that arise when
585 // tables are used. The quick fix is to make an EXTEND_LAYOUT do
586 // a complete RELAYOUT. Someday, we need to fix EXTEND_LAYOUT so
587 // that it works right...
588
589 if ((fFlags & (RELAYOUT | EXTEND_LAYOUT)) != 0
590 && (fFlags & STYLER_RUNNING) == 0) {
591 fNextPlaced = 0;
592 //fNInput = 0;
593 fVarId = 0;
594 fMaxX = 0;
595 fMaxY = 0;
597 fFirstBlock = 0;
598 fLastBlock = 0;
599 redoSelection = 1;
600 fFlags &= ~RELAYOUT;
602 }
603
604 if ((fFlags & EXTEND_LAYOUT) && fPFirst != 0) {
605 LayoutDoc();
606 fFlags &= ~EXTEND_LAYOUT;
607 FormBlocks();
608 MapControls();
609 if (redoSelection && fSelBegin.fP && fSelEnd.fP) {
611 UpdateInsert();
612 }
613 }
614 fFlags &= ~REDRAW_PENDING;
615
616 // No need to do any actual drawing if we aren't mapped
617
618//// if (!IsMapped()) return;
619
620 // Update the scrollbars.
621
622 if ((fFlags & (HSCROLL | VSCROLL)) != 0) {
624 fFlags &= ~(HSCROLL | VSCROLL);
625
626 if (fFlags & REDRAW_PENDING) return;
627 }
628
629 // Redraw the focus highlight, if requested
630 hw = fHighlightWidth;
631 if (fFlags & REDRAW_FOCUS) {
632 if (hw > 0) {
633#if 0
634 unsigned long color;
635
636 if (fFlags & GOT_FOCUS) {
637 color = highlightColorPtr;
638 } else {
639 color = highlightBgColorPtr;
640 }
641 _DrawFocusHighlight(color);
642#endif
643 }
644 fFlags &= ~REDRAW_FOCUS;
645 }
646
647 // If the styler is in a callback, abort further processing.
648 // TODO: check this!
649
650 if (fFlags & STYLER_RUNNING) {
651 goto earlyOut;
652 }
653
654 MapControls();
655
656 // Compute the virtual canvas coordinates corresponding to the
657 // dirty region of the clipping window.
658
659 clipwinW = fCanvas->GetWidth();
660 clipwinH = fCanvas->GetHeight();
661 if (fFlags & REDRAW_TEXT) {
662 w = clipwinW;
663 h = clipwinH;
664 x = fVisible.fX;
665 y = fVisible.fY;
666 fDirtyLeft = 0;
667 fDirtyTop = 0;
668 fFlags &= ~REDRAW_TEXT;
669 } else {
670 if (fDirtyLeft < 0) fDirtyLeft = 0;
671 if (fDirtyRight > clipwinW) fDirtyRight = clipwinW;
672 if (fDirtyTop < 0) fDirtyTop = 0;
673 if (fDirtyBottom > clipwinH) fDirtyBottom = clipwinH;
678 }
679
680 // Skip the rest of the drawing process if the area to be refreshed is
681 // less than zero
682 if (w > 0 && h > 0) {
683 GContext_t gcBg;
684 TGRectangle xrec;
685 // printf("Redraw %dx%d at %d,%d\n", w, h, x, y);
686
687 // Allocate and clear a pixmap upon which to draw
689 pixmap = gVirtualX->CreatePixmap(fCanvas->GetId(), w, h);
690 xrec.fX = 0;
691 xrec.fY = 0;
692 xrec.fW = w;
693 xrec.fH = h;
694#if 0
695
696//old-- XFillRectangles(GetDisplay(), pixmap, gcBg, &xrec, 1);
697//new-- if (fBgImage)
698// BGDraw(fVisible.fX, fVisible.fY, w, h, fBgImage);
699#else
700
703
704 gVirtualX->FillRectangle(pixmap, fWhiteGC.GetGC(), 0, 0, w, h);
705 UpdateBackgroundStart(); // back to original
706#endif
707
708 // Render all visible HTML onto the pixmap
709 for (pBlock = fFirstBlock; pBlock; pBlock = pBlock->fBNext) {
710 if (pBlock->fTop <= y+h && pBlock->fBottom >= y-10 &&
711 pBlock->fLeft <= x+w && pBlock->fRight >= x-10) {
712 BlockDraw(pBlock, pixmap, x, y, w, h, pixmap);
713 }
714 }
715
716 // Finally, copy the pixmap onto the window and delete the pixmap
717 gVirtualX->CopyArea(pixmap, fCanvas->GetId(),
718 gcBg, 0, 0, w, h, fDirtyLeft, fDirtyTop);
719 gVirtualX->Update(kFALSE);
720
721 gVirtualX->DeletePixmap(pixmap);
722// XFlush(GetDisplay());
723 }
724
725 // Redraw images, if requested
726 if (fFlags & REDRAW_IMAGES) {
727 TGHtmlImage *pImage;
728 TGHtmlImageMarkup *pElem;
729 int top, bottom, left, right; // Coordinates of the clipping window
730 int imageTop; // Top edge of image
731
732 top = fVisible.fY;
733 bottom = top + fCanvas->GetHeight();
734 left = fVisible.fX;
735 right = left + fCanvas->GetWidth();
736 for (pImage = fImageList; pImage; pImage = pImage->fPNext) {
737 for (pElem = pImage->fPList; pElem; pElem = pElem->fINext) {
738 if (pElem->fRedrawNeeded == 0) continue;
739 imageTop = pElem->fY - pElem->fAscent;
740 if (imageTop > bottom || imageTop + pElem->fH < top
741 || pElem->fX > right || pElem->fX + pElem->fW < left) continue;
742
743 DrawImage(pElem, fCanvas->GetId(), left, top, right, bottom);
744 }
745 }
747 }
748
749 // Set the dirty region to the empty set.
750earlyOut:
753 fDirtyBottom = 0;
754 fDirtyRight = 0;
755
756 return;
757}
758
759////////////////////////////////////////////////////////////////////////////////
760/// Make sure that a call to the Redraw() routine has been queued.
761
763{
764 if ((fFlags & REDRAW_PENDING) == 0 /*&& IsMapped()*/) {
765 if (!fIdle) fIdle = new TGIdleHandler(this);
767 }
768}
769
770////////////////////////////////////////////////////////////////////////////////
771/// Handles idle event.
772
774{
775 if (idle != fIdle) return kFALSE;
776 Redraw();
777 delete fIdle;
778 fIdle = NULL;
779 return kTRUE;
780}
781
782////////////////////////////////////////////////////////////////////////////////
783/// If any part of the screen needs to be redrawn, then call this routine
784/// with the values of a box (in window coordinates) that needs to be
785/// redrawn. This routine will schedule an idle handler to do the redraw.
786///
787/// The box coordinates are relative to the clipping window (fCanvas).
788
789void TGHtml::RedrawArea(int left, int top, int right, int bottom)
790{
791 if (bottom < 0) return;
792 if (top > (int)fCanvas->GetHeight()) return;
793 if (right < 0) return;
794 if (left > (int)fCanvas->GetWidth()) return;
795 if (fDirtyTop > top) fDirtyTop = top;
796 if (fDirtyLeft > left) fDirtyLeft = left;
797 if (fDirtyBottom < bottom) fDirtyBottom = bottom;
798 if (fDirtyRight < right) fDirtyRight = right;
800}
801
802////////////////////////////////////////////////////////////////////////////////
803/// Draw region defined by [x,y] [w,h].
804
806{
807 TGView::DrawRegion(x, y, w, h);
808
809#if 0
810 RedrawArea(x, y, x + w + 1, y + h + 1);
811#else
812 int left = x;
813 int top = y;
814 int right = x + w + 1;
815 int bottom = y + h + 1;
816 if (bottom < 0) return;
817 if (top > (int) fCanvas->GetHeight()) return;
818 if (right < 0) return;
819 if (left > (int)fCanvas->GetWidth()) return;
820 if (fDirtyTop > top) fDirtyTop = top;
821 if (fDirtyLeft > left) fDirtyLeft = left;
822 if (fDirtyBottom < bottom) fDirtyBottom = bottom;
823 if (fDirtyRight < right) fDirtyRight = right;
824
826 Redraw();
827#endif
828 return;
829}
830
831////////////////////////////////////////////////////////////////////////////////
832/// Layout html widget.
833
835{
836#if 0
838 Redraw(); //RedrawEverything();
839#else
840 fNextPlaced = 0;
841 //fNInput = 0;
842 fVarId = 0;
843 fMaxX = 0;
844 fMaxY = 0;
846 fFirstBlock = 0;
847 fLastBlock = 0;
848 if (fPFirst != 0) {
849 LayoutDoc();
850 FormBlocks();
851 MapControls();
852 if (fSelBegin.fP && fSelEnd.fP) {
854 UpdateInsert();
855 }
856 }
859#endif
860 return kTRUE;
861}
862
863////////////////////////////////////////////////////////////////////////////////
864/// Redraw the TGHtmlBlock given.
865
867{
868 if (p) {
870 p->fRight - fVisible.fX + 1, p->fBottom - fVisible.fY);
871 }
872}
873
874////////////////////////////////////////////////////////////////////////////////
875/// Call this routine to force the entire widget to be redrawn.
876
878{
881}
882
883////////////////////////////////////////////////////////////////////////////////
884/// Call this routine to cause all of the rendered HTML at the
885/// virtual canvas coordinate of Y and beyond to be redrawn.
886
888{
889 int clipHeight; // Height of the clipping window
890
891 clipHeight = fCanvas->GetHeight();
892 y -= fVisible.fY;
893 if (y < clipHeight) {
894 RedrawArea(0, y, LARGE_NUMBER, clipHeight);
895 }
896}
897
898////////////////////////////////////////////////////////////////////////////////
899/// Erase all data from the HTML widget. Bring it back to an empty screen.
900
902{
903 int i;
904 TGHtmlElement *p, *fPNext;
905
906 fXMargin = fYMargin = 0; //HTML_INDENT/4;
907
909 for (p = fPFirst; p; p = fPNext) {
910 fPNext = p->fPNext;
911 delete p;
912 }
913 fPFirst = 0;
914 fPLast = 0;
915 fNToken = 0;
916 if (fZText) delete[] fZText;
917 fZText = 0;
918 fNText = 0;
919 fNAlloc = 0;
920 fNComplete = 0;
921 fIPlaintext = 0;
922
923 for (i = 0; i < N_COLOR; ++i) {
924 if (fApColor[i] != 0) FreeColor(fApColor[i]);
925 fApColor[i] = 0;
926 fIDark[i] = 0;
927 fILight[i] = 0;
928 }
929
930 if (!fExiting) {
931 fFgColor = AllocColor("black");
932 fBgColor = AllocColor("white"); //AllocColor("#c0c0c0");
936
942
944 SetBackgroundPixmap(0); // use solid color
945 }
946
947 fColorUsed = 0;
948 while (fImageList) {
950 fImageList = p2->fPNext;
951 delete p2;
952 }
953
954 if (fBgImage) delete fBgImage;
955 fBgImage = 0;
956
957 while (fStyleStack) {
959 fStyleStack = p2->fPNext;
960 delete p2;
961 }
962 ClearGcCache();
964// if (fZBase) delete[] fZBase;
965// fZBase = 0;
966
967 if (fZBaseHref) delete [] fZBaseHref;
968 fZBaseHref = 0;
969 fLastSized = 0;
970 fNextPlaced = 0;
971 fFirstBlock = 0;
972 fLastBlock = 0;
973 fNInput = 0;
974 fNForm = 0;
975 fVarId = 0;
978 fAnchorFlags = 0;
979 fInDt = 0;
980 fAnchorStart = 0;
981 fFormStart = 0;
982 fInnerList = 0;
983 fMaxX = 0;
984 fMaxY = 0;
985#if 0 // in OXView::Clear()
986 fVisible = TGPosition(0, 0);
987 _virtualSize = TGDimension(0, 0);
988 ScrollTTGPosition(fVisible);
989#endif
990 fPInsBlock = 0;
991 fIns.fP = 0;
992 fSelBegin.fP = 0;
993 fSelEnd.fP = 0;
994 fPSelStartBlock = 0;
995 fPSelEndBlock = 0;
996 fHasScript = 0;
997 fHasFrames = 0;
998 fLastUri = 0;
999}
1000
1001////////////////////////////////////////////////////////////////////////////////
1002/// Handle timer event.
1003
1005{
1006 if (t == fInsTimer) {
1007 if (fInsTimer) delete fInsTimer;
1008 fInsTimer = NULL;
1009 FlashCursor();
1010 return kTRUE;
1011 } else {
1012 TGHtmlImage *pImage;
1013 for (pImage = fImageList; pImage; pImage = pImage->fPNext) {
1014 if (pImage->fTimer == t) {
1015 AnimateImage(pImage);
1016 return kTRUE;
1017 }
1018 }
1019 }
1020 return kFALSE;
1021}
1022
1023////////////////////////////////////////////////////////////////////////////////
1024/// Flash the insertion cursor.
1025
1027{
1028 if (fPInsBlock == 0 || fInsOnTime <= 0 || fInsOffTime <= 0) return;
1030 if ((fFlags & GOT_FOCUS) == 0) {
1031 fInsStatus = 0;
1032 } else if (fInsStatus) {
1033 fInsTimer = new TTimer(this, fInsOffTime);
1034 fInsStatus = 0;
1035 } else {
1036 fInsTimer = new TTimer(this, fInsOnTime);
1037 fInsStatus = 1;
1038 }
1039}
1040
1041////////////////////////////////////////////////////////////////////////////////
1042/// Return a GC from the cache. As many as N_CACHE_GCs are kept valid
1043/// at any one time. They are replaced using an LRU algorithm.
1044///
1045/// A value of FONT_Any (-1) for the font means "don't care".
1046
1047GContext_t TGHtml::GetGC(int color, int font)
1048{
1049 int i, j;
1050 GcCache_t *p = fAGcCache;
1051 GCValues_t gcValues;
1052 TGFont *xfont;
1053
1054 // Check for an existing GC.
1055
1056 if (color < 0 || color >= N_COLOR) color = 0;
1057 if (font < FONT_Any || font >= N_FONT) font = FONT_Default;
1058
1059 for (i = 0; i < N_CACHE_GC; i++, p++) {
1060 if (p->fIndex == 0) continue;
1061 if ((font < 0 || p->fFont == font) && p->fColor == color) {
1062 if (p->fIndex > 1) {
1063 for (j = 0; j < N_CACHE_GC; j++) {
1064 if (fAGcCache[j].fIndex && fAGcCache[j].fIndex < p->fIndex ) {
1065 fAGcCache[j].fIndex++;
1066 }
1067 }
1068 p->fIndex = 1;
1069 }
1070 return fAGcCache[i].fGc;
1071 }
1072 }
1073
1074 // No GC matches. Find a place to allocate a new GC.
1075
1076 p = fAGcCache;
1077 for (i = 0; i < N_CACHE_GC; i++, p++) {
1078 if (p->fIndex == 0 || p->fIndex == N_CACHE_GC) break;
1079 }
1080 if (i >= N_CACHE_GC) { // No slot, so free one (round-robin)
1081 p = fAGcCache;
1082 for (i = 0; i < N_CACHE_GC && i < fGcNextToFree; ++i, ++p) {}
1084 gVirtualX->DeleteGC(p->fGc);
1085 }
1086 gcValues.fForeground = fApColor[color]->fPixel;
1087 gcValues.fGraphicsExposures = kTRUE;
1089
1090 if (font < 0) font = FONT_Default;
1091 xfont = GetFont(font);
1092
1093 if (xfont) {
1094 gcValues.fFont = xfont->GetFontHandle();
1095 gcValues.fMask |= kGCFont;
1096 }
1097
1098 p->fGc = gVirtualX->CreateGC(fId, &gcValues);
1099
1100 if (p->fIndex == 0) p->fIndex = N_CACHE_GC + 1;
1101 for (j = 0; j < N_CACHE_GC; j++) {
1102 if (fAGcCache[j].fIndex && fAGcCache[j].fIndex < p->fIndex) {
1103 fAGcCache[j].fIndex++;
1104 }
1105 }
1106 p->fIndex = 1;
1107 p->fFont = font;
1108 p->fColor = color;
1109
1110 return p->fGc;
1111}
1112
1113////////////////////////////////////////////////////////////////////////////////
1114/// Retrieve any valid GC. The font and color don't matter since the
1115/// GC will only be used for copying.
1116
1118{
1119 int i;
1120 GcCache_t *p = fAGcCache;
1121
1122 for (i = 0; i < N_CACHE_GC; i++, p++) {
1123 if (p->fIndex) return p->fGc;
1124 }
1125
1127}
1128
1129////////////////////////////////////////////////////////////////////////////////
1130/// Handle focus change event.
1131
1133{
1134 if (event->fType == kFocusIn) {
1137 UpdateInsert();
1138 } else { // FocusOut
1139 fFlags &= ~GOT_FOCUS;
1142 }
1143 return kTRUE;
1144}
1145
1146////////////////////////////////////////////////////////////////////////////////
1147/// This routine searches for a hyperlink beneath the coordinates x,y
1148/// and returns a pointer to the HREF for that hyperlink. The text
1149/// is held in one of the markup argv[] fields of the <a> markup.
1150
1152{
1153 TGHtmlInput *p; // For looping over all controls
1154 int vx, vy, vw, vh; // Part of the virtual canvas that is visible
1155
1156 vx = fVisible.fX;
1157 vy = fVisible.fY;
1158 vw = fCanvas->GetWidth();
1159 vh = fCanvas->GetHeight();
1160 for (p = fFirstInput; p; p = p->fINext) {
1161 if (p->fFrame == 0) continue;
1162 if (p->fY < vy + vh && p->fY + p->fH > vy &&
1163 p->fX < vx + vw && p->fX + p->fW > vx) {
1164 if ((x > p->fX) && (y > p->fY) && (x < (p->fX + p->fW)) &&
1165 (y < (p->fY + p->fH)) ) {
1166 return p;
1167 }
1168 }
1169 }
1170 return 0;
1171}
1172
1173////////////////////////////////////////////////////////////////////////////////
1174/// Handle html input (button, checkbox, ...) event.
1175
1177{
1178 Window_t childdum;
1179 Event_t eventSt;
1180 eventSt.fType = event->fType;
1181 eventSt.fWindow = event->fWindow;
1182 eventSt.fTime = event->fTime;
1183 eventSt.fX = 2;
1184 eventSt.fY = 2;
1185 eventSt.fXRoot = event->fXRoot;
1186 eventSt.fYRoot = event->fYRoot;
1187 eventSt.fCode = event->fCode;
1188 eventSt.fState = event->fState;
1189 eventSt.fWidth = event->fWidth;
1190 eventSt.fHeight = event->fHeight;
1191 eventSt.fCount = event->fCount;
1192 eventSt.fSendEvent = event->fSendEvent;
1193 eventSt.fHandle = event->fHandle;
1194 eventSt.fFormat = event->fFormat;
1195 eventSt.fUser[0] = event->fUser[0];
1196 eventSt.fUser[1] = event->fUser[1];
1197 eventSt.fUser[2] = event->fUser[2];
1198 eventSt.fUser[3] = event->fUser[3];
1199 eventSt.fUser[4] = event->fUser[4];
1200 gVirtualX->TranslateCoordinates(GetId(), pr->fFrame->GetId(),
1201 event->fX, event->fY, eventSt.fX,
1202 eventSt.fY, childdum);
1203
1204 const char *name = pr->MarkupArg("name", 0);
1205 const char *val = pr->MarkupArg("value", 0);
1206 switch (pr->fItype) {
1207 case INPUT_TYPE_Submit:
1208 case INPUT_TYPE_Button: {
1209 TGButton *b = (TGButton *) pr->fFrame;
1210 Bool_t was = !b->IsDown();
1211 b->HandleButton(&eventSt);
1212 Bool_t now = !b->IsDown();
1213 if (!was && now) {
1214 if (pr->fItype == INPUT_TYPE_Submit)
1215 SubmitClicked(val); // emit SubmitClicked
1216 else
1217 ButtonClicked(name, val); // emit ButtonClicked
1218 }
1219 break;
1220 }
1221 case INPUT_TYPE_Radio: {
1222 TGRadioButton *rb = (TGRadioButton *) pr->fFrame;
1223 Bool_t was = !rb->IsDown();
1224 rb->HandleButton(&eventSt);
1225 Bool_t now = !rb->IsDown();
1226 if ((!was && now) || (was && !now)) {
1228 RadioChanged(name, val); // emit RadioChanged
1229 }
1230 break;
1231 }
1232 case INPUT_TYPE_Checkbox: {
1233 TGCheckButton *cb = (TGCheckButton *) pr->fFrame;
1234 Bool_t was = !cb->IsDown();
1235 cb->HandleButton(&eventSt);
1236 Bool_t now = !cb->IsDown();
1237 if ((!was && now) || (was && !now))
1238 CheckToggled(name, !now, val); // emit CheckToggled
1239 break;
1240 }
1241 case INPUT_TYPE_Text:
1242 case INPUT_TYPE_Password: {
1243 TGTextEntry *te = (TGTextEntry *) pr->fFrame;
1244 te->SetFocus();
1245 break;
1246 }
1247 case INPUT_TYPE_Select: {
1249 eventSt.fUser[0] = childdum;
1250 if (pr->fFrame->InheritsFrom("TGComboBox"))
1251 ((TGComboBox *)pr->fFrame)->HandleButton(&eventSt);
1252 else if (pr->fFrame->InheritsFrom("TGListBox"))
1253 ((TGListBox *)pr->fFrame)->HandleButton(&eventSt);
1254 InputSelected(name, val); // emit InputSelected
1256 break;
1257 }
1258 default:
1259 break;
1260 }
1261 return kTRUE;
1262}
1263
1264////////////////////////////////////////////////////////////////////////////////
1265/// Handle radio button event.
1266
1268{
1269 TGHtmlInput *pr;
1270 for (pr = fFirstInput; pr; pr = pr->fINext) {
1271 if ((pr->fPForm == p->fPForm) && (pr->fItype == INPUT_TYPE_Radio)) {
1272 if (pr != p) {
1273 if (strcmp(pr->MarkupArg("name", ""), p->MarkupArg("name", "")) == 0) {
1274 ((TGRadioButton *)pr->fFrame)->SetState(kButtonUp);
1275 }
1276 }
1277 }
1278 }
1279
1280 return kTRUE;
1281}
1282
1283////////////////////////////////////////////////////////////////////////////////
1284/// Emit ButtonClicked() signal.
1285
1286void TGHtml::ButtonClicked(const char *name, const char *val)
1287{
1288 Longptr_t args[2];
1289
1290 args[0] = (Longptr_t)name;
1291 args[1] = (Longptr_t)val;
1292
1293 Emit("ButtonClicked(char*,char*)", args);
1294}
1295
1296////////////////////////////////////////////////////////////////////////////////
1297/// Emit CheckToggled() signal.
1298
1299void TGHtml::CheckToggled(const char *name, Bool_t on, const char *val)
1300{
1301 Longptr_t args[3];
1302
1303 args[0] = (Longptr_t)name;
1304 args[1] = on;
1305 args[2] = (Longptr_t)val;
1306
1307 Emit("CheckToggled(char*,Bool_t,char*)", args);
1308}
1309
1310////////////////////////////////////////////////////////////////////////////////
1311/// Emit RadioChanged() signal.
1312
1313void TGHtml::RadioChanged(const char *name, const char *val)
1314{
1315 Longptr_t args[2];
1316
1317 args[0] = (Longptr_t)name;
1318 args[1] = (Longptr_t)val;
1319
1320 Emit("RadioChanged(char*,char*)", args);
1321}
1322
1323////////////////////////////////////////////////////////////////////////////////
1324/// Emit Selected() signal.
1325
1326void TGHtml::InputSelected(const char *name, const char *val)
1327{
1328 Longptr_t args[2];
1329
1330 args[0] = (Longptr_t)name;
1331 args[1] = (Longptr_t)val;
1332
1333 Emit("InputSelected(char*,char*)", args);
1334}
1335
1336////////////////////////////////////////////////////////////////////////////////
1337/// Emit SubmitClicked() signal.
1338
1339void TGHtml::SubmitClicked(const char *val)
1340{
1341 Emit("SubmitClicked(char*)", val);
1342}
1343
1344////////////////////////////////////////////////////////////////////////////////
1345/// Save file. Ask user for a file name via the file dialog. The pre-filled
1346/// file name will be extracted from the current URI, if any
1347
1349{
1350 TGFileInfo fi;
1351 static const char *inputFileTypes[] = {
1352 "HTML files", "*.html",
1353 0, 0
1354 };
1355 fi.fFileTypes = inputFileTypes;
1356 TString actual = GetBaseUri();
1357 Ssiz_t idy = actual.Last('/') + 1;
1358 TString shortname(actual.Data());
1359 if (idy < actual.Sizeof()) {
1360 shortname = actual(idy, actual.Sizeof());
1361 fi.fFilename = StrDup(shortname.Data());
1362 }
1363 new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
1364 if (fi.fFilename) {
1365 TGText txt(GetText());
1366 txt.Save(fi.fFilename);
1367 }
1368}
1369
1370////////////////////////////////////////////////////////////////////////////////
1371/// Handle context menu entries events.
1372
1374{
1375 switch(id) {
1376 case kM_FILE_SAVEAS:
1377 SaveFileAs();
1378 break;
1379 case kM_FILE_PRINT:
1380 break;
1381 default:
1382 break;
1383 }
1384}
1385
1386////////////////////////////////////////////////////////////////////////////////
1387/// Handle mouse button event.
1388
1390{
1391 int amount, ch;
1392
1393 ch = fCanvas->GetHeight();
1394 amount = fScrollVal.fY * TMath::Max(ch/6, 1);
1395
1396 int ix = event->fX + fVisible.fX;
1397 int iy = event->fY + fVisible.fY;
1398 TGHtmlInput *pr = GetInputElement(ix, iy);
1399 if (pr) {
1401 }
1402 if ((event->fType == kButtonPress) && (event->fCode == kButton1)) {
1403 int x = event->fX + fVisible.fX;
1404 int y = event->fY + fVisible.fY;
1405 const char *uri = GetHref(x, y);
1406 void *dummy;
1407
1408#if 0 // insertion cursor test
1409 char ix[20];
1410 sprintf(ix, "begin");
1411 SetInsert(ix);
1412#endif
1413
1414 if (uri) {
1415 uri = ResolveUri(uri);
1416 if (uri) {
1417 MouseDown(uri);
1418 //!!delete[] uri;
1419 }
1420 }
1421 fMenu->EndMenu(dummy);
1422 gVirtualX->GrabPointer(0, 0, 0, 0, kFALSE);
1423 } else if ((event->fType == kButtonPress) && (event->fCode == kButton3)) {
1424 fMenu->PlaceMenu(event->fXRoot, event->fYRoot, kTRUE, kTRUE);
1425 } else if (event->fCode == kButton4) {
1427 } else if (event->fCode == kButton5) {
1429 } else {
1431 }
1432 return kTRUE;
1433}
1434
1435////////////////////////////////////////////////////////////////////////////////
1436/// handle mouse motion events
1437
1439{
1440 int x = event->fX + fVisible.fX;
1441 int y = event->fY + fVisible.fY;
1442 const char *uri = GetHref(x, y);
1443
1444 if (uri) {
1445 gVirtualX->SetCursor(fId, gVirtualX->CreateCursor(kHand));
1446 } else {
1447 gVirtualX->SetCursor(fId, gVirtualX->CreateCursor(kPointer));
1448 }
1449
1450 if (uri != fLastUri) {
1451 fLastUri = uri;
1452 if (uri) uri = ResolveUri(uri);
1453 MouseOver(uri);
1454 //!!if (uri) delete [] uri;
1455 }
1456
1457 return kTRUE;
1458}
1459
1460////////////////////////////////////////////////////////////////////////////////
1461/// The rendering and layout routines should call this routine in order to
1462/// get a font structure. The iFont parameter specifies which of the N_FONT
1463/// fonts should be obtained. The font is allocated if necessary.
1464
1466{
1467 TGFont *toFree = 0;
1468
1469 if (iFont < 0) iFont = 0;
1470 if (iFont >= N_FONT) { iFont = N_FONT - 1; CANT_HAPPEN; }
1471
1472 // If the font has previously been allocated, but the "fontValid" bitmap
1473 // shows it is no longer valid, then mark it for freeing later. We use
1474 // a policy of allocate-before-free because xclass' font cache operates
1475 // much more efficiently that way.
1476
1477 if (!FontIsValid(iFont) && fAFont[iFont] != 0) {
1478 toFree = fAFont[iFont];
1479 fAFont[iFont] = 0;
1480 }
1481
1482 // If we need to allocate a font, first construct the font name then
1483 // allocate it.
1484
1485 if (fAFont[iFont] == 0) {
1486 char name[200]; // Name of the font
1487 const char *familyStr = "";
1488 int iFamily;
1489 int iSize;
1490 int size;
1491
1492 iFamily = FontFamily(iFont) >> 3;
1493 iSize = FontSize(iFont) + 1;
1494
1495 switch (iFamily) {
1496//#define TIMES
1497#ifdef TIMES
1498 case 0: familyStr = "times -%d"; break;
1499 case 1: familyStr = "times -%d bold"; break;
1500 case 2: familyStr = "times -%d italic"; break;
1501 case 3: familyStr = "times -%d bold italic"; break;
1502 case 4: familyStr = "courier -%d"; break;
1503 case 5: familyStr = "courier -%d bold"; break;
1504 case 6: familyStr = "courier -%d italic"; break;
1505 case 7: familyStr = "courier -%d bold italic"; break;
1506 default: familyStr = "times -16"; CANT_HAPPEN;
1507#else
1508 case 0: familyStr = "helvetica -%d"; break;
1509 case 1: familyStr = "helvetica -%d bold"; break;
1510 case 2: familyStr = "helvetica -%d italic"; break;
1511 case 3: familyStr = "helvetica -%d bold italic"; break;
1512 case 4: familyStr = "courier -%d"; break;
1513 case 5: familyStr = "courier -%d bold"; break;
1514 case 6: familyStr = "courier -%d italic"; break;
1515 case 7: familyStr = "courier -%d bold italic"; break;
1516 default: familyStr = "helvetica -14"; CANT_HAPPEN;
1517#endif
1518 }
1519#if 0
1520 switch (iSize) {
1521 case 1: size = 6+finc/*8*/; break;
1522 case 2: size = 10+finc/*10*/; break;
1523 case 3: size = 12+finc/*12*/; break;
1524 case 4: size = 14+finc/*14*/; break;
1525 case 5: size = 20+finc/*16*/; break;
1526 case 6: size = 24+finc/*18*/; break;
1527 case 7: size = 30+finc/*24*/; break;
1528 default: size = 14+finc/*14*/; CANT_HAPPEN;
1529 }
1530#else
1531 switch (iSize) {
1532 case 1: size = 8; break;
1533 case 2: size = 10; break;
1534 case 3: size = 12; break;
1535 case 4: size = 14; break;
1536 case 5: size = 16; break;
1537 case 6: size = 18; break;
1538 case 7: size = 24; break;
1539 default: size = 14; CANT_HAPPEN;
1540 }
1541#endif
1542#ifdef TIMES
1543 if (iFamily < 4) size += 2;
1544#endif
1545
1546 snprintf(name, 199, familyStr, size);
1547
1548 // Get the named font
1549 fAFont[iFont] = fClient->GetFont(name);
1550
1551 if (fAFont[iFont] == 0) {
1552 fprintf(stderr, "TGHtml: could not get font \"%s\", trying fixed\n",
1553 name);
1554 fAFont[iFont] = fClient->GetFont("fixed");
1555 }
1556 if (fAFont[iFont] == 0 ){
1557 fprintf(stderr, "TGHtml: could not get font \"fixed\", trying "
1558 "\"helvetica -12\"\n");
1559 fAFont[iFont] = fClient->GetFont("helvetica -12");
1560 }
1561 FontSetValid(iFont);
1562 }
1563
1564 // Free the expired font, if any.
1565
1566 if (toFree) fClient->FreeFont(toFree);
1567
1568 return fAFont[iFont];
1569}
1570
1571////////////////////////////////////////////////////////////////////////////////
1572/// Only support rect and circles for now
1573
1574int TGHtml::InArea(TGHtmlMapArea *p, int left, int top, int x, int y)
1575{
1576 int *ip = p->fCoords;
1577 if (!ip) return 0;
1578
1579 if (p->fMType == HTML_MAP_RECT) {
1580 return ((left + ip[0]) <= x && (left + ip[2]) >= x &&
1581 (top + ip[1]) <= y && (top + ip[3]) >= y);
1582 } else if (p->fMType == HTML_MAP_CIRCLE) {
1583 int dx = left + ip[0] - x;
1584 int dy = top + ip[1] - y;
1585 return (dx * dx + dy * dy <= ip[2] * ip[2]);
1586 }
1587 return 0;
1588}
1589
1590////////////////////////////////////////////////////////////////////////////////
1591/// Returns html map element.
1592
1594{
1596 const char *z, *zb;
1597
1598 while (p) {
1599 if (p->fType == Html_MAP) {
1600 z = p->MarkupArg("name", 0);
1601 zb = p->MarkupArg("shape", 0);
1602 if (zb && *zb != 'r') return 0;
1603 if (z && !strcmp(z, name)) return p;
1604 }
1605 p = p->fPNext;
1606 }
1607 return 0;
1608}
1609
1610////////////////////////////////////////////////////////////////////////////////
1611/// Compute the squared distance between two colors
1612
1614{
1615 float x, y, z;
1616
1617 x = 0.30 * (pA->fRed - pB->fRed);
1618 y = 0.61 * (pA->fGreen - pB->fGreen);
1619 z = 0.11 * (pA->fBlue - pB->fBlue);
1620
1621 return x*x + y*y + z*z;
1622}
1623
1624////////////////////////////////////////////////////////////////////////////////
1625/// This routine returns an index between 0 and N_COLOR-1 which indicates
1626/// which ColorStruct_t structure in the fApColor[] array should be used to describe
1627/// the color specified by the given name.
1628
1629int TGHtml::GetColorByName(const char *zColor)
1630{
1631 ColorStruct_t *pNew;
1632 int iColor;
1633 const char *name; // unique!
1634 int i, n;
1635 char zAltColor[16];
1636
1637 // Netscape accepts color names that are just HEX values, without
1638 // the # up front. This isn't valid HTML, but we support it for
1639 // compatibility.
1640
1641 n = strlen(zColor);
1642 if (n == 6 || n == 3 || n == 9 || n == 12) {
1643 for (i = 0; i < n; i++) {
1644 if (!isxdigit(zColor[i])) break;
1645 }
1646 if (i == n) {
1647 snprintf(zAltColor, 15, "#%s", zColor);
1648 } else {
1649 strlcpy(zAltColor, zColor, sizeof(zAltColor));
1650 }
1651 name = GetUid(zAltColor);
1652 } else {
1653 name = GetUid(zColor);
1654 }
1655
1656 pNew = AllocColor(name);
1657 if (pNew == 0) {
1658 return 0; // Color 0 is always the default
1659 }
1660
1661 iColor = GetColorByValue(pNew);
1662 FreeColor(pNew);
1663
1664 return iColor;
1665}
1666
1667
1668// Macros used in the computation of appropriate shadow colors.
1669
1670#define MAX_COLOR 65535
1671#define MAX(A,B) ((A)<(B)?(B):(A))
1672#define MIN(A,B) ((A)<(B)?(A):(B))
1673
1674////////////////////////////////////////////////////////////////////////////////
1675/// Check to see if the given color is too dark to be easily distinguished
1676/// from black.
1677
1679{
1680 float x, y, z;
1681
1682 x = 0.50 * p->fRed;
1683 y = 1.00 * p->fGreen;
1684 z = 0.28 * p->fBlue;
1685 return (x*x + y*y + z*z) < (0.05 * MAX_COLOR * MAX_COLOR);
1686}
1687
1688////////////////////////////////////////////////////////////////////////////////
1689/// Given that the background color is iBgColor, figure out an
1690/// appropriate color for the dark part of a 3D shadow.
1691
1693{
1694 if (fIDark[iBgColor] == 0) {
1695 ColorStruct_t *pRef, val;
1696 val.fMask = kDoRed | kDoGreen | kDoBlue;
1697 val.fPixel = 0;
1698 pRef = fApColor[iBgColor];
1699 if (IsDarkColor(pRef)) {
1700 int t1, t2;
1701 t1 = (int) MIN(MAX_COLOR, pRef->fRed * 1.2);
1702 t2 = (pRef->fRed * 3 + MAX_COLOR) / 4;
1703 val.fRed = MAX(t1, t2);
1704 t1 = (int) MIN(MAX_COLOR, pRef->fGreen * 1.2);
1705 t2 = (pRef->fGreen * 3 + MAX_COLOR) / 4;
1706 val.fGreen = MAX(t1, t2);
1707 t1 = (int) MIN(MAX_COLOR, pRef->fBlue * 1.2);
1708 t2 = (pRef->fBlue * 3 + MAX_COLOR) / 4;
1709 val.fBlue = MAX(t1, t2);
1710 } else {
1711 val.fRed = (unsigned short) (pRef->fRed * 0.6);
1712 val.fGreen = (unsigned short) (pRef->fGreen * 0.6);
1713 val.fBlue = (unsigned short) (pRef->fBlue * 0.6);
1714 }
1715 fIDark[iBgColor] = GetColorByValue(&val) + 1;
1716 }
1717
1718 return fIDark[iBgColor] - 1;
1719}
1720
1721////////////////////////////////////////////////////////////////////////////////
1722/// Check to see if the given color is too light to be easily distinguished
1723/// from white.
1724
1726{
1727 return p->fGreen >= 0.85 * MAX_COLOR;
1728}
1729
1730////////////////////////////////////////////////////////////////////////////////
1731/// Given that the background color is iBgColor, figure out an
1732/// appropriate color for the bright part of the 3D shadow.
1733
1735{
1736 if (fILight[iBgColor] == 0) {
1737 ColorStruct_t *pRef, val;
1738 val.fMask = kDoRed | kDoGreen | kDoBlue;
1739 val.fPixel = 0;
1740 pRef = fApColor[iBgColor];
1741 if (IsLightColor(pRef)) {
1742 val.fRed = (unsigned short) (pRef->fRed * 0.9);
1743 val.fGreen = (unsigned short) (pRef->fGreen * 0.9);
1744 val.fBlue = (unsigned short) (pRef->fBlue * 0.9);
1745 } else {
1746 int t1, t2;
1747 t1 = (int) MIN(MAX_COLOR, pRef->fGreen * 1.4);
1748 t2 = (pRef->fGreen + MAX_COLOR) / 2;
1749 val.fGreen = MAX(t1, t2);
1750 t1 = (int) MIN(MAX_COLOR, pRef->fRed * 1.4);
1751 t2 = (pRef->fRed + MAX_COLOR) / 2;
1752 val.fRed = MAX(t1, t2);
1753 t1 = (int) MIN(MAX_COLOR, pRef->fBlue * 1.4);
1754 t2 = (pRef->fBlue + MAX_COLOR) / 2;
1755 val.fBlue = MAX(t1, t2);
1756 }
1757 fILight[iBgColor] = GetColorByValue(&val) + 1;
1758 }
1759
1760 return fILight[iBgColor] - 1;
1761}
1762
1763////////////////////////////////////////////////////////////////////////////////
1764/// Find a color integer for the color whose color components
1765/// are given by pRef.
1766
1768{
1769 int i;
1770 float dist;
1771 float closestDist;
1772 int closest;
1773 int r, g, b;
1774# define COLOR_MASK 0xf800
1775
1776 // Search for an exact match
1777 r = pRef->fRed & COLOR_MASK;
1778 g = pRef->fGreen & COLOR_MASK;
1779 b = pRef->fBlue & COLOR_MASK;
1780 for (i = 0; i < N_COLOR; i++) {
1781 ColorStruct_t *p = fApColor[i];
1782 if (p &&
1783 ((p->fRed & COLOR_MASK) == r) &&
1784 ((p->fGreen & COLOR_MASK) == g) &&
1785 ((p->fBlue & COLOR_MASK) == b)) {
1786 fColorUsed |= (1<<i);
1787 return i;
1788 }
1789 }
1790
1791 // No exact matches. Look for a completely unused slot
1792 for (i = N_PREDEFINED_COLOR; i < N_COLOR; i++) {
1793 if (fApColor[i] == 0) {
1794 fApColor[i] = AllocColorByValue(pRef);
1795 fColorUsed |= (1<<i);
1796 return i;
1797 }
1798 }
1799
1800 // No empty slots. Look for a slot that contains a color that
1801 // isn't currently in use.
1802 for (i = N_PREDEFINED_COLOR; i < N_COLOR; i++) {
1803 if (((fColorUsed >> i) & 1) == 0) {
1804 FreeColor(fApColor[i]);
1805 fApColor[i] = AllocColorByValue(pRef);
1806 fColorUsed |= (1<<i);
1807 return i;
1808 }
1809 }
1810
1811 // Ok, find the existing color that is closest to the color requested
1812 // and use it.
1813 closest = 0;
1814 closestDist = ColorDistance(pRef, fApColor[0]);
1815 for (i = 1; i < N_COLOR; i++) {
1816 dist = ColorDistance(pRef, fApColor[i]);
1817 if (dist < closestDist) {
1818 closestDist = dist;
1819 closest = i;
1820 }
1821 }
1822
1823 return closest;
1824}
1825
1826////////////////////////////////////////////////////////////////////////////////
1827/// This routine searches for a hyperlink beneath the coordinates x,y
1828/// and returns a pointer to the HREF for that hyperlink. The text
1829/// is held in one of the markup argv[] fields of the <a> markup.
1830
1831const char *TGHtml::GetHref(int x, int y, const char **target)
1832{
1833 TGHtmlBlock *pBlock;
1834 TGHtmlElement *pElem;
1835
1836 for (pBlock = fFirstBlock; pBlock; pBlock = pBlock->fBNext) {
1837 if (pBlock->fTop > y || pBlock->fBottom < y ||
1838 pBlock->fLeft > x || pBlock->fRight < x) continue;
1839 pElem = pBlock->fPNext;
1840 if (pElem->fType == Html_IMG) {
1841 TGHtmlImageMarkup *image = (TGHtmlImageMarkup *) pElem;
1842 if (image->fPMap) {
1843 pElem = image->fPMap->fPNext;
1844 while (pElem && pElem->fType != Html_EndMAP) {
1845 if (pElem->fType == Html_AREA) {
1846 if (InArea((TGHtmlMapArea *) pElem, pBlock->fLeft, pBlock->fTop, x, y)) {
1847 if (target) *target = pElem->MarkupArg("target", 0);
1848 return pElem->MarkupArg("href", 0);
1849 }
1850 }
1851 pElem = pElem->fPNext;
1852 }
1853 continue;
1854 }
1855 }
1856 if ((pElem->fStyle.fFlags & STY_Anchor) == 0) continue;
1857 switch (pElem->fType) {
1858 case Html_Text:
1859 case Html_Space:
1860 case Html_IMG:
1861 while (pElem && pElem->fType != Html_A) pElem = pElem->fPPrev;
1862 if (pElem == 0 || pElem->fType != Html_A) break;
1863 if (target) *target = pElem->MarkupArg("target", 0);
1864 return pElem->MarkupArg("href", 0);
1865
1866 default:
1867 break;
1868 }
1869 }
1870
1871 return 0;
1872}
1873
1874////////////////////////////////////////////////////////////////////////////////
1875/// Return coordinates of item
1876
1877int TGHtml::ElementCoords(TGHtmlElement *p, int /*i*/, int pct, int *coords)
1878{
1879 TGHtmlBlock *pBlock;
1880
1881 while (p && p->fType != Html_Block) p = p->fPPrev;
1882 if (!p) return 1;
1883
1884 pBlock = (TGHtmlBlock *) p;
1885 if (pct) {
1886 TGHtmlElement *pEnd = fPLast;
1887 TGHtmlBlock *pb2;
1888 while (pEnd && pEnd->fType != Html_Block) pEnd = pEnd->fPPrev;
1889 pb2 = (TGHtmlBlock *) pEnd;
1890#define HGCo(dir) (pb2 && pb2->dir) ? pBlock->dir * 100 / pb2->dir : 0
1891 coords[0] = HGCo(fLeft);
1892 coords[1] = HGCo(fTop);
1893 coords[3] = HGCo(fRight);
1894 coords[4] = HGCo(fBottom);
1895 } else {
1896 coords[0] = pBlock->fLeft;
1897 coords[1] = pBlock->fTop;
1898 coords[2] = pBlock->fRight;
1899 coords[3] = pBlock->fBottom;
1900 }
1901 return 0;
1902}
1903
1904////////////////////////////////////////////////////////////////////////////////
1905/// Returns html element matching attribute name and value.
1906
1907TGHtmlElement *TGHtml::AttrElem(const char *name, char *value)
1908{
1909 TGHtmlElement *p;
1910 const char *z;
1911
1912 for (p = fPFirst; p; p = p->fPNext) {
1913 if (p->fType != Html_A) continue;
1914 z = p->MarkupArg(name, 0);
1915 if (z && (strcmp(z, value) == 0)) return p;
1916 }
1917 return 0;
1918}
1919
1920////////////////////////////////////////////////////////////////////////////////
1921/// Given the selection end-points in fSelBegin and fSelEnd, recompute
1922/// pSelBeginBlock and fPSelEndBlock, then call UpdateSelectionDisplay()
1923/// to update the display.
1924///
1925/// This routine should be called whenever the selection changes or
1926/// whenever the set of TGHtmlBlock structures change.
1927
1928void TGHtml::UpdateSelection(int forceUpdate)
1929{
1930 TGHtmlBlock *pBlock;
1931 int index;
1932 int needUpdate = forceUpdate;
1933 int temp;
1934
1935 if (fSelEnd.fP == 0) fSelBegin.fP = 0;
1936
1937 IndexToBlockIndex(fSelBegin, &pBlock, &index);
1938 if (needUpdate || pBlock != fPSelStartBlock) {
1939 needUpdate = 1;
1941 fPSelStartBlock = pBlock;
1942 fSelStartIndex = index;
1943 } else if (index != fSelStartIndex) {
1944 RedrawBlock(pBlock);
1945 fSelStartIndex = index;
1946 }
1947
1948 if (fSelBegin.fP == 0) fSelEnd.fP = 0;
1949
1950 IndexToBlockIndex(fSelEnd, &pBlock, &index);
1951 if (needUpdate || pBlock != fPSelEndBlock) {
1952 needUpdate = 1;
1954 fPSelEndBlock = pBlock;
1955 fSelEndIndex = index;
1956 } else if (index != fSelEndIndex) {
1957 RedrawBlock(pBlock);
1958 fSelEndIndex = index;
1959 }
1960
1963 temp = fSelStartIndex;
1965 fSelEndIndex = temp;
1966 }
1967
1968 if (needUpdate) {
1971 }
1972}
1973
1974////////////////////////////////////////////////////////////////////////////////
1975/// The fPSelStartBlock and fPSelEndBlock values have been changed.
1976/// This routine's job is to loop over all TGHtmlBlocks and either
1977/// set or clear the HTML_Selected bits in the .fFlags field
1978/// as appropriate. For every TGHtmlBlock where the bit changes,
1979/// mark that block for redrawing.
1980
1982{
1983 int selected = 0;
1984 SHtmlIndex_t tempIndex;
1985 TGHtmlBlock *pTempBlock;
1986 int temp;
1987 TGHtmlBlock *p;
1988
1989 for (p = fFirstBlock; p; p = p->fBNext) {
1990 if (p == fPSelStartBlock) {
1991 selected = 1;
1992 RedrawBlock(p);
1993 } else if (!selected && p == fPSelEndBlock) {
1994 selected = 1;
1995 tempIndex = fSelBegin;
1997 fSelEnd = tempIndex;
1998 pTempBlock = fPSelStartBlock;
2000 fPSelEndBlock = pTempBlock;
2001 temp = fSelStartIndex;
2003 fSelEndIndex = temp;
2004 RedrawBlock(p);
2005 }
2006 if (p->fFlags & HTML_Selected) {
2007 if (!selected) {
2008 p->fFlags &= ~HTML_Selected;
2009 RedrawBlock(p);
2010 }
2011 } else {
2012 if (selected) {
2013 p->fFlags |= HTML_Selected;
2014 RedrawBlock(p);
2015 }
2016 }
2017 if (p == fPSelEndBlock) {
2018 selected = 0;
2019 RedrawBlock(p);
2020 }
2021 }
2022}
2023
2024////////////////////////////////////////////////////////////////////////////////
2025/// Clear selection.
2026
2028{
2029 if (fExportSelection) {
2030 // clear selection
2031 fPSelStartBlock = 0;
2032 fPSelEndBlock = 0;
2033 fSelBegin.fP = 0;
2034 fSelEnd.fP = 0;
2036 }
2037}
2038
2039////////////////////////////////////////////////////////////////////////////////
2040/// Set selection.
2041
2042int TGHtml::SelectionSet(const char *startIx, const char *endIx)
2043{
2044 SHtmlIndex_t sBegin, sEnd;
2045 int bi, ei;
2046
2047 if (GetIndex(startIx, &sBegin.fP, &sBegin.fI)) {
2048 // malformed start index
2049 return kFALSE;
2050 }
2051
2052 if (GetIndex(endIx, &sEnd.fP, &sEnd.fI)) {
2053 // malformed end index
2054 return kFALSE;
2055 }
2056
2057 bi = TokenNumber(sBegin.fP);
2058 ei = TokenNumber(sEnd.fP);
2059
2060 if (!(sBegin.fP && sEnd.fP)) return kTRUE;
2061
2062 if (bi < ei || (bi == ei && sBegin.fI <= sEnd.fI)) {
2063 fSelBegin = sBegin;
2064 fSelEnd = sEnd;
2065 } else {
2066 fSelBegin = sEnd;
2067 fSelEnd = sBegin;
2068 }
2069
2070 UpdateSelection(0);
2071 if (fExportSelection) {
2072 // TODO:
2073 // get selection ownership ... fId, XA_PRIMARY
2074 // selection lost handler must directly call LostSelection()
2075 }
2076
2077 return kTRUE;
2078}
2079
2080////////////////////////////////////////////////////////////////////////////////
2081/// Recompute the position of the insertion cursor based on the
2082/// position in fIns.
2083
2085{
2088 if (fInsTimer == 0) {
2089 fInsStatus = 0;
2090 FlashCursor();
2091 }
2092}
2093
2094////////////////////////////////////////////////////////////////////////////////
2095/// Set the position of the insertion cursor.
2096
2097int TGHtml::SetInsert(const char *insIx)
2098{
2099 SHtmlIndex_t i;
2100
2101 if (!insIx) {
2103 fInsStatus = 0;
2104 fPInsBlock = 0;
2105 fIns.fP = 0;
2106 } else {
2107 if (GetIndex(insIx, &i.fP, &i.fI)) {
2108 // malformed index
2109 return kFALSE;
2110 }
2112 fIns = i;
2113 UpdateInsert();
2114 }
2115
2116 return kTRUE;
2117}
2118
2119////////////////////////////////////////////////////////////////////////////////
2120/// Save a html widget as a C++ statement(s) on output stream out.
2121
2122void TGHtml::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
2123{
2124 out << " TGHtml *";
2125 out << GetName() << " = new TGHtml(" << fParent->GetName()
2126 << "," << GetWidth() << "," << GetHeight()
2127 << ");"<< std::endl;
2128 if (option && strstr(option, "keep_names"))
2129 out << " " << GetName() << "->SetName(\"" << GetName() << "\");" << std::endl;
2130
2132 out << " " << GetName() << "->ChangeBackground(" << fCanvas->GetBackground() << ");" << std::endl;
2133 }
2134
2135 TString fn;
2136 TGText txt(GetText());
2137 fn.Form("Html%s.htm", GetName()+5);
2138 txt.Save(fn.Data());
2139 out << " " << "FILE *f = fopen(\"" << fn.Data() << "\", \"r\");" << std::endl;
2140 out << " " << "if (f) {" << std::endl;
2141 out << " " << GetName() << "->Clear();" << std::endl;
2142 out << " " << GetName() << "->Layout();" << std::endl;
2143 out << " " << GetName() << "->SetBaseUri(\"\");" << std::endl;
2144 out << " " << "char *buf = (char *)calloc(4096, sizeof(char));" << std::endl;
2145 out << " " << "while (fgets(buf, 4096, f)) {" << std::endl;
2146 out << " " << GetName() << "->ParseText(buf);" << std::endl;
2147 out << " " << "}" << std::endl;
2148 out << " " << "free(buf);" << std::endl;
2149 out << " " << "fclose(f);" << std::endl;
2150 out << " " << "}" << std::endl;
2151 out << " " << GetName() << "->Layout();" << std::endl;
2152}
l unsigned short
@ kButtonPress
Definition GuiTypes.h:60
@ kFocusIn
Definition GuiTypes.h:61
const Mask_t kGCForeground
Definition GuiTypes.h:288
const Mask_t kFocusChangeMask
Definition GuiTypes.h:169
const Mask_t kButtonPressMask
Definition GuiTypes.h:161
const Mask_t kExposureMask
Definition GuiTypes.h:165
const Mask_t kDoRed
Definition GuiTypes.h:319
Handle_t Pixmap_t
Pixmap handle.
Definition GuiTypes.h:30
const Mask_t kGCFont
Definition GuiTypes.h:300
const Mask_t kPointerMotionMask
Definition GuiTypes.h:163
Handle_t GContext_t
Graphics context handle.
Definition GuiTypes.h:38
const Mask_t kButtonReleaseMask
Definition GuiTypes.h:162
const Mask_t kGCGraphicsExposures
Definition GuiTypes.h:302
@ kHand
Definition GuiTypes.h:374
@ kPointer
Definition GuiTypes.h:375
const Mask_t kDoGreen
Definition GuiTypes.h:320
const Mask_t kDoBlue
Definition GuiTypes.h:321
@ kButton4
Definition GuiTypes.h:215
@ kButton5
Definition GuiTypes.h:215
@ kButton3
Definition GuiTypes.h:214
@ kButton1
Definition GuiTypes.h:214
Handle_t Window_t
Window handle.
Definition GuiTypes.h:29
ROOT::R::TRInterface & r
Definition Object.C:4
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define g(i)
Definition RSha256.hxx:105
#define h(i)
Definition RSha256.hxx:106
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
long Longptr_t
Definition RtypesCore.h:82
const Bool_t kFALSE
Definition RtypesCore.h:101
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
@ kButtonUp
Definition TGButton.h:53
#define gClient
Definition TGClient.h:157
@ kFDSave
@ Html_AREA
@ Html_Block
@ Html_Space
@ Html_Text
@ Html_A
@ Html_IMG
@ Html_EndA
@ Html_EndMAP
@ Html_MAP
#define MAX_COLOR
Definition TGHtml.cxx:1670
#define HGCo(dir)
int HtmlDepth
Definition TGHtml.cxx:67
#define COLOR_MASK
int HtmlTraceMask
Definition TGHtml.cxx:66
#define STYLER_RUNNING
Definition TGHtml.h:1338
#define HTML_MAP_CIRCLE
Definition TGHtml.h:465
#define HTML_Selected
Definition TGHtml.h:277
#define INPUT_TYPE_Radio
Definition TGHtml.h:619
#define COLOR_Selection
Definition TGHtml.h:200
#define FONT_Default
Definition TGHtml.h:174
#define INPUT_TYPE_Button
Definition TGHtml.h:626
#define COLOR_Unvisited
Definition TGHtml.h:198
#define REDRAW_PENDING
Definition TGHtml.h:1329
#define REDRAW_FOCUS
Definition TGHtml.h:1335
#define DEF_HTML_EXPORT_SEL
Definition TGHtml.h:1361
#define DEF_HTML_INSERT_OFF_TIME
Definition TGHtml.h:1366
#define HTML_MAP_RECT
Definition TGHtml.h:464
#define FONT_Any
Definition TGHtml.h:173
#define FontSetValid(I)
Definition TGHtml.h:181
#define HTML_RELIEF_SUNKEN
Definition TGHtml.h:52
#define CANT_HAPPEN
Definition TGHtml.h:60
#define COLOR_Background
Definition TGHtml.h:201
#define INPUT_TYPE_Submit
Definition TGHtml.h:622
#define LARGE_NUMBER
Definition TGHtml.h:1354
#define GOT_FOCUS
Definition TGHtml.h:1330
#define HTML_RELIEF_RAISED
Definition TGHtml.h:53
#define RELAYOUT
Definition TGHtml.h:1333
#define N_PREDEFINED_COLOR
Definition TGHtml.h:202
#define DEF_HTML_INSERT_ON_TIME
Definition TGHtml.h:1367
#define STY_Anchor
Definition TGHtml.h:238
#define N_CACHE_GC
Definition TGHtml.h:819
#define REDRAW_IMAGES
Definition TGHtml.h:1340
#define INPUT_TYPE_Text
Definition TGHtml.h:623
#define ANIMATE_IMAGES
Definition TGHtml.h:1341
#define STY_Underline
Definition TGHtml.h:236
#define DEF_HTML_SELECTION_COLOR
Definition TGHtml.h:1371
#define N_COLOR
Definition TGHtml.h:195
#define FontFamily(X)
Definition TGHtml.h:172
#define N_FONT
Definition TGHtml.h:166
#define INPUT_TYPE_Password
Definition TGHtml.h:618
#define DEF_HTML_UNVISITED
Definition TGHtml.h:1373
#define RESIZE_ELEMENTS
Definition TGHtml.h:1334
#define FontSize(X)
Definition TGHtml.h:171
#define EXTEND_LAYOUT
Definition TGHtml.h:1337
#define COLOR_Normal
Definition TGHtml.h:197
#define VSCROLL
Definition TGHtml.h:1332
#define INPUT_TYPE_Checkbox
Definition TGHtml.h:614
#define INPUT_TYPE_Select
Definition TGHtml.h:621
#define REDRAW_TEXT
Definition TGHtml.h:1336
#define HSCROLL
Definition TGHtml.h:1331
#define ALIGN_None
Definition TGHtml.h:212
#define COLOR_Visited
Definition TGHtml.h:199
#define DEF_HTML_VISITED
Definition TGHtml.h:1374
#define FontIsValid(I)
Definition TGHtml.h:180
XFontStruct * id
Definition TGX11.cxx:109
char name[80]
Definition TGX11.cxx:110
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
A button abstract base class.
Definition TGButton.h:68
Selects different options.
Definition TGButton.h:264
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event.
virtual Bool_t IsDown() const
Definition TGButton.h:312
TGFont * GetFont(const char *font, Bool_t fixedDefault=kTRUE)
Get a font from the font pool.
Definition TGClient.cxx:348
Colormap_t GetDefaultColormap() const
Definition TGClient.h:145
void FreeFont(const TGFont *font)
Free a font.
Definition TGClient.cxx:364
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition TGComboBox.h:47
This class creates a file selection dialog.
char * fFilename
selected file name
const char ** fFileTypes
file types used to filter selectable files
Encapsulate fonts used in the GUI system.
Definition TGFont.h:140
FontH_t GetFontHandle() const
Definition TGFont.h:183
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition TGFrame.cxx:339
void RemoveInput(UInt_t emask)
Remove events specified in emask from the events the frame should handle.
Definition TGFrame.cxx:348
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition TGFrame.cxx:709
UInt_t GetHeight() const
Definition TGFrame.h:225
virtual Pixel_t GetBackground() const
Definition TGFrame.h:192
UInt_t GetWidth() const
Definition TGFrame.h:224
GContext_t GetGC() const
Definition TGGC.h:41
void SetTileStipYOrigin(Int_t v)
Y offset for tile or stipple operations.
Definition TGGC.cxx:400
void SetTileStipXOrigin(Int_t v)
X offset for tile or stipple operations.
Definition TGGC.cxx:389
TGHtmlBlock * fBNext
Definition TGHtml.h:721
Html_u16_t fRight
Definition TGHtml.h:719
Html_u16_t fLeft
Definition TGHtml.h:719
int fBottom
Definition TGHtml.h:718
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
TGHtmlElement * fPNext
Definition TGHtml.h:262
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
TGHtmlElement * fPMap
Definition TGHtml.h:553
Html_16_t fH
Definition TGHtml.h:545
Html_16_t fX
Definition TGHtml.h:549
TTimer * fTimer
Definition TGHtml.h:527
TGHtmlImageMarkup * fPList
Definition TGHtml.h:525
TGHtmlImage * fPNext
Definition TGHtml.h:524
Html_u16_t fW
Definition TGHtml.h:598
Html_u8_t fItype
Definition TGHtml.h:603
Html_u16_t fH
Definition TGHtml.h:598
TGFrame * fFrame
Definition TGHtml.h:591
Html_u16_t fX
Definition TGHtml.h:597
TGHtmlForm * fPForm
Definition TGHtml.h:589
TGHtmlInput * fINext
Definition TGHtml.h:590
Html_32_t fY
Definition TGHtml.h:596
void Reset()
Reset the layout context.
int * fCoords
Definition TGHtml.h:474
virtual const char * MarkupArg(const char *tag, const char *zDefault)
Lookup an argument in the given markup with the name given.
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
virtual void SavePrimitive(std::ostream &out, Option_t *="")
Save a html widget as a C++ statement(s) on output stream out.
Definition TGHtml.cxx:2122
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
int fAddEndTags
Definition TGHtml.h:1254
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
int GotoAnchor(const char *name)
Go to anchor position.
Definition TGHtml.cxx:461
TGHtmlBlock * fLastBlock
Definition TGHtml.h:1144
int SetInsert(const char *insIx)
Set the position of the insertion cursor.
Definition TGHtml.cxx:2097
virtual ~TGHtml()
HTML widget destructor.
Definition TGHtml.cxx:231
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
TGHtmlBlock * fPSelStartBlock
Definition TGHtml.h:1158
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 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
void ScheduleRedraw()
Make sure that a call to the Redraw() routine has been queued.
Definition TGHtml.cxx:762
TGPopupMenu * fMenu
Definition TGHtml.h:1190
void LostSelection()
Clear selection.
Definition TGHtml.cxx:2027
const char * fLastUri
Definition TGHtml.h:1287
int fNToken
Definition TGHtml.h:1138
const char * GetHref(int x, int y, const char **target=0)
This routine searches for a hyperlink beneath the coordinates x,y and returns a pointer to the HREF f...
Definition TGHtml.cxx:1831
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
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
char fFontValid[(N_FONT+7)/8]
Definition TGHtml.h:1229
int fExiting
Definition TGHtml.h:1288
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 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;.
TGHtmlBlock * fPInsBlock
Definition TGHtml.h:1171
virtual void InputSelected(const char *name, const char *val)
Emit Selected() signal.
Definition TGHtml.cxx:1326
virtual void CheckToggled(const char *name, Bool_t on, const char *val)
Emit CheckToggled() signal.
Definition TGHtml.cxx:1299
int SelectionSet(const char *startIx, const char *endIx)
Set selection.
Definition TGHtml.cxx:2042
virtual void Clear(Option_t *="")
Erase all HTML from this widget and clear the screen.
Definition TGHtml.cxx:310
void UpdateSelectionDisplay()
The fPSelStartBlock and fPSelEndBlock values have been changed.
Definition TGHtml.cxx:1981
TGHtmlBlock * fPSelEndBlock
Definition TGHtml.h:1162
ColorStruct_t * fSelectionColor
Definition TGHtml.h:1241
void SaveFileAs()
Save file.
Definition TGHtml.cxx:1348
virtual Bool_t HandleFocusChange(Event_t *event)
Handle focus change event.
Definition TGHtml.cxx:1132
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.
TGFont * fAFont[N_FONT]
Definition TGHtml.h:1228
int fVarind
Definition TGHtml.h:1256
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
void SetRuleRelief(int relief)
Sets relief mode of html rule.
Definition TGHtml.cxx:396
virtual void UpdateBackgroundStart()
Start background update.
Definition TGHtml.cxx:250
int fInsOnTime
Definition TGHtml.h:1166
int fVarId
Definition TGHtml.h:1149
int fDirtyBottom
Definition TGHtml.h:1277
SHtmlStyleStack_t * fStyleStack
Definition TGHtml.h:1197
int ParseText(char *text, const char *index=0)
Appends (or insert at the specified position) the given HTML text to the end of any HTML text that ma...
Definition TGHtml.cxx:325
virtual Bool_t HandleTimer(TTimer *timer)
Handle timer event.
Definition TGHtml.cxx:1004
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
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event.
Definition TGHtml.cxx:1389
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
virtual Bool_t HandleMotion(Event_t *event)
handle mouse motion events
Definition TGHtml.cxx:1438
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
int fILight[N_COLOR]
Definition TGHtml.h:1236
int fNInput
Definition TGHtml.h:1147
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
void SetBaseUri(const char *uri)
Sets base URI.
Definition TGHtml.cxx:451
int fDirtyRight
Definition TGHtml.h:1277
void DeleteControls()
Delete all input controls.
ColorStruct_t * AllocColorByValue(ColorStruct_t *color)
Allocate system color by value.
Definition TGHtml.cxx:291
virtual Bool_t HandleIdleEvent(TGIdleHandler *i)
Handles idle event.
Definition TGHtml.cxx:773
TGHtmlInput * fFirstInput
Definition TGHtml.h:1145
void SetTableRelief(int relief)
Sets relief mode of html table.
Definition TGHtml.cxx:384
ColorStruct_t * AllocColor(const char *name)
Allocate system color by name.
Definition TGHtml.cxx:272
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
GContext_t GetAnyGC()
Retrieve any valid GC.
Definition TGHtml.cxx:1117
Html_16_t fSelStartIndex
Definition TGHtml.h:1159
virtual Bool_t ItemLayout()
Layout html widget.
Definition TGHtml.cxx:834
TGHtmlScript * fPScript
Definition TGHtml.h:1187
TGHtmlBlock * fFirstBlock
Definition TGHtml.h:1143
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
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
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
int fIDark[N_COLOR]
Definition TGHtml.h:1235
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
int fDirtyLeft
Definition TGHtml.h:1274
GcCache_t fAGcCache[N_CACHE_GC]
Definition TGHtml.h:1242
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 FreeColor(ColorStruct_t *color)
Free system color.
Definition TGHtml.cxx:263
void ComputeVirtualSize()
Computes virtual size of html area.
Definition TGHtml.cxx:508
int TokenNumber(TGHtmlElement *p)
Return the token number for the given TGHtmlElement.
int fInTd
Definition TGHtml.h:1203
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
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 InArea(TGHtmlMapArea *p, int left, int top, int x, int y)
Only support rect and circles for now.
Definition TGHtml.cxx:1574
virtual void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw region defined by [x,y] [w,h].
Definition TGHtml.cxx:805
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
TImage * fBgImage
Definition TGHtml.h:1246
int fNComplete
Definition TGHtml.h:1179
int fInDt
Definition TGHtml.h:1201
TGHtmlLayoutContext fLayoutContext
Definition TGHtml.h:1216
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
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 MapControls()
Map any control that should be visible according to the current scroll position.
const char * GetText() const
Definition TGHtml.h:962
void ClearGcCache()
Clear the cache of GCs.
Definition TGHtml.cxx:516
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
ColorStruct_t * fApColor[N_COLOR]
Definition TGHtml.h:1232
int ElementCoords(TGHtmlElement *p, int i, int pct, int *coords)
Return coordinates of item.
Definition TGHtml.cxx:1877
int fHasScript
Definition TGHtml.h:1252
int fTableRelief
Definition TGHtml.h:1265
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 fInsStatus
Definition TGHtml.h:1168
TGHtml(const TGWindow *p, int w, int h, int id=-1)
HTML Widget constructor.
Definition TGHtml.cxx:79
Bool_t HandleHtmlInput(TGHtmlInput *pr, Event_t *event)
Handle html input (button, checkbox, ...) event.
Definition TGHtml.cxx:1176
int fInParse
Definition TGHtml.h:1280
int fTableBorderMin
Definition TGHtml.h:1255
SHtmlExtensions_t * fExts
Definition TGHtml.h:1283
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
Handle idle events, i.e.
A listbox is a box, possibly with scrollbar, containing entries.
Definition TGListBox.h:221
Long_t fX
x position
Definition TGDimension.h:56
Long_t fY
y position
Definition TGDimension.h:57
TGClient * fClient
Connection to display server.
Definition TGObject.h:27
Handle_t GetId() const
Definition TGObject.h:37
Handle_t fId
X11/Win32 Window identifier.
Definition TGObject.h:26
This class creates a popup menu object.
Definition TGMenu.h:110
virtual void DisableEntry(Int_t id)
Disable entry (disabled entries appear in a sunken relieve).
Definition TGMenu.cxx:1724
virtual Int_t EndMenu(void *&userData)
Close menu and return ID of selected menu item.
Definition TGMenu.cxx:1289
virtual void AddEntry(TGHotString *s, Int_t id, void *ud=nullptr, const TGPicture *p=nullptr, TGMenuEntry *before=nullptr)
Add a menu entry.
Definition TGMenu.cxx:990
virtual void PlaceMenu(Int_t x, Int_t y, Bool_t stick_mode, Bool_t grab_pointer)
Popup a popup menu.
Definition TGMenu.cxx:1241
Selects different options.
Definition TGButton.h:322
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button event.
virtual Bool_t IsDown() const
Definition TGButton.h:371
UInt_t fH
height
Definition TGDimension.h:94
UInt_t fW
width
Definition TGDimension.h:93
Int_t fX
x position
Definition TGDimension.h:91
Int_t fY
y position
Definition TGDimension.h:92
virtual void SetAccelerated(Bool_t m=kTRUE)
A TGTextEntry is a one line text input widget.
Definition TGTextEntry.h:24
virtual void SetFocus()
Set focus to this text entry.
A TGText is a multi line text buffer.
Definition TGText.h:57
Bool_t Save(const char *fn)
Save text buffer to file fn.
Definition TGText.cxx:610
A TGView provides the infrastructure for text viewer and editor widgets.
Definition TGView.h:23
TGHScrollBar * fHsb
horizontal scrollbar
Definition TGView.h:43
virtual Bool_t HandleButton(Event_t *event)
handle button
Definition TGView.cxx:237
TGDimension fVirtualSize
the current virtual window size
Definition TGView.h:35
TGVScrollBar * fVsb
vertical scrollbar
Definition TGView.h:44
TGLongPosition fVisible
position of visible region
Definition TGView.h:32
UInt_t fXMargin
x margin
Definition TGView.h:40
virtual void SetBackgroundColor(Pixel_t)
Set background color of the canvas frame.
Definition TGView.cxx:590
TGLongPosition fScrollVal
scroll value
Definition TGView.h:34
TGViewFrame * fCanvas
frame containing the text
Definition TGView.h:42
virtual void DrawRegion(Int_t x, Int_t y, UInt_t width, UInt_t height)
Draw region.
Definition TGView.cxx:196
TGGC fWhiteGC
graphics context used for scrolling generates GraphicsExposure events
Definition TGView.h:46
virtual void ScrollToPosition(TGLongPosition newPos)
Scroll the canvas to pos.
Definition TGView.cxx:453
UInt_t fYMargin
y margin
Definition TGView.h:41
virtual void Clear(Option_t *="")
Clear view.
Definition TGView.cxx:161
virtual void SetBackgroundPixmap(Pixmap_t p)
Set backgound pixmap.
Definition TGView.cxx:600
ROOT GUI Window base class.
Definition TGWindow.h:23
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition TGWindow.cxx:336
const TGWindow * fParent
Parent window.
Definition TGWindow.h:28
@ kIsHtmlView
Definition TGWindow.h:62
THashTable implements a hash table to store TObject's.
Definition THashTable.h:35
void Add(TObject *obj)
Add object to the hash table.
TObject * FindObject(const char *name) const
Find object using its name.
Collectable string class.
Definition TObjString.h:28
const char * GetName() const
Returns name of object.
Definition TObjString.h:38
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:766
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:515
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition TQObject.h:164
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition TQObject.cxx:869
Basic string class.
Definition TString.h:136
const char * Data() const
Definition TString.h:369
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition TString.cxx:916
virtual Int_t Sizeof() const
Returns size string will occupy on I/O buffer.
Definition TString.cxx:1359
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2314
Handles synchronous and a-synchronous timer events.
Definition TTimer.h:51
TText * text
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
Short_t Max(Short_t a, Short_t b)
Definition TMathBase.h:208
ULong_t fPixel
color pixel value (index in color table)
Definition GuiTypes.h:311
UShort_t fRed
red component (0..65535)
Definition GuiTypes.h:312
UShort_t fGreen
green component (0..65535)
Definition GuiTypes.h:313
UShort_t fBlue
blue component (0..65535)
Definition GuiTypes.h:314
UShort_t fMask
mask telling which color components are valid
Definition GuiTypes.h:315
Event structure.
Definition GuiTypes.h:174
EGEventType fType
of event (see EGEventType)
Definition GuiTypes.h:175
Int_t fY
pointer x, y coordinates in event window
Definition GuiTypes.h:178
Int_t fXRoot
Definition GuiTypes.h:179
Bool_t fSendEvent
true if event came from SendEvent
Definition GuiTypes.h:184
Handle_t fHandle
general resource handle (used for atoms or windows)
Definition GuiTypes.h:185
Int_t fFormat
Next fields only used by kClientMessageEvent.
Definition GuiTypes.h:186
UInt_t fWidth
Definition GuiTypes.h:182
UInt_t fHeight
width and height of exposed area
Definition GuiTypes.h:182
Int_t fCount
if non-zero, at least this many more exposes
Definition GuiTypes.h:183
Window_t fWindow
window reported event is relative to
Definition GuiTypes.h:176
UInt_t fState
key or button mask
Definition GuiTypes.h:181
Int_t fYRoot
coordinates relative to root
Definition GuiTypes.h:179
Int_t fX
Definition GuiTypes.h:178
Time_t fTime
time event event occurred in ms
Definition GuiTypes.h:177
UInt_t fCode
key or button code
Definition GuiTypes.h:180
Longptr_t fUser[5]
5 longs can be used by client message events NOTE: only [0], [1] and [2] may be used.
Definition GuiTypes.h:187
Graphics context structure.
Definition GuiTypes.h:224
Mask_t fMask
bit mask specifying which fields are valid
Definition GuiTypes.h:251
Bool_t fGraphicsExposures
boolean, should exposures be generated
Definition GuiTypes.h:244
ULong_t fForeground
foreground pixel
Definition GuiTypes.h:227
FontH_t fFont
default text font for text operations
Definition GuiTypes.h:242
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
TGHtmlElement * fP
Definition TGHtml.h:833
SHtmlStyleStack_t * fPNext
Definition TGHtml.h:734
unsigned int fFlags
Definition TGHtml.h:151
TCanvas * style()
Definition style.C:1
#define MIN(x, y)
Definition sweep.c:95
#define MAX(x, y)
Definition sweep.c:94
auto * t1
Definition textangle.C:20