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