Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 std::string fPromptFileOutput; ///<! file name for prompt output
40
41 std::shared_ptr<RWebWindow> fWebWindow; ///<! web window to browser
42
43 RBrowserData fBrowsable; ///<! central browsing element
44
45 std::shared_ptr<RBrowserWidget> AddWidget(const std::string &kind);
46 std::shared_ptr<RBrowserWidget> AddCatchedWidget(const std::string &url, const std::string &kind);
47 std::shared_ptr<RBrowserWidget> FindWidget(const std::string &name, const std::string &kind = "") const;
48 std::shared_ptr<RBrowserWidget> GetActiveWidget() const { return FindWidget(fActiveWidgetName); }
49
50 void CloseTab(const std::string &name);
51
52 std::string ProcessBrowserRequest(const std::string &msg);
53 std::string ProcessDblClick(std::vector<std::string> &args);
54 std::string NewWidgetMsg(std::shared_ptr<RBrowserWidget> &widget);
55 void ProcessRunMacro(const std::string &file_path);
56 void ProcessSaveFile(const std::string &fname, const std::string &content);
57 std::string GetCurrentWorkingDirectory();
58
59 std::vector<std::string> GetRootHistory();
60 std::vector<std::string> GetRootLogs();
61
62 void SendInitMsg(unsigned connid);
63 void ProcessMsg(unsigned connid, const std::string &arg);
64
65 void AddInitWidget(const std::string &kind);
66
68
69public:
70 RBrowser(bool use_rcanvas = true);
71 virtual ~RBrowser();
72
73 bool GetUseRCanvas() const { return fUseRCanvas; }
74 void SetUseRCanvas(bool on = true) { fUseRCanvas = on; }
75
76 void AddTCanvas() { AddInitWidget("tcanvas"); }
77 void AddRCanvas() { AddInitWidget("rcanvas"); }
78
79 /// show Browser in specified place
80 void Show(const RWebDisplayArgs &args = "", bool always_start_new_browser = false);
81
82 /// hide Browser
83 void Hide();
84
85 void SetWorkingPath(const std::string &path);
86
87 /// Enable/disable catch of RWebWindow::Show calls to embed created widgets, default on
88 void SetCatchWindowShow(bool on = true) { fCatchWindowShow = on; }
89
90 /// Is RWebWindow::Show calls catched for embeding of created widgets
91 bool GetCatchWindowShow() const { return fCatchWindowShow; }
92
93 bool ActivateWidget(const std::string &title, const std::string &kind = "");
94
95};
96
97} // namespace Experimental
98} // namespace ROOT
99
100#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 files and objects browser.
Definition RBrowser.hxx:27
std::shared_ptr< RBrowserWidget > AddWidget(const std::string &kind)
Creates new widget.
Definition RBrowser.cxx:507
std::vector< std::string > GetRootHistory()
Get content of history file.
Definition RBrowser.cxx:597
void AddInitWidget(const std::string &kind)
Create new widget and send init message to the client.
Definition RBrowser.cxx:558
bool GetCatchWindowShow() const
Is RWebWindow::Show calls catched for embeding of created widgets.
Definition RBrowser.hxx:91
void SetWorkingPath(const std::string &path)
Set working path in the browser.
Definition RBrowser.cxx:849
void Hide()
hide Browser
Definition RBrowser.cxx:497
std::string NewWidgetMsg(std::shared_ptr< RBrowserWidget > &widget)
Create message which send to client to create new widget.
Definition RBrowser.cxx:688
std::shared_ptr< RWebWindow > fWebWindow
! web window to browser
Definition RBrowser.hxx:41
std::shared_ptr< RBrowserWidget > GetActiveWidget() const
Definition RBrowser.hxx:48
void Show(const RWebDisplayArgs &args="", bool always_start_new_browser=false)
show Browser in specified place
Definition RBrowser.cxx:485
std::string GetCurrentWorkingDirectory()
Return the current directory of ROOT.
Definition RBrowser.cxx:680
std::shared_ptr< RBrowserWidget > AddCatchedWidget(const std::string &url, const std::string &kind)
Add widget catched from external scripts.
Definition RBrowser.cxx:539
std::shared_ptr< RBrowserWidget > FindWidget(const std::string &name, const std::string &kind="") const
Find widget by name or kind.
Definition RBrowser.cxx:568
std::string fTitle
! title
Definition RBrowser.hxx:31
virtual ~RBrowser()
destructor
Definition RBrowser.cxx:323
int fWidgetCnt
! counter for created widgets
Definition RBrowser.hxx:38
RBrowserData fBrowsable
! central browsing element
Definition RBrowser.hxx:43
void ProcessSaveFile(const std::string &fname, const std::string &content)
Process file save command in the editor.
Definition RBrowser.cxx:356
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:698
std::string ProcessBrowserRequest(const std::string &msg)
Process browser request.
Definition RBrowser.cxx:332
std::string fActiveWidgetName
! name of active widget
Definition RBrowser.hxx:36
std::vector< std::string > GetRootLogs()
Get content of log file.
Definition RBrowser.cxx:620
void ProcessMsg(unsigned connid, const std::string &arg)
Process received message from the client.
Definition RBrowser.cxx:707
bool fCatchWindowShow
! if arbitrary RWebWindow::Show calls should be catched by browser
Definition RBrowser.hxx:35
void CloseTab(const std::string &name)
Close and delete specified widget.
Definition RBrowser.cxx:584
void SetUseRCanvas(bool on=true)
Definition RBrowser.hxx:74
bool ActivateWidget(const std::string &title, const std::string &kind="")
Activate widget in RBrowser One should specify title and (optionally) kind of widget like "tcanvas" o...
Definition RBrowser.cxx:864
void SetCatchWindowShow(bool on=true)
Enable/disable catch of RWebWindow::Show calls to embed created widgets, default on.
Definition RBrowser.hxx:88
void SendInitMsg(unsigned connid)
Process client connect.
Definition RBrowser.cxx:638
std::string ProcessDblClick(std::vector< std::string > &args)
Process dbl click on browser item.
Definition RBrowser.cxx:381
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:367
std::string fPromptFileOutput
! file name for prompt output
Definition RBrowser.hxx:39
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.