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