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