Logo ROOT   6.12/07
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/TDisplayItem.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, bool batch_mode) 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  /// returns true is canvas used in batch mode
56  virtual bool IsBatchMode() const { return true; }
57 
58  /// add display item to the canvas
59  virtual void AddDisplayItem(TDisplayItem *item) = 0;
60 
61  /// indicate that canvas changed, provides current version of the canvas
62  virtual void CanvasUpdated(uint64_t, bool, CanvasCallback_t) = 0;
63 
64  /// return true if canvas modified since last painting
65  virtual bool IsCanvasModified(uint64_t) const = 0;
66 
67  /// perform special action when drawing is ready
68  virtual void DoWhenReady(const std::string &, const std::string &, bool, CanvasCallback_t) = 0;
69 
70  virtual void NewDisplay(const std::string &where) = 0;
71 
72  virtual bool AddPanel(std::shared_ptr<TWebWindow>) { return false; }
73 
74  /// Loads the plugin that implements this class.
75  static std::unique_ptr<TVirtualCanvasPainter> Create(const TCanvas &canv, bool batch_mode = false);
76 };
77 } // namespace Internal
78 } // namespace Experimental
79 } // namespace ROOT
80 
81 #endif // ROOT7_TVirtualCanvasPainter
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:39
virtual void DoWhenReady(const std::string &, const std::string &, bool, CanvasCallback_t)=0
perform special action when drawing is ready
virtual std::unique_ptr< TVirtualCanvasPainter > Create(const TCanvas &canv, bool batch_mode) const =0
Abstract interface to create a TVirtualCanvasPainter implementation.
virtual ~TVirtualCanvasPainter()
Default destructor.
static std::unique_ptr< Generator > & GetGenerator()
generator getter
virtual void NewDisplay(const std::string &where)=0
virtual void AddDisplayItem(TDisplayItem *item)=0
add display item to the canvas
Abstract interface for painting a canvas.
virtual bool AddPanel(std::shared_ptr< TWebWindow >)
virtual bool IsBatchMode() const
returns true is canvas used in batch mode
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
Base class for painting data for JS.