Logo ROOT  
Reference Guide
RBrowser.hxx
Go to the documentation of this file.
1// Authors: Bertrand Bellenot <bertrand.bellenot@cern.ch> Sergey Linev <S.Linev@gsi.de>
2// Date: 2019-02-28
3// Warning: This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
4
5/*************************************************************************
6 * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
7 * All rights reserved. *
8 * *
9 * For the licensing terms see $ROOTSYS/LICENSE. *
10 * For the list of contributors see $ROOTSYS/README/CREDITS. *
11 *************************************************************************/
12
13#ifndef ROOT7_RBrowser
14#define ROOT7_RBrowser
15
16#include <ROOT/RWebWindow.hxx>
17#include <ROOT/RBrowserData.hxx>
18
19#include <vector>
20#include <memory>
21
22namespace ROOT {
23namespace Experimental {
24
25class RBrowserWidget;
26
27class RBrowser {
28
29protected:
30
31 std::string fTitle; ///<! title
32 unsigned fConnId{0}; ///<! default connection id
33
34 bool fUseRCanvas{false}; ///<! which canvas should be used
35 bool fCatchWindowShow{true}; ///<! if arbitrary RWebWindow::Show calls should be catched by browser
36 std::string fActiveWidgetName; ///<! name of active widget
37 std::vector<std::shared_ptr<RBrowserWidget>> fWidgets; ///<! all browser widgets
38 int fWidgetCnt{0}; ///<! counter for created widgets
39
40 std::shared_ptr<RWebWindow> fWebWindow; ///<! web window to browser
41
42 RBrowserData fBrowsable; ///<! central browsing element
43
44 std::shared_ptr<RBrowserWidget> AddWidget(const std::string &kind);
45 std::shared_ptr<RBrowserWidget> AddCatchedWidget(const std::string &url, const std::string &kind);
46 std::shared_ptr<RBrowserWidget> FindWidget(const std::string &name) const;
47 std::shared_ptr<RBrowserWidget> GetActiveWidget() const { return FindWidget(fActiveWidgetName); }
48
49 void CloseTab(const std::string &name);
50
51 std::string ProcessBrowserRequest(const std::string &msg);
52 std::string ProcessDblClick(std::vector<std::string> &args);
53 std::string NewWidgetMsg(std::shared_ptr<RBrowserWidget> &widget);
54 void ProcessRunMacro(const std::string &file_path);
55 void ProcessSaveFile(const std::string &fname, const std::string &content);
56 std::string GetCurrentWorkingDirectory();
57
58 std::vector<std::string> GetRootHistory();
59 std::vector<std::string> GetRootLogs();
60
61 void SendInitMsg(unsigned connid);
62 void ProcessMsg(unsigned connid, const std::string &arg);
63
64 void AddInitWidget(const std::string &kind);
65
67
68public:
69 RBrowser(bool use_rcanvas = true);
70 virtual ~RBrowser();
71
72 bool GetUseRCanvas() const { return fUseRCanvas; }
73 void SetUseRCanvas(bool on = true) { fUseRCanvas = on; }
74
75 void AddTCanvas() { AddInitWidget("tcanvas"); }
76 void AddRCanvas() { AddInitWidget("rcanvas"); }
77
78 /// show Browser in specified place
79 void Show(const RWebDisplayArgs &args = "", bool always_start_new_browser = false);
80
81 /// hide Browser
82 void Hide();
83
84 void SetWorkingPath(const std::string &path);
85
86 /// Enable/disable catch of RWebWindow::Show calls to embed created widgets, default on
87 void SetCatchWindowShow(bool on = true) { fCatchWindowShow = on; }
88
89 /// Is RWebWindow::Show calls catched for embeding of created widgets
90 bool GetCatchWindowShow() const { return fCatchWindowShow; }
91
92};
93
94} // namespace Experimental
95} // namespace ROOT
96
97#endif
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
char name[80]
Definition: TGX11.cxx:110
Way to browse (hopefully) everything in ROOT.
Web-based ROOT file browser.
Definition: RBrowser.hxx:27
std::shared_ptr< RBrowserWidget > AddWidget(const std::string &kind)
Creates new widget.
Definition: RBrowser.cxx:393
std::vector< std::string > GetRootHistory()
Get content of history file.
Definition: RBrowser.cxx:478
void AddInitWidget(const std::string &kind)
Create new widget and send init message to the client.
Definition: RBrowser.cxx:441
bool GetCatchWindowShow() const
Is RWebWindow::Show calls catched for embeding of created widgets.
Definition: RBrowser.hxx:90
void SetWorkingPath(const std::string &path)
Set working path in the browser.
Definition: RBrowser.cxx:698
void Hide()
hide Browser
Definition: RBrowser.cxx:381
std::string NewWidgetMsg(std::shared_ptr< RBrowserWidget > &widget)
Create message which send to client to create new widget.
Definition: RBrowser.cxx:565
std::shared_ptr< RWebWindow > fWebWindow
! web window to browser
Definition: RBrowser.hxx:40
std::shared_ptr< RBrowserWidget > GetActiveWidget() const
Definition: RBrowser.hxx:47
void Show(const RWebDisplayArgs &args="", bool always_start_new_browser=false)
show Browser in specified place
Definition: RBrowser.cxx:369
std::string GetCurrentWorkingDirectory()
Return the current directory of ROOT.
Definition: RBrowser.cxx:557
std::shared_ptr< RBrowserWidget > AddCatchedWidget(const std::string &url, const std::string &kind)
Add widget catched from external scripts.
Definition: RBrowser.cxx:422
std::string fTitle
! title
Definition: RBrowser.hxx:31
virtual ~RBrowser()
destructor
Definition: RBrowser.cxx:213
int fWidgetCnt
! counter for created widgets
Definition: RBrowser.hxx:38
RBrowserData fBrowsable
! central browsing element
Definition: RBrowser.hxx:42
void ProcessSaveFile(const std::string &fname, const std::string &content)
Process file save command in the editor.
Definition: RBrowser.cxx:246
bool fUseRCanvas
! which canvas should be used
Definition: RBrowser.hxx:34
void CheckWidgtesModified()
Check if any widget was modified and update if necessary.
Definition: RBrowser.cxx:574
std::string ProcessBrowserRequest(const std::string &msg)
Process browser request.
Definition: RBrowser.cxx:222
std::string fActiveWidgetName
! name of active widget
Definition: RBrowser.hxx:36
std::vector< std::string > GetRootLogs()
Get content of log file.
Definition: RBrowser.cxx:501
void ProcessMsg(unsigned connid, const std::string &arg)
Process received message from the client.
Definition: RBrowser.cxx:583
std::shared_ptr< RBrowserWidget > FindWidget(const std::string &name) const
Returns active geometry viewer (if any)
Definition: RBrowser.cxx:451
bool fCatchWindowShow
! if arbitrary RWebWindow::Show calls should be catched by browser
Definition: RBrowser.hxx:35
RBrowser(bool use_rcanvas=true)
constructor
Definition: RBrowser.cxx:157
void CloseTab(const std::string &name)
Close and delete specified widget.
Definition: RBrowser.cxx:465
void SetUseRCanvas(bool on=true)
Definition: RBrowser.hxx:73
void SetCatchWindowShow(bool on=true)
Enable/disable catch of RWebWindow::Show calls to embed created widgets, default on.
Definition: RBrowser.hxx:87
void SendInitMsg(unsigned connid)
Process client connect.
Definition: RBrowser.cxx:522
std::string ProcessDblClick(std::vector< std::string > &args)
Process dbl click on browser item.
Definition: RBrowser.cxx:271
unsigned fConnId
! default connection id
Definition: RBrowser.hxx:32
void ProcessRunMacro(const std::string &file_path)
Process run macro command in the editor.
Definition: RBrowser.cxx:257
std::vector< std::shared_ptr< RBrowserWidget > > fWidgets
! all browser widgets
Definition: RBrowser.hxx:37
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.