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 {
23namespace Experimental {
24
25class RBrowser;
26
27/** \class ROOT::Experimental::RBrowserWidget
28\ingroup rbrowser
29Abstract Web-based widget, which can be used in the RBrowser
30Used to embed canvas, geometry viewer and potentially any other widgets
31*/
32
34
35 friend class RBrowser;
36
37 std::string fName; ///<! widget name
38
39 Browsable::RElementPath_t fPath; ///<! path of drawn element
40
41 RBrowser *fBrowser{nullptr};
42
43public:
44
45 explicit RBrowserWidget(const std::string &name) : fName(name) {};
46 virtual ~RBrowserWidget() = default;
47
48 RBrowser *GetBrowser() const { return fBrowser; }
49
50 virtual void Show(const std::string &) = 0;
51
52 virtual void ResetConn() {}
53
54 virtual void SetActive() {}
55
56 void SetPath(const Browsable::RElementPath_t &path) { fPath = path; }
57 const Browsable::RElementPath_t &GetPath() const { return fPath; }
58
59 const std::string &GetName() const { return fName; }
60 virtual std::string GetKind() const = 0;
61 virtual std::string GetUrl() = 0;
62 virtual std::string GetTitle() { return ""; }
63
64 virtual bool DrawElement(std::shared_ptr<Browsable::RElement> &, const std::string & = "") { return false; }
65 virtual std::string SendWidgetContent() { return ""; }
66 std::string SendWidgetTitle();
67
68 virtual void CheckModified() {}
69};
70
72protected:
73 using ProvidersMap_t = std::map<std::string, RBrowserWidgetProvider*>;
74
75 virtual std::shared_ptr<RBrowserWidget> Create(const std::string &) = 0;
76
77 virtual std::shared_ptr<RBrowserWidget> CreateFor(const std::string &, std::shared_ptr<Browsable::RElement> &) { return nullptr; }
78
79 static ProvidersMap_t& GetMap();
80
81public:
82
83 explicit RBrowserWidgetProvider(const std::string &kind);
85
86 static std::shared_ptr<RBrowserWidget> CreateWidget(const std::string &kind, const std::string &name);
87
88 static std::shared_ptr<RBrowserWidget> CreateWidgetFor(const std::string &kind, const std::string &name, std::shared_ptr<Browsable::RElement> &element);
89};
90
91
92} // namespace Experimental
93} // namespace ROOT
94
95#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 > &)
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 std::shared_ptr< RBrowserWidget > Create(const std::string &)=0
Abstract Web-based widget, which can be used in the RBrowser Used to embed canvas,...
const std::string & GetName() const
Browsable::RElementPath_t fPath
! path of drawn element
virtual std::string GetUrl()=0
RBrowserWidget(const std::string &name)
virtual bool DrawElement(std::shared_ptr< Browsable::RElement > &, const std::string &="")
virtual void Show(const std::string &)=0
const Browsable::RElementPath_t & GetPath() const
void SetPath(const Browsable::RElementPath_t &path)
virtual std::string GetKind() const =0
std::string SendWidgetTitle()
Returns string which can be send to browser client to set/change title of the widget tab.
virtual std::string SendWidgetContent()
Web-based ROOT files and objects browser.
Definition RBrowser.hxx:27
std::vector< std::string > RElementPath_t
Definition RElement.hxx:21
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.