Logo ROOT   6.10/09
Reference Guide
TGHtmlBrowser.cxx
Go to the documentation of this file.
1 // @(#)root/guitml:$Id$
2 // Author: Bertrand Bellenot 26/09/2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
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 #include "TROOT.h"
13 #include "TApplication.h"
14 #include "TSystem.h"
15 #include "TGMenu.h"
16 #include "TGComboBox.h"
17 #include "TGFrame.h"
18 #include "TGButton.h"
19 #include "TGTextBuffer.h"
20 #include "TGTextEntry.h"
21 #include "TGStatusBar.h"
22 #include "TGFileDialog.h"
23 #include "TFile.h"
24 #include "TBrowser.h"
25 #include "TGHtml.h"
26 #include "TString.h"
27 #include "TUrl.h"
28 #include "TSocket.h"
29 #include "Riostream.h"
30 #include "TGHtmlBrowser.h"
31 #include "TGText.h"
32 
33 #ifdef WIN32
34 #include "TWin32SplashThread.h"
35 #endif
36 
37 #include <stdlib.h>
38 
39 //_____________________________________________________________________________
40 //
41 // TGHtmlBrowser
42 //
43 // A very simple HTML browser.
44 //_____________________________________________________________________________
45 
47 
56 };
57 
58 static const char *gHtmlFTypes[] = {
59  "HTML files", "*.htm*",
60  "All files", "*",
61  0, 0
62 };
63 
64 const char *HtmlError[] = {
65 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd\"> ",
66 "<HTML><HEAD><TITLE>RHTML cannot display the webpage</TITLE> ",
67 "<META http-equiv=Content-Type content=\"text/html; charset=UTF-8\"></HEAD> ",
68 "<BODY> ",
69 "<TABLE cellSpacing=0 cellPadding=0 width=730 border=0> ",
70 " <TBODY> ",
71 " <TR> ",
72 " <TD id=infoIconAlign vAlign=top align=left width=60 rowSpan=2> ",
73 " <IMG src=\"info.gif\"> ",
74 " </TD> ",
75 " <TD id=mainTitleAlign vAlign=center align=left width=*> ",
76 " <H1 id=mainTitle>RHTML cannot display the webpage</H1></TD></TR> ",
77 " <TR> ",
78 " <TD class=errorCodeAndDivider id=errorCodeAlign align=right>&nbsp; ",
79 " <DIV class=divider></DIV></TD></TR> ",
80 " <TR> ",
81 " <UL> ",
82 " </UL> ",
83 " <TD>&nbsp; </TD> ",
84 " <TD id=MostLikelyAlign vAlign=top align=left> ",
85 " <H3 id=likelyCauses>Most likely causes:</H3> ",
86 " <UL> ",
87 " <LI id=causeNotConnected>You are not connected to the Internet. ",
88 " <LI id=causeSiteProblem>The website is encountering problems. ",
89 " <LI id=causeErrorInAddress>There might be a typing error in the address. ",
90 " <LI id=causeOtherError> ",
91 " </LI></UL></TD></TR> ",
92 " <TR> ",
93 " <TD id=infoBlockAlign vAlign=top align=right>&nbsp; </TD> ",
94 " <TD id=moreInformationAlign vAlign=center align=left> ",
95 " <H4> ",
96 " <TABLE> ",
97 " <TBODY> ",
98 " <TR> ",
99 " <TD vAlign=top><SPAN id=moreInfoContainer></SPAN><ID ",
100 " id=moreInformation>More information</ID> ",
101 " </TD></TR></TBODY></TABLE></H4> ",
102 " <DIV class=infoBlock id=infoBlockID> ",
103 " <P><ID id=errorExpl1>This problem can be caused by a variety of issues, ",
104 " including:</ID> ",
105 " <UL> ",
106 " <LI id=errorExpl2>Internet connectivity has been lost. ",
107 " <LI id=errorExpl3>The website is temporarily unavailable. ",
108 " <LI id=errorExpl4>The Domain Name Server (DNS) is not reachable. ",
109 " <LI id=errorExpl5>The Domain Name Server (DNS) does not have a listing ",
110 " for the website's domain. ",
111 " <P></P> ",
112 " <P></P></DIV></TD></TR></TBODY></TABLE></BODY></HTML> ",
113 0
114 };
115 
116 ////////////////////////////////////////////////////////////////////////////////
117 /// TGHtmlBrowser constructor.
118 
119 TGHtmlBrowser::TGHtmlBrowser(const char *filename, const TGWindow *p, UInt_t w, UInt_t h)
120  : TGMainFrame(p, w, h)
121 {
123  fNbFavorites = 1000;
124  fMenuBar = new TGMenuBar(this, 35, 50, kHorizontalFrame);
125 
126  fMenuFile = new TGPopupMenu(gClient->GetDefaultRoot());
127  fMenuFile->AddEntry(" &Open...\tCtrl+O", kM_FILE_OPEN, 0,
128  gClient->GetPicture("ed_open.png"));
129  fMenuFile->AddEntry(" Save &As...\tCtrl+A", kM_FILE_SAVEAS, 0,
130  gClient->GetPicture("ed_save.png"));
131  fMenuFile->AddEntry(" &Browse...\tCtrl+B", kM_FILE_BROWSE);
133  fMenuFile->AddEntry(" E&xit\tCtrl+Q", kM_FILE_EXIT, 0,
134  gClient->GetPicture("bld_exit.png"));
135  fMenuFile->Associate(this);
136 
137  fMenuFavorites = new TGPopupMenu(gClient->GetDefaultRoot());
138  fMenuFavorites->AddEntry("&Add to Favorites", kM_FAVORITES_ADD, 0,
139  gClient->GetPicture("bld_plus.png"));
141  fMenuFavorites->AddEntry("http://root.cern.ch", fNbFavorites++, 0,
142  gClient->GetPicture("htmlfile.gif"));
143  fMenuFavorites->Associate(this);
144 
145  fMenuTools = new TGPopupMenu(gClient->GetDefaultRoot());
146  fMenuTools->AddEntry("&Clear History", kM_TOOLS_CLEARHIST, 0,
147  gClient->GetPicture("ed_delete.png"));
148  fMenuTools->Associate(this);
149 
150  fMenuHelp = new TGPopupMenu(gClient->GetDefaultRoot());
151  fMenuHelp->AddEntry(" &About...", kM_HELP_ABOUT, 0, gClient->GetPicture("about.xpm"));
152  fMenuHelp->Associate(this);
153 
154  fMenuBar->AddPopup("&File", fMenuFile, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
155  fMenuBar->AddPopup("&Favorites", fMenuFavorites, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
156  fMenuBar->AddPopup("&Tools", fMenuTools, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
158 
160 
161  // vertical frame
162  fVerticalFrame = new TGVerticalFrame(this,727,600,kVerticalFrame);
163 
165 
166  fBack = new TGPictureButton(fHorizontalFrame,gClient->GetPicture("GoBack.gif"));
167  fBack->SetStyle(gClient->GetStyle());
168  fBack->SetToolTipText("Go Back");
170  fBack->Connect("Clicked()", "TGHtmlBrowser", this, "Back()");
171 
172  fForward = new TGPictureButton(fHorizontalFrame,gClient->GetPicture("GoForward.gif"));
173  fForward->SetStyle(gClient->GetStyle());
174  fForward->SetToolTipText("Go Forward");
176  fForward->Connect("Clicked()", "TGHtmlBrowser", this, "Forward()");
177 
178  fReload = new TGPictureButton(fHorizontalFrame,gClient->GetPicture("ReloadPage.gif"));
179  fReload->SetStyle(gClient->GetStyle());
180  fReload->SetToolTipText("Reload Page");
182  fReload->Connect("Clicked()", "TGHtmlBrowser", this, "Reload()");
183 
184  fStop = new TGPictureButton(fHorizontalFrame,gClient->GetPicture("StopLoading.gif"));
185  fStop->SetStyle(gClient->GetStyle());
186  fStop->SetToolTipText("Stop Loading");
188  fStop->Connect("Clicked()", "TGHtmlBrowser", this, "Stop()");
189 
190  fHome = new TGPictureButton(fHorizontalFrame,gClient->GetPicture("GoHome.gif"));
191  fHome->SetStyle(gClient->GetStyle());
192  fHome->SetToolTipText("Go to ROOT HomePage\n (http://root.cern.ch)");
194  fHome->Connect("Clicked()", "TGHtmlBrowser", this, "Selected(=\"http://root.cern.ch\")");
195 
196  // combo box
197  fURLBuf = new TGTextBuffer(256);
200  fURLBuf = fURL->GetBuffer();
202  fURL->Connect("ReturnPressed()", "TGHtmlBrowser", this, "URLChanged()");
203 
204  if (filename) {
205  fComboBox->AddEntry(filename, 1);
206  fURL->SetText(filename);
207  }
208  fComboBox->Select(0);
209  fComboBox->Connect("Selected(char *)", "TGHtmlBrowser", this, "Selected(char *)");
210 
212 
214 
215  // embedded canvas
216  fHtml = new TGHtml(fVerticalFrame, 10, 10, -1);
218 
220 
221  // status bar
222  fStatusBar = new TGStatusBar(this,100,20);
223  Int_t partsusBar[] = {75,25};
224  fStatusBar->SetParts(partsusBar,2);
226 
227  fHtml->Connect("MouseOver(const char *)", "TGHtmlBrowser", this, "MouseOver(const char *)");
228  fHtml->Connect("MouseDown(const char *)", "TGHtmlBrowser", this, "MouseDown(const char *)");
229 
230  MapSubwindows();
232  MapWindow();
233  Resize(w, h);
234 
235  if (filename)
236  Selected(filename);
237 }
238 
239 ////////////////////////////////////////////////////////////////////////////////
240 /// Read (open) remote files.
241 
242 Ssiz_t ReadSize(const char *url)
243 {
244  char buf[4096];
245  TUrl fUrl(url);
246 
247  // Give full URL so Apache's virtual hosts solution works.
248  TString msg = "HEAD ";
249  msg += fUrl.GetProtocol();
250  msg += "://";
251  msg += fUrl.GetHost();
252  msg += ":";
253  msg += fUrl.GetPort();
254  msg += "/";
255  msg += fUrl.GetFile();
256  msg += " HTTP/1.0";
257  msg += "\r\n";
258  msg += "User-Agent: ROOT-TWebFile/1.1";
259  msg += "\r\n\r\n";
260 
261  TString uri(url);
262  if (!uri.BeginsWith("http://"))
263  return 0;
264  TSocket s(fUrl.GetHost(), fUrl.GetPort());
265  if (!s.IsValid())
266  return 0;
267  if (s.SendRaw(msg.Data(), msg.Length()) == -1)
268  return 0;
269  if (s.RecvRaw(buf, 4096) == -1) {
270  return 0;
271  }
272  TString reply(buf);
273  Ssiz_t idx = reply.Index("Content-length:", 0, TString::kIgnoreCase);
274  if (idx > 0) {
275  idx += 15;
276  TString slen = reply(idx, reply.Length() - idx);
277  return (Ssiz_t)atol(slen.Data());
278  }
279  return 0;
280 }
281 
282 ////////////////////////////////////////////////////////////////////////////////
283 /// Read (open) remote files.
284 
285 static char *ReadRemote(const char *url)
286 {
287  static char *buf = 0;
288  TUrl fUrl(url);
289 
290  Ssiz_t size = ReadSize(url);
291  if (size <= 0) size = 1024*1024;
292 
293  TString msg = "GET ";
294  msg += fUrl.GetProtocol();
295  msg += "://";
296  msg += fUrl.GetHost();
297  msg += ":";
298  msg += fUrl.GetPort();
299  msg += "/";
300  msg += fUrl.GetFile();
301  msg += "\r\n";
302 
303  TString uri(url);
304  if (!uri.BeginsWith("http://"))
305  return 0;
306  TSocket s(fUrl.GetHost(), fUrl.GetPort());
307  if (!s.IsValid())
308  return 0;
309  if (s.SendRaw(msg.Data(), msg.Length()) == -1)
310  return 0;
311  buf = (char *)calloc(size+1, sizeof(char));
312  if (s.RecvRaw(buf, size) == -1) {
313  free(buf);
314  return 0;
315  }
316  return buf;
317 }
318 
319 ////////////////////////////////////////////////////////////////////////////////
320 /// Open (browse) selected URL.
321 
322 void TGHtmlBrowser::Selected(const char *uri)
323 {
324  char *buf = 0;
325  FILE *f;
326 
327  if (CheckAnchors(uri))
328  return;
329 
330  TString surl(gSystem->UnixPathName(uri));
331  if (!surl.BeginsWith("http://") && !surl.BeginsWith("ftp://") &&
332  !surl.BeginsWith("file://")) {
333  if (surl.BeginsWith("file:"))
334  surl.ReplaceAll("file:", "file://");
335  else
336  surl.Prepend("file://");
337  }
338  if (surl.EndsWith(".root")) {
339  // in case of root file, just open it and refresh browsers
340  gVirtualX->SetCursor(fHtml->GetId(), gVirtualX->CreateCursor(kWatch));
341  gROOT->ProcessLine(Form("TFile::Open(\"%s\");", surl.Data()));
342  Clicked((char *)surl.Data());
343  gROOT->RefreshBrowsers();
344  gVirtualX->SetCursor(fHtml->GetId(), gVirtualX->CreateCursor(kPointer));
345  return;
346  }
347  gVirtualX->SetCursor(fHtml->GetId(), gVirtualX->CreateCursor(kWatch));
348  TUrl url(surl.Data());
349  if (surl.EndsWith(".pdf", TString::kIgnoreCase)) {
350  // special case: open pdf files with external viewer
351  // works only on Windows for the time being...
352  if (!gVirtualX->InheritsFrom("TGX11")) {
353  TString cmd = TString::Format("explorer %s", surl.Data());
354  gSystem->Exec(cmd.Data());
355  }
356  gVirtualX->SetCursor(fHtml->GetId(), gVirtualX->CreateCursor(kPointer));
357  return;
358  }
359  if (surl.EndsWith(".gif") || surl.EndsWith(".jpg") || surl.EndsWith(".png")) {
360  // special case: single picture
361  fHtml->Clear();
362  char imgHtml[1024];
363  snprintf(imgHtml, 1000, "<IMG src=\"%s\"> ", surl.Data());
364  fHtml->ParseText(imgHtml);
365  fHtml->SetBaseUri(url.GetUrl());
366  fURL->SetText(surl.Data());
367  if (!fComboBox->FindEntry(surl.Data()))
368  fComboBox->AddEntry(surl.Data(), fComboBox->GetNumberOfEntries()+1);
369  fHtml->Layout();
370  gVirtualX->SetCursor(fHtml->GetId(), gVirtualX->CreateCursor(kPointer));
371  return;
372  }
373  if ((!strcmp(url.GetProtocol(), "http"))) {
374  // standard web page
375  buf = ReadRemote(url.GetUrl());
376  if (buf) {
377  fHtml->Clear();
378  fHtml->Layout();
379  fHtml->SetBaseUri(url.GetUrl());
380  fHtml->ParseText(buf);
381  free(buf);
382  fURL->SetText(surl.Data());
383  if (!fComboBox->FindEntry(surl.Data()))
384  fComboBox->AddEntry(surl.Data(), fComboBox->GetNumberOfEntries()+1);
385  }
386  else {
387  fHtml->Clear();
388  fHtml->Layout();
389  fHtml->SetBaseUri("");
390  for (int i=0; HtmlError[i]; i++) {
391  fHtml->ParseText((char *)HtmlError[i]);
392  }
393  }
394  }
395  else {
396  // local file
397  f = fopen(url.GetFile(), "r");
398  if (f) {
399  TString fpath = url.GetUrl();
400  fpath.ReplaceAll(gSystem->BaseName(fpath.Data()), "");
401  fpath.ReplaceAll("file://", "");
402  fHtml->Clear();
403  fHtml->Layout();
404  fHtml->SetBaseUri(fpath.Data());
405  buf = (char *)calloc(4096, sizeof(char));
406  if (buf) {
407  while (fgets(buf, 4096, f)) {
408  fHtml->ParseText(buf);
409  }
410  free(buf);
411  }
412  fclose(f);
413  fURL->SetText(surl.Data());
414  if (!fComboBox->FindEntry(surl.Data()))
415  fComboBox->AddEntry(surl.Data(), fComboBox->GetNumberOfEntries()+1);
416  }
417  else {
418  fHtml->Clear();
419  fHtml->Layout();
420  fHtml->SetBaseUri("");
421  for (int i=0; HtmlError[i]; i++) {
422  fHtml->ParseText((char *)HtmlError[i]);
423  }
424  }
425  }
426  // restore cursor
427  gVirtualX->SetCursor(fHtml->GetId(), gVirtualX->CreateCursor(kPointer));
428  fHtml->Layout();
429  Ssiz_t idx = surl.Last('#');
430  if (idx > 0) {
431  idx +=1; // skip #
432  TString anchor = surl(idx, surl.Length() - idx);
433  fHtml->GotoAnchor(anchor.Data());
434  }
435  SetWindowName(Form("%s - RHTML",surl.Data()));
436 }
437 
438 ////////////////////////////////////////////////////////////////////////////////
439 /// URL combobox has changed.
440 
442 {
443  const char *string = fURL->GetText();
444  if (string) {
445  Selected(gSystem->UnixPathName(string));
446  }
447 }
448 
449 ////////////////////////////////////////////////////////////////////////////////
450 /// Handle "Back" navigation button.
451 
453 {
454  Int_t index = 0;
455  const char *string = fURL->GetText();
456  TGLBEntry * lbe1 = fComboBox->FindEntry(string);
457  if (lbe1)
458  index = lbe1->EntryId();
459  if (index > 0) {
460  fComboBox->Select(index - 1, kTRUE);
462  if (entry) {
463  string = entry->GetTitle();
464  if (string)
465  Selected(string);
466  }
467  }
468 }
469 
470 ////////////////////////////////////////////////////////////////////////////////
471 /// Check if we just change position in the page (using anchor)
472 /// and return kTRUE if any anchor has been found and followed.
473 
475 {
476  TString surl(gSystem->UnixPathName(uri));
477 
478  if (!fHtml->GetBaseUri())
479  return kFALSE;
480  TString actual = fHtml->GetBaseUri();
481  Ssiz_t idx = surl.Last('#');
482  Ssiz_t idy = actual.Last('#');
483  TString short1(surl.Data());
484  TString short2(actual.Data());
485  if (idx > 0)
486  short1 = surl(0, idx);
487  if (idy > 0)
488  short2 = actual(0, idy);
489 
490  if (short1 == short2) {
491  if (idx > 0) {
492  idx +=1; // skip #
493  TString anchor = surl(idx, surl.Length() - idx);
494  fHtml->GotoAnchor(anchor.Data());
495  }
496  else {
498  }
499  fHtml->SetBaseUri(surl.Data());
500  if (!fComboBox->FindEntry(surl.Data()))
501  fComboBox->AddEntry(surl.Data(), fComboBox->GetNumberOfEntries()+1);
502  fURL->SetText(surl.Data());
504  SetWindowName(Form("%s - RHTML",surl.Data()));
505  return kTRUE;
506  }
507  return kFALSE;
508 }
509 
510 ////////////////////////////////////////////////////////////////////////////////
511 /// Handle "Forward" navigation button.
512 
514 {
515  Int_t index = 0;
516  const char *string = fURL->GetText();
517  TGLBEntry * lbe1 = fComboBox->FindEntry(string);
518  if (lbe1)
519  index = lbe1->EntryId();
520  if (index < fComboBox->GetNumberOfEntries()) {
521  fComboBox->Select(index + 1, kTRUE);
523  if (entry) {
524  string = entry->GetTitle();
525  if (string)
526  Selected(string);
527  }
528  }
529 }
530 
531 ////////////////////////////////////////////////////////////////////////////////
532 /// Handle "Reload" navigation button.
533 
535 {
536  const char *string = fURL->GetText();
537  if (string)
538  Selected(string);
539 }
540 
541 ////////////////////////////////////////////////////////////////////////////////
542 /// Handle "Reload" navigation button.
543 
545 {
546 }
547 
548 ////////////////////////////////////////////////////////////////////////////////
549 /// Handle "MouseOver" TGHtml signal.
550 
551 void TGHtmlBrowser::MouseOver(const char *url)
552 {
553  fStatusBar->SetText(url, 0);
554 }
555 
556 ////////////////////////////////////////////////////////////////////////////////
557 /// Handle "MouseDown" TGHtml signal.
558 
559 void TGHtmlBrowser::MouseDown(const char *url)
560 {
561  Selected(url);
562 }
563 
564 ////////////////////////////////////////////////////////////////////////////////
565 /// Process Events.
566 
568 {
569  switch (GET_MSG(msg)) {
570  case kC_COMMAND:
571  {
572  switch (GET_SUBMSG(msg)) {
573 
574  case kCM_MENU:
575  case kCM_BUTTON:
576 
577  switch(parm1) {
578 
579  case kM_FILE_EXIT:
580  CloseWindow();
581  break;
582 
583  case kM_FILE_OPEN:
584  {
585  static TString dir(".");
586  TGFileInfo fi;
587  fi.fFileTypes = gHtmlFTypes;
588  fi.fIniDir = StrDup(dir);
589  new TGFileDialog(fClient->GetRoot(), this,
590  kFDOpen, &fi);
591  dir = fi.fIniDir;
592  if (fi.fFilename) {
593  Selected(Form("file://%s",
595  }
596  }
597  break;
598 
599  case kM_FILE_SAVEAS:
600  {
601  static TString sdir(".");
602  TGFileInfo fi;
603  fi.fFileTypes = gHtmlFTypes;
604  fi.fIniDir = StrDup(sdir);
605  new TGFileDialog(fClient->GetRoot(), this,
606  kFDSave, &fi);
607  sdir = fi.fIniDir;
608  if (fi.fFilename) {
609  TGText txt(fHtml->GetText());
611  }
612  }
613  break;
614 
615  case kM_FAVORITES_ADD:
617  fURL->GetText()), fNbFavorites++, 0,
618  gClient->GetPicture("htmlfile.gif"));
619  break;
620 
621  case kM_TOOLS_CLEARHIST:
623  break;
624 
625  case kM_FILE_BROWSE:
626  new TBrowser();
627  break;
628 
629  case kM_HELP_ABOUT:
630  {
631 #ifdef R__UNIX
632  TString rootx = TROOT::GetBinDir() + "/root -a &";
633  gSystem->Exec(rootx);
634 #else
635 #ifdef WIN32
637 #else
638  char str[32];
639  snprintf(str, 32, "About ROOT %s...", gROOT->GetVersion());
640  TRootHelpDialog *hd = new TRootHelpDialog(this, str,
641  600, 400);
642  hd->SetText(gHelpAbout);
643  hd->Popup();
644 #endif
645 #endif
646  }
647  break;
648 
649  default:
650  {
651  if (parm1 < 1000) break;
652  TGMenuEntry *entry = fMenuFavorites->GetEntry(parm1);
653  if (!entry) break;
654  const char *shortcut = entry->GetName();
655  if (shortcut)
656  Selected(shortcut);
657  }
658  break;
659  }
660  break;
661  }
662  break;
663  }
664  }
665  return kTRUE;
666 }
667 
void Selected(const char *txt)
Open (browse) selected URL.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:931
TGPopupMenu * fMenuFile
Definition: TGHtmlBrowser.h:39
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
virtual TGTextEntry * GetTextEntry() const
Definition: TGComboBox.h:131
TGHtmlBrowser(const char *filename=0, const TGWindow *p=0, UInt_t w=900, UInt_t h=600)
TGHtmlBrowser constructor.
int GotoAnchor(const char *name)
Go to anchor position.
Definition: TGHtml.cxx:447
TGMenuBar * fMenuBar
Definition: TGHtmlBrowser.h:38
virtual void Layout()
layout view
Definition: TGView.cxx:345
virtual TGMenuEntry * GetEntry(Int_t id)
Find entry with specified id.
Definition: TGMenu.cxx:1887
Definition: TGText.h:67
TGPictureButton * fBack
Definition: TGHtmlBrowser.h:46
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1746
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition: TGClient.cxx:222
EMyMessageTypes
This class represents a WWW compatible URL.
Definition: TUrl.h:35
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:640
const char * GetProtocol() const
Definition: TUrl.h:67
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
void MouseOver(const char *)
Handle "MouseOver" TGHtml signal.
#define gROOT
Definition: TROOT.h:375
void MouseDown(const char *)
Handle "MouseDown" TGHtml signal.
virtual const char * GetTitle() const
Returns title of object.
Definition: TGListBox.h:117
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:587
void Forward()
Handle "Forward" navigation button.
Basic string class.
Definition: TString.h:129
#define gClient
Definition: TGClient.h:166
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void AddEntry(TGHotString *s, Int_t id, void *ud=0, const TGPicture *p=0, TGMenuEntry *before=0)
Add a menu entry.
Definition: TGMenu.cxx:987
TString & Prepend(const char *cs)
Definition: TString.h:609
Handle_t GetId() const
Definition: TGObject.h:48
virtual void AddSeparator(TGMenuEntry *before=0)
Add a menu separator to the menu.
Definition: TGMenu.cxx:1057
R__EXTERN const char gHelpAbout[]
Definition: HelpText.h:14
virtual const char * UnixPathName(const char *unixpathname)
Convert from a Unix pathname to a local pathname.
Definition: TSystem.cxx:1043
Definition: TGHtml.h:872
const char * GetFile() const
Definition: TUrl.h:72
void Stop()
Handle "Reload" navigation button.
void Back()
Handle "Back" navigation button.
TGComboBox * fComboBox
Definition: TGHtmlBrowser.h:51
const char * GetHost() const
Definition: TUrl.h:70
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Definition: TString.cxx:2345
const char ** fFileTypes
Definition: TGFileDialog.h:63
static char * ReadRemote(const char *url)
Read (open) remote files.
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
Definition: TGComboBox.cxx:443
virtual TGLBEntry * FindEntry(const char *s) const
Find entry by name.
Definition: TGComboBox.cxx:414
const char * HtmlError[]
TGTextBuffer * fURLBuf
Definition: TGHtmlBrowser.h:52
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t)
Process Events.
virtual void SetText(TGString *text, Int_t partidx=0)
Set text in partition partidx in status bar.
Bool_t CheckAnchors(const char *)
Check if we just change position in the page (using anchor) and return kTRUE if any anchor has been f...
TGTextBuffer * GetBuffer() const
Definition: TGTextEntry.h:127
TGPopupMenu * fMenuHelp
Definition: TGHtmlBrowser.h:42
virtual void SetStyle(UInt_t newstyle)
Set the button style (modern or classic).
Definition: TGButton.cxx:221
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
Definition: TQObject.cxx:867
void URLChanged()
URL combobox has changed.
R__EXTERN TSystem * gSystem
Definition: TSystem.h:539
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition: TGFrame.h:375
Int_t GET_SUBMSG(Long_t val)
Int_t EntryId() const
Definition: TGListBox.h:68
virtual void Associate(const TGWindow *w)
Definition: TGMenu.h:219
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:563
virtual void CloseWindow()
Close and delete main frame.
Definition: TGFrame.cxx:1728
TGPictureButton * fStop
Definition: TGHtmlBrowser.h:49
unsigned int UInt_t
Definition: RtypesCore.h:42
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
char * Form(const char *fmt,...)
Ssiz_t Length() const
Definition: TString.h:388
TGStatusBar * fStatusBar
Definition: TGHtmlBrowser.h:43
#define calloc
Definition: civetweb.c:819
Ssiz_t ReadSize(const char *url)
Read (open) remote files.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Definition: TSystem.cxx:660
void Clicked(char *uri)
Definition: TGHtmlBrowser.h:72
Bool_t Save(const char *fn)
Save text buffer to file fn.
Definition: TGText.cxx:609
#define gVirtualX
Definition: TVirtualX.h:350
TGHtml * fHtml
Definition: TGHtmlBrowser.h:54
char * StrDup(const char *str)
Duplicate the string str.
Definition: TString.cxx:2524
const char * GetBaseUri() const
Definition: TGHtml.h:906
Int_t GET_MSG(Long_t val)
const Bool_t kFALSE
Definition: RtypesCore.h:92
const char * GetText() const
Definition: TGTextEntry.h:134
TGPopupMenu * fMenuFavorites
Definition: TGHtmlBrowser.h:40
long Long_t
Definition: RtypesCore.h:50
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:238
int Ssiz_t
Definition: RtypesCore.h:63
TGPopupMenu * fMenuTools
Definition: TGHtmlBrowser.h:41
const char * GetText() const
Definition: TGHtml.h:961
#define ClassImp(name)
Definition: Rtypes.h:336
double f(double x)
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition: TGFrame.cxx:1054
virtual void AddEntry(TGString *s, Int_t id)
Definition: TGComboBox.h:106
Ssiz_t Last(char c) const
Find last occurrence of a character c.
Definition: TString.cxx:875
const char * GetName() const
Returns name of object.
Definition: TGMenu.h:96
static const char * gHtmlFTypes[]
#define free
Definition: civetweb.c:821
char * fFilename
Definition: TGFileDialog.h:61
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
virtual void ScrollToPosition(TGLongPosition newPos)
Scroll the canvas to pos.
Definition: TGView.cxx:452
Int_t GetPort() const
Definition: TUrl.h:81
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
virtual Int_t GetNumberOfEntries() const
Definition: TGComboBox.h:127
TGPictureButton * fForward
Definition: TGHtmlBrowser.h:47
virtual void MapWindow()
Definition: TGFrame.h:251
TGClient * fClient
Definition: TGObject.h:37
Int_t fNbFavorites
Definition: TGHtmlBrowser.h:55
#define snprintf
Definition: civetweb.c:822
void SetBaseUri(const char *uri)
Sets base URI.
Definition: TGHtml.cxx:437
virtual void SetParts(Int_t npart)
Divide the status bar in npart equal sized parts.
void Reload()
Handle "Reload" navigation button.
static const TString & GetBinDir()
Get the binary directory in the installation. Static utility function.
Definition: TROOT.cxx:2728
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line...
virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
Definition: TGComboBox.h:125
TGVerticalFrame * fVerticalFrame
Definition: TGHtmlBrowser.h:44
const Bool_t kTRUE
Definition: RtypesCore.h:91
TGPictureButton * fReload
Definition: TGHtmlBrowser.h:48
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:395
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=0)
Add popup menu to menu bar.
Definition: TGMenu.cxx:415
TGTextEntry * fURL
Definition: TGHtmlBrowser.h:53
char * fIniDir
Definition: TGFileDialog.h:62
TGPictureButton * fHome
Definition: TGHtmlBrowser.h:50
virtual TGLBEntry * GetSelectedEntry() const
Definition: TGComboBox.h:135
const char * Data() const
Definition: TString.h:347
TGHorizontalFrame * fHorizontalFrame
Definition: TGHtmlBrowser.h:45