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