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
4/*************************************************************************
5 * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT7_RBrowserWidget
13#define ROOT7_RBrowserWidget
14
15#include <memory>
16#include <map>
17#include <string>
18
20#include <ROOT/RWebWindow.hxx>
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 std::shared_ptr<RWebWindow> GetWindow() { return nullptr; }
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() { return ""; }
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 virtual std::shared_ptr<RBrowserWidget> DetectWindow(RWebWindow &) { return nullptr; }
81
82 static RBrowserWidgetProvider *GetProvider(const std::string &kind);
83
84 static ProvidersMap_t& GetMap();
85
86public:
87
88 explicit RBrowserWidgetProvider(const std::string &kind);
90
91 static std::shared_ptr<RBrowserWidget> CreateWidget(const std::string &kind, const std::string &name);
92
93 static std::shared_ptr<RBrowserWidget> CreateWidgetFor(const std::string &kind, const std::string &name, std::shared_ptr<Browsable::RElement> &element);
94
95 static std::shared_ptr<RBrowserWidget> DetectCatchedWindow(const std::string &kind, RWebWindow &win);
96};
97
98} // namespace ROOT
99
100#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:148
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:26
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