Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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#include <ROOT/RWebWindow.hxx>
22
23namespace ROOT {
24
25class RBrowser;
26
27/** \class ROOT::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 std::shared_ptr<RWebWindow> GetWindow() { return nullptr; }
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() { return ""; }
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 virtual bool IsValid() { return true; }
71};
72
74protected:
75 using ProvidersMap_t = std::map<std::string, RBrowserWidgetProvider*>;
76
77 virtual std::shared_ptr<RBrowserWidget> Create(const std::string &) = 0;
78
79 virtual std::shared_ptr<RBrowserWidget> CreateFor(const std::string &, std::shared_ptr<Browsable::RElement> &) { return nullptr; }
80
81 virtual std::shared_ptr<RBrowserWidget> DetectWindow(RWebWindow &) { return nullptr; }
82
83 static RBrowserWidgetProvider *GetProvider(const std::string &kind);
84
85 static ProvidersMap_t& GetMap();
86
87public:
88
89 explicit RBrowserWidgetProvider(const std::string &kind);
91
92 static std::shared_ptr<RBrowserWidget> CreateWidget(const std::string &kind, const std::string &name);
93
94 static std::shared_ptr<RBrowserWidget> CreateWidgetFor(const std::string &kind, const std::string &name, std::shared_ptr<Browsable::RElement> &element);
95
96 static std::shared_ptr<RBrowserWidget> DetectCatchedWindow(const std::string &kind, RWebWindow &win);
97};
98
99} // namespace ROOT
100
101#endif
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t win
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 RBrowserWidgetProvider * GetProvider(const std::string &kind)
Returns provider for specified kind.
static std::shared_ptr< RBrowserWidget > DetectCatchedWindow(const std::string &kind, RWebWindow &win)
Check if catch window can be identified and normal widget can be created Used for TCanvas created in ...
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.
virtual std::shared_ptr< RBrowserWidget > DetectWindow(RWebWindow &)
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.
RBrowserWidgetProvider(const std::string &kind)
Constructor.
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
virtual std::string GetUrl()
Browsable::RElementPath_t fPath
! path of drawn element
virtual std::string GetTitle()
RBrowserWidget(const std::string &name)
std::string fName
! widget name
virtual std::string GetKind() const =0
virtual void SetActive()
virtual std::string SendWidgetContent()
const std::string & GetName() const
virtual void ResetConn()
virtual std::shared_ptr< RWebWindow > GetWindow()
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
Represents web window, which can be shown in web browser or any other supported environment.
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...