Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RBrowserWidget.hxx
Go to the documentation of this file.
1// Author: Sergey Linev <S.Linev@gsi.de>
2// Date: 2021-01-22
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_RBrowserWidget
14#define ROOT7_RBrowserWidget
15
16#include <memory>
17#include <map>
18#include <string>
19
21
22namespace ROOT {
23
24class RBrowser;
25
26/** \class ROOT::RBrowserWidget
27\ingroup rbrowser
28Abstract Web-based widget, which can be used in the RBrowser
29Used to embed canvas, geometry viewer and potentially any other widgets
30*/
31
33
34 friend class RBrowser;
35
36 std::string fName; ///<! widget name
37
38 Browsable::RElementPath_t fPath; ///<! path of drawn element
39
40 RBrowser *fBrowser{nullptr};
41
42public:
43
44 explicit RBrowserWidget(const std::string &name) : fName(name) {};
45 virtual ~RBrowserWidget() = default;
46
47 RBrowser *GetBrowser() const { return fBrowser; }
48
49 virtual void Show(const std::string &) = 0;
50
51 virtual void ResetConn() {}
52
53 virtual void SetActive() {}
54
55 void SetPath(const Browsable::RElementPath_t &path) { fPath = path; }
56 const Browsable::RElementPath_t &GetPath() const { return fPath; }
57
58 const std::string &GetName() const { return fName; }
59 virtual std::string GetKind() const = 0;
60 virtual std::string GetUrl() = 0;
61 virtual std::string GetTitle() { return ""; }
62
63 virtual bool DrawElement(std::shared_ptr<Browsable::RElement> &, const std::string & = "") { return false; }
64 virtual std::string SendWidgetContent() { return ""; }
65 std::string SendWidgetTitle();
66
67 virtual void CheckModified() {}
68
69 virtual bool IsValid() { return true; }
70};
71
73protected:
74 using ProvidersMap_t = std::map<std::string, RBrowserWidgetProvider*>;
75
76 virtual std::shared_ptr<RBrowserWidget> Create(const std::string &) = 0;
77
78 virtual std::shared_ptr<RBrowserWidget> CreateFor(const std::string &, std::shared_ptr<Browsable::RElement> &) { return nullptr; }
79
80 static ProvidersMap_t& GetMap();
81
82public:
83
84 explicit RBrowserWidgetProvider(const std::string &kind);
86
87 static std::shared_ptr<RBrowserWidget> CreateWidget(const std::string &kind, const std::string &name);
88
89 static std::shared_ptr<RBrowserWidget> CreateWidgetFor(const std::string &kind, const std::string &name, std::shared_ptr<Browsable::RElement> &element);
90};
91
92} // namespace ROOT
93
94#endif
char name[80]
Definition TGX11.cxx:110
std::map< std::string, RBrowserWidgetProvider * > ProvidersMap_t
virtual std::shared_ptr< RBrowserWidget > CreateFor(const std::string &, std::shared_ptr< Browsable::RElement > &)
virtual std::shared_ptr< RBrowserWidget > Create(const std::string &)=0
static std::shared_ptr< RBrowserWidget > CreateWidgetFor(const std::string &kind, const std::string &name, std::shared_ptr< Browsable::RElement > &element)
Create specified widget for existing object.
static std::shared_ptr< RBrowserWidget > CreateWidget(const std::string &kind, const std::string &name)
Create specified widget.
static ProvidersMap_t & GetMap()
Returns static map of existing providers.
virtual ~RBrowserWidgetProvider()
Destructor.
Abstract Web-based widget, which can be used in the RBrowser Used to embed canvas,...
void SetPath(const Browsable::RElementPath_t &path)
const Browsable::RElementPath_t & GetPath() const
RBrowser * GetBrowser() const
Browsable::RElementPath_t fPath
! path of drawn element
virtual std::string GetTitle()
virtual std::string GetUrl()=0
RBrowserWidget(const std::string &name)
std::string fName
! widget name
virtual void Show(const std::string &)=0
virtual std::string GetKind() const =0
virtual void SetActive()
virtual std::string SendWidgetContent()
const std::string & GetName() const
virtual void ResetConn()
virtual ~RBrowserWidget()=default
virtual void CheckModified()
std::string SendWidgetTitle()
Returns string which can be send to browser client to set/change title of the widget tab.
virtual bool DrawElement(std::shared_ptr< Browsable::RElement > &, const std::string &="")
Web-based ROOT files and objects browser.
Definition RBrowser.hxx:27
std::vector< std::string > RElementPath_t
Definition RElement.hxx:20
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...