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
25/** \class ROOT::Experimental::RBrowserWidget
26\ingroup rbrowser
27Abstract Web-based widget, which can be used in the RBrowser
28Used to embed canvas, geometry viewer and potentially any other widgets
29*/
30
32
33 std::string fName; ///<! widget name
34
35 Browsable::RElementPath_t fPath; ///<! path of drawn element
36
37public:
38
39 explicit RBrowserWidget(const std::string &name) : fName(name) {};
40 virtual ~RBrowserWidget() = default;
41
42 virtual void Show(const std::string &) = 0;
43
44 virtual void ResetConn() {}
45
46 virtual void SetActive() {}
47
48 void SetPath(const Browsable::RElementPath_t &path) { fPath = path; }
49 const Browsable::RElementPath_t &GetPath() const { return fPath; }
50
51 const std::string &GetName() const { return fName; }
52 virtual std::string GetKind() const = 0;
53 virtual std::string GetUrl() = 0;
54 virtual std::string GetTitle() { return ""; }
55
56 virtual bool DrawElement(std::shared_ptr<Browsable::RElement> &, const std::string &) { return false; }
57 virtual std::string SendWidgetContent() { return ""; }
58
59 virtual void CheckModified() {}
60};
61
63protected:
64 using ProvidersMap_t = std::map<std::string, RBrowserWidgetProvider*>;
65
66 virtual std::shared_ptr<RBrowserWidget> Create(const std::string &) = 0;
67
68 virtual std::shared_ptr<RBrowserWidget> CreateFor(const std::string &, std::shared_ptr<Browsable::RElement> &) { return nullptr; }
69
70 static ProvidersMap_t& GetMap();
71
72public:
73
74 explicit RBrowserWidgetProvider(const std::string &kind);
76
77 static std::shared_ptr<RBrowserWidget> CreateWidget(const std::string &kind, const std::string &name);
78
79 static std::shared_ptr<RBrowserWidget> CreateWidgetFor(const std::string &kind, const std::string &name, std::shared_ptr<Browsable::RElement> &element);
80};
81
82
83} // namespace Experimental
84} // namespace ROOT
85
86#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.
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 bool DrawElement(std::shared_ptr< Browsable::RElement > &, const std::string &)
virtual std::string GetUrl()=0
RBrowserWidget(const std::string &name)
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
virtual std::string SendWidgetContent()
std::vector< std::string > RElementPath_t
Definition RElement.hxx:21
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...