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