48 enum EMyMessageTypes {
59 "HTML files",
"*.htm*",
65 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd\"> ",
66 "<HTML><HEAD><TITLE>RHTML cannot display the webpage</TITLE> ",
67 "<META http-equiv=Content-Type content=\"text/html; charset=UTF-8\"></HEAD> ",
69 "<TABLE cellSpacing=0 cellPadding=0 width=730 border=0> ",
72 " <TD id=infoIconAlign vAlign=top align=left width=60 rowSpan=2> ",
73 " <IMG src=\"info.gif\"> ",
75 " <TD id=mainTitleAlign vAlign=center align=left width=*> ",
76 " <H1 id=mainTitle>RHTML cannot display the webpage</H1></TD></TR> ",
78 " <TD class=errorCodeAndDivider id=errorCodeAlign align=right> ",
79 " <DIV class=divider></DIV></TD></TR> ",
84 " <TD id=MostLikelyAlign vAlign=top align=left> ",
85 " <H3 id=likelyCauses>Most likely causes:</H3> ",
87 " <LI id=causeNotConnected>You are not connected to the Internet. ",
88 " <LI id=causeSiteProblem>The website is encountering problems. ",
89 " <LI id=causeErrorInAddress>There might be a typing error in the address. ",
90 " <LI id=causeOtherError> ",
91 " </LI></UL></TD></TR> ",
93 " <TD id=infoBlockAlign vAlign=top align=right> </TD> ",
94 " <TD id=moreInformationAlign vAlign=center align=left> ",
99 " <TD vAlign=top><SPAN id=moreInfoContainer></SPAN><ID ",
100 " id=moreInformation>More information</ID> ",
101 " </TD></TR></TBODY></TABLE></H4> ",
102 " <DIV class=infoBlock id=infoBlockID> ",
103 " <P><ID id=errorExpl1>This problem can be caused by a variety of issues, ",
106 " <LI id=errorExpl2>Internet connectivity has been lost. ",
107 " <LI id=errorExpl3>The website is temporarily unavailable. ",
108 " <LI id=errorExpl4>The Domain Name Server (DNS) is not reachable. ",
109 " <LI id=errorExpl5>The Domain Name Server (DNS) does not have a listing ",
110 " for the website's domain. ",
112 " <P></P></DIV></TD></TR></TBODY></TABLE></BODY></HTML> ",
128 gClient->GetPicture(
"ed_open.png"));
130 gClient->GetPicture(
"ed_save.png"));
134 gClient->GetPicture(
"bld_exit.png"));
139 gClient->GetPicture(
"bld_plus.png"));
142 gClient->GetPicture(
"htmlfile.gif"));
147 gClient->GetPicture(
"ed_delete.png"));
170 fBack->
Connect(
"Clicked()",
"TGHtmlBrowser",
this,
"Back()");
188 fStop->
Connect(
"Clicked()",
"TGHtmlBrowser",
this,
"Stop()");
194 fHome->
Connect(
"Clicked()",
"TGHtmlBrowser",
this,
"Selected(=\"http://root.cern.ch\")");
202 fURL->
Connect(
"ReturnPressed()",
"TGHtmlBrowser",
this,
"URLChanged()");
209 fComboBox->
Connect(
"Selected(char *)",
"TGHtmlBrowser",
this,
"Selected(char *)");
223 Int_t partsusBar[] = {75,25};
227 fHtml->
Connect(
"MouseOver(const char *)",
"TGHtmlBrowser",
this,
"MouseOver(const char *)");
228 fHtml->
Connect(
"MouseDown(const char *)",
"TGHtmlBrowser",
this,
"MouseDown(const char *)");
258 msg +=
"User-Agent: ROOT-TWebFile/1.1";
267 if (s.SendRaw(msg.
Data(), msg.
Length()) == -1)
269 if (s.RecvRaw(buf, 4096) == -1) {
287 static char *buf = 0;
291 if (size <= 0) size = 1024*1024;
309 if (s.SendRaw(msg.
Data(), msg.
Length()) == -1)
311 buf = (
char *)calloc(size+1,
sizeof(
char));
312 if (s.RecvRaw(buf, size) == -1) {
331 if (!surl.BeginsWith(
"http://") && !surl.BeginsWith(
"ftp://") &&
332 !surl.BeginsWith(
"file://")) {
333 if (surl.BeginsWith(
"file:"))
338 if (surl.EndsWith(
".root")) {
341 gROOT->ProcessLine(
Form(
"TFile::Open(\"%s\");", surl.Data()));
343 gROOT->RefreshBrowsers();
348 TUrl url(surl.Data());
359 if (surl.EndsWith(
".gif") || surl.EndsWith(
".jpg") || surl.EndsWith(
".png")) {
363 snprintf(imgHtml, 1000,
"<IMG src=\"%s\"> ", surl.Data());
373 if ((!strcmp(url.GetProtocol(),
"http"))) {
397 f = fopen(url.GetFile(),
"r");
405 buf = (
char *)calloc(4096,
sizeof(
char));
407 while (fgets(buf, 4096, f)) {
429 Ssiz_t idx = surl.Last(
'#');
432 TString anchor = surl(idx, surl.Length() - idx);
481 Ssiz_t idx = surl.Last(
'#');
486 short1 = surl(0, idx);
488 short2 = actual(0, idy);
490 if (short1 == short2) {
493 TString anchor = surl(idx, surl.Length() - idx);
520 if (index < fComboBox->GetNumberOfEntries()) {
615 case kM_FAVORITES_ADD:
618 gClient->GetPicture(
"htmlfile.gif"));
621 case kM_TOOLS_CLEARHIST:
637 if (!rootx.
IsNull()) rootx +=
"/bin";
639 rootx +=
"/root -a &";
646 snprintf(str, 32,
"About ROOT %s...",
gROOT->GetVersion());
658 if (parm1 < 1000)
break;
661 const char *shortcut = entry->
GetName();
const char * GetHost() const
void Selected(const char *txt)
Open (browse) selected URL.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Ssiz_t Last(char c) const
Find last occurrence of a character c.
TGHtmlBrowser(const char *filename=0, const TGWindow *p=0, UInt_t w=900, UInt_t h=600)
TGHtmlBrowser constructor.
int GotoAnchor(const char *name)
Go to anchor position.
virtual void Layout()
layout view
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
This class represents a WWW compatible URL.
TString & ReplaceAll(const TString &s1, const TString &s2)
const TGWindow * GetRoot() const
Returns current root (i.e.
virtual void Clear(Option_t *="")
Erase all HTML from this widget and clear the screen.
const char * GetProtocol() const
static const char * filename()
void MouseOver(const char *)
Handle "MouseOver" TGHtml signal.
void MouseDown(const char *)
Handle "MouseDown" TGHtml signal.
void Forward()
Handle "Forward" navigation button.
virtual Int_t GetNumberOfEntries() const
TString & Prepend(const char *cs)
virtual TGLBEntry * GetSelectedEntry() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
virtual const char * GetTitle() const
Returns title of object.
R__EXTERN const char gHelpAbout[]
virtual const char * UnixPathName(const char *unixpathname)
Convert from a Unix pathname to a local pathname.
void Stop()
Handle "Reload" navigation button.
const char * Data() const
void Back()
Handle "Back" navigation button.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
const char * GetText() const
static char * ReadRemote(const char *url)
Read (open) remote files.
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
virtual const char * Getenv(const char *env)
Get environment variable.
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t)
Process Events.
virtual void SetText(TGString *text, Int_t partidx=0)
Set text in partition partidx in status bar.
Bool_t CheckAnchors(const char *)
Check if we just change position in the page (using anchor) and return kTRUE if any anchor has been f...
Using a TBrowser one can browse all ROOT objects.
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...
void URLChanged()
URL combobox has changed.
R__EXTERN TSystem * gSystem
virtual TGLBEntry * FindEntry(const char *s) const
Find entry by name.
virtual void CloseWindow()
Close and delete main frame.
const char * GetBaseUri() const
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...
char * Form(const char *fmt,...)
Ssiz_t ReadSize(const char *url)
Read (open) remote files.
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Bool_t Save(const char *fn)
Save text buffer to file fn.
char * StrDup(const char *str)
Duplicate the string str.
TGPopupMenu * fMenuFavorites
ClassImp(TGHtmlBrowser) enum EMyMessageTypes
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
virtual void AddEntry(TGString *s, Int_t id)
static const char * gHtmlFTypes[]
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
virtual void ScrollToPosition(TGLongPosition newPos)
Scroll the canvas to pos.
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
TGPictureButton * fForward
virtual UInt_t GetDefaultHeight() const
const char * GetText() const
void SetBaseUri(const char *uri)
Sets base URI.
TGTextBuffer * GetBuffer() const
virtual void SetParts(Int_t npart)
Divide the status bar in npart equal sized parts.
void Reload()
Handle "Reload" navigation button.
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
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...
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
TGVerticalFrame * fVerticalFrame
TGPictureButton * fReload
const char * GetFile() const
virtual TGTextEntry * GetTextEntry() const
TGHorizontalFrame * fHorizontalFrame