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