18 #include <experimental/string_view> 26 namespace Experimental {
29 class TCanvasSharedPtrMaker;
30 class TV5CanvasAdaptor;
40 using Primitives_t = std::vector<std::unique_ptr<Internal::TDrawable>>;
50 std::unique_ptr<Internal::TV5CanvasAdaptor>
fAdaptor;
59 static std::shared_ptr<TCanvas> Create(
const std::string& title);
73 void Draw(
const std::shared_ptr<T>& what) {
80 template<
class T,
class OPTIONS>
81 void Draw(
const std::shared_ptr<T>& what,
const OPTIONS &options) {
83 fPrimitives.emplace_back(
GetDrawable(what, options));
88 void Draw(std::unique_ptr<T>&& what) {
90 fPrimitives.emplace_back(
GetDrawable(std::move(what)));
94 template<
class T,
class OPTIONS>
95 void Draw(std::unique_ptr<T>&& what,
const OPTIONS &options) {
97 fPrimitives.emplace_back(
GetDrawable(std::move(what), options));
104 fPrimitives.emplace_back(
GetDrawable(std::make_unique<T>(what)));
108 template<
class T,
class OPTIONS>
109 void Draw(
const T& what,
const OPTIONS &options) {
111 fPrimitives.emplace_back(
GetDrawable(std::make_unique<T>(what), options));
121 const std::string&
GetTitle()
const {
return fTitle; }
124 void SetTitle(
const std::string& title) { fTitle = title; }
130 static const std::vector<std::shared_ptr<TCanvas>> &GetCanvases();
void Draw(const std::shared_ptr< T > &what, const OPTIONS &options)
Add something to be painted, with options.
void Draw(const std::shared_ptr< T > &what)
Add something to be painted.
std::vector< std::unique_ptr< Internal::TDrawable > > Primitives_t
void Draw(std::unique_ptr< T > &&what, const OPTIONS &options)
Add something to be painted, with options. The pad claims ownership.
Namespace for new ROOT classes and functions.
std::string fTitle
Title of the canvas.
Graphic container for TDrawable-s.
const std::string & GetTitle() const
Get the canvas's title.
std::unique_ptr< Internal::TV5CanvasAdaptor > fAdaptor
Adaptor for painting an old canvas.
Primitives_t fPrimitives
Content of the pad.
void Draw(const T &what)
Add a copy of something to be painted.
void Draw(std::unique_ptr< T > &&what)
Add something to be painted. The pad claims ownership.
void Draw(const T &what, const OPTIONS &options)
Add a copy of something to be painted, with options.
Binding & operator=(OUT(*fun)(void))
const Primitives_t & GetPrimitives()
Get the elements contained in the canvas.
std::unique_ptr< Internal::TDrawable > GetDrawable(const std::shared_ptr< THist< DIMENSIONS, PRECISION, STAT... >> &hist, THistDrawOptions< DIMENSIONS > opts={})
Interface to graphics taking a unique_ptr<THist>.
void SetTitle(const std::string &title)
Set the canvas's title.