ROOT  6.06/09
Reference Guide
TCanvas.h
Go to the documentation of this file.
1 /// \file TCanvas.h
2 /// \ingroup Gpad ROOT7
3 /// \author Axel Naumann <axel@cern.ch>
4 /// \date 2015-07-08
5 /// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
6 
7 /*************************************************************************
8  * Copyright (C) 1995-2015, Rene Brun and Fons Rademakers. *
9  * All rights reserved. *
10  * *
11  * For the licensing terms see $ROOTSYS/LICENSE. *
12  * For the list of contributors see $ROOTSYS/README/CREDITS. *
13  *************************************************************************/
14 
15 #ifndef ROOT7_TCanvas
16 #define ROOT7_TCanvas
17 
18 #include <experimental/string_view>
19 #include <vector>
20 
21 #include "ROOT/TCoopPtr.h"
22 #include "ROOT/TDrawable.h"
23 
24 namespace ROOT {
25 
26 /** \class TCanvas
27  Graphic container for `TDrawable`-s.
28  */
29 
30 class TCanvas {
31  std::vector<std::unique_ptr<Internal::TDrawable>> fPrimitives;
32 
33  /// We need to keep track of canvases; please use Create()
34  TCanvas() = default;
35 
36 public:
37  static TCoopPtr<TCanvas> Create();
39 
40  /// Add a something to be painted. The pad claims shared ownership.
41  template <class T>
43  // Requires GetDrawable(what, options) to be known!
44  fPrimitives.emplace_back(GetDrawable(what));
45  }
46 
47  /// Add a something to be painted, with options. The pad claims shared ownership.
48  template <class T, class OPTIONS>
49  void Draw(TCoopPtr<T> what, const OPTIONS& options) {
50  // Requires GetDrawable(what, options) to be known!
51  fPrimitives.emplace_back(GetDrawable(what, options));
52  }
53 
54  void Paint();
55 
56  static const std::vector<TCoopPtr<TCanvas>>& GetCanvases();
57 };
58 
59 }
60 
61 #endif
std::unique_ptr< Internal::TDrawable > GetDrawable(TCoopPtr< THist< DIMENSION, PRECISION >> hist, THistDrawOptions< DIMENSION > opts={})
Definition: THist.h:348
void Paint()
Definition: TCanvas.cxx:20
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
static TCoopPtr< TCanvas > Create()
static const std::vector< TCoopPtr< TCanvas > > & GetCanvases()
Definition: TCanvas.cxx:35
void Draw(TCoopPtr< T > what, const OPTIONS &options)
Add a something to be painted, with options. The pad claims shared ownership.
Definition: TCanvas.h:49
std::vector< std::unique_ptr< Internal::TDrawable > > fPrimitives
Definition: TCanvas.h:31
basic_string_view< char > string_view
static const char * what
Definition: stlLoader.cc:6
void Draw(TCoopPtr< T > what)
Add a something to be painted. The pad claims shared ownership.
Definition: TCanvas.h:42
#define name(a, b)
Definition: linkTestLib0.cpp:5
Graphic container for TDrawable-s.
Definition: TCanvas.h:30
TCanvas()=default
We need to keep track of canvases; please use Create()
Several pointers point to the same object, any of them can delete the object, setting all of them to ...
Definition: TCoopPtr.h:46