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