Logo ROOT   6.14/05
Reference Guide
TVirtualCanvasPainter.hxx
Go to the documentation of this file.
1 /// \file ROOT/TVirtualCanvasPainter.hxx
2 /// \ingroup Gpad ROOT7
3 /// \author Axel Naumann <axel@cern.ch>
4 /// \date 2017-05-31
5 /// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6 /// is welcome!
7 
8 /*************************************************************************
9  * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. *
10  * All rights reserved. *
11  * *
12  * For the licensing terms see $ROOTSYS/LICENSE. *
13  * For the list of contributors see $ROOTSYS/README/CREDITS. *
14  *************************************************************************/
15 
16 #ifndef ROOT7_TVirtualCanvasPainter
17 #define ROOT7_TVirtualCanvasPainter
18 
19 #include "ROOT/TPadPainter.hxx"
20 
21 #include <memory>
22 #include <functional>
23 
24 namespace ROOT {
25 namespace Experimental {
26 
27 using CanvasCallback_t = std::function<void(bool)>;
28 
29 class TCanvas;
30 class TWebWindow;
31 
32 namespace Internal {
33 
34 /** \class ROOT::Experimental::Internal::TVirtualCanvasPainter
35  Abstract interface for painting a canvas.
36  */
37 
39 protected:
40  class Generator {
41  public:
42  /// Abstract interface to create a TVirtualCanvasPainter implementation.
43  virtual std::unique_ptr<TVirtualCanvasPainter> Create(const TCanvas &canv) const = 0;
44  /// Default destructor.
45  virtual ~Generator();
46  };
47 
48  /// generator getter
49  static std::unique_ptr<Generator> &GetGenerator();
50 
51 public:
52  /// Default destructor.
53  virtual ~TVirtualCanvasPainter();
54 
55  /// indicate that canvas changed, provides current version of the canvas
56  virtual void CanvasUpdated(uint64_t, bool, CanvasCallback_t) = 0;
57 
58  /// return true if canvas modified since last painting
59  virtual bool IsCanvasModified(uint64_t) const = 0;
60 
61  /// perform special action when drawing is ready
62  virtual void DoWhenReady(const std::string &, const std::string &, bool, CanvasCallback_t) = 0;
63 
64  virtual void NewDisplay(const std::string &where) = 0;
65 
66  virtual int NumDisplays() const = 0;
67 
68  virtual bool AddPanel(std::shared_ptr<TWebWindow>) { return false; }
69 
70  /// Loads the plugin that implements this class.
71  static std::unique_ptr<TVirtualCanvasPainter> Create(const TCanvas &canv);
72 };
73 } // namespace Internal
74 } // namespace Experimental
75 } // namespace ROOT
76 
77 #endif // ROOT7_TVirtualCanvasPainter
virtual std::unique_ptr< TVirtualCanvasPainter > Create(const TCanvas &canv) const =0
Abstract interface to create a TVirtualCanvasPainter implementation.
virtual bool IsCanvasModified(uint64_t) const =0
return true if canvas modified since last painting
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
A window&#39;s topmost TPad.
Definition: TCanvas.hxx:33
virtual void DoWhenReady(const std::string &, const std::string &, bool, CanvasCallback_t)=0
perform special action when drawing is ready
virtual ~TVirtualCanvasPainter()
Default destructor.
static std::unique_ptr< Generator > & GetGenerator()
generator getter
virtual void NewDisplay(const std::string &where)=0
Abstract interface for painting a canvas.
Abstract interface for object painting on the pad/canvas.
Definition: TPadPainter.hxx:37
virtual bool AddPanel(std::shared_ptr< TWebWindow >)
virtual void CanvasUpdated(uint64_t, bool, CanvasCallback_t)=0
indicate that canvas changed, provides current version of the canvas
std::function< void(bool)> CanvasCallback_t