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