Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RWebBrowserImp.cxx
Go to the documentation of this file.
1// Author: Sergey Linev <S.Linev@gsi.de>
2// Date: 2021-02-11
3
4/*************************************************************************
5 * Copyright (C) 1995-2021, 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
13
14#include "TROOT.h"
15#include "TSeqCollection.h" // needed in gROOT->GetListOfFiles()->FindObject
16#include "TEnv.h"
17
18#include <iostream>
19
20using namespace ROOT;
21
22////////////////////////////////////////////////////////////////////////////////////////
23/// Default constructor
24
26{
28
29 fWebBrowser = std::make_shared<RBrowser>();
30 fWebBrowser->AddTCanvas();
31}
32
33////////////////////////////////////////////////////////////////////////////////////////
34/// Constructor with width and height parameters
35
37{
39
40 fWidth = width;
42 fWebBrowser = std::make_shared<RBrowser>();
43 fWebBrowser->AddTCanvas();
44}
45
46////////////////////////////////////////////////////////////////////////////////////////
47/// Constructor with x,y, width and height parameters
48
50{
52
53 fX = x;
54 fY = y;
55 fWidth = width;
57 fWebBrowser = std::make_shared<RBrowser>();
58 fWebBrowser->AddTCanvas();
59}
60
61////////////////////////////////////////////////////////////////////////////////////////
62/// Constructor with width and height parameters
63
67
68////////////////////////////////////////////////////////////////////////////////////////
69/// Show warning that RBrowser will be shown
70
72{
73 static bool show_warn = true;
74 if (!show_warn)
75 return;
76
77 TString value = gEnv->GetValue("WebGui.Warning", "yes");
78 if ((value != "yes") && (value != "1"))
79 return;
80
81 show_warn = false;
82
83 std::cout << "\n"
84 "ROOT comes with a web-based browser, which is now being started. \n"
85 "Revert to TBrowser by setting \"Browser.Name: TRootBrowser\" in rootrc file or\n"
86 "by starting \"root --web=off\"\n"
87 "Find more info on https://root.cern/doc/latest-stable/classROOT_1_1RBrowser.html\n";
88}
89
90////////////////////////////////////////////////////////////////////////////////////////
91/// Iconify browser
92
96
97////////////////////////////////////////////////////////////////////////////////////////
98/// Refresh browser
99
103
104////////////////////////////////////////////////////////////////////////////////////////
105/// Show browser
106
108{
109 fWebBrowser->Show();
110}
111
112
113////////////////////////////////////////////////////////////////////////////////////////
114/// Browse specified object
115
117{
118 if (obj == gROOT) return;
119
120 if (gROOT->GetListOfFiles()->FindObject(obj))
121 fWebBrowser->SetWorkingPath("ROOT Files");
122}
123
124////////////////////////////////////////////////////////////////////////////////////////
125/// Factory method to create RWebBrowserImp via plugin
126
128{
129 return new RWebBrowserImp(b, title, width, height, opt);
130}
131
132////////////////////////////////////////////////////////////////////////////////////////
133/// Factory method to create RWebBrowserImp via plugin
134
136{
137 return new RWebBrowserImp(b, title, x, y, width, height, opt);
138}
#define b(i)
Definition RSha256.hxx:100
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
R__EXTERN TEnv * gEnv
Definition TEnv.h:126
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
#define gROOT
Definition TROOT.h:417
void ShowWarning()
Show warning that RBrowser will be shown.
Int_t fHeight
window coordinates
void Show() final
Show browser.
virtual ~RWebBrowserImp()
Constructor with width and height parameters.
void Iconify() final
Iconify browser.
std::shared_ptr< RBrowser > fWebBrowser
actual browser used
void Refresh(Bool_t=kFALSE) final
Refresh browser.
static TBrowserImp * NewBrowser(TBrowser *b=nullptr, const char *title="ROOT Browser", UInt_t width=800, UInt_t height=500, Option_t *opt="")
Factory method to create RWebBrowserImp via plugin.
void BrowseObj(TObject *) final
Browse specified object.
RWebBrowserImp(TBrowser *b=nullptr)
Default constructor.
ABC describing GUI independent browser implementation protocol.
Definition TBrowserImp.h:29
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition TEnv.cxx:511
Mother of all ROOT objects.
Definition TObject.h:42
Basic string class.
Definition TString.h:138
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17