27 namespace Experimental {
40 std::array<TPadLength::Pixel, 2>
fSize;
50 std::unique_ptr<Internal::TVirtualCanvasPainter>
fPainter;
61 static std::shared_ptr<TCanvas>
Create(
const std::string &title);
74 const std::array<TPadLength::Pixel, 2> &
GetSize()
const {
return fSize; }
77 void SetSize(
const std::array<TPadLength::Pixel, 2> &sz) { fSize = sz; }
87 void Show(
const std::string &where =
"");
93 template <
class PANEL>
95 if (!fPainter)
return false;
96 return fPainter->AddPanel(panel->GetWindow());
115 void SetTitle(
const std::string &title) { fTitle = title; }
118 std::array<TPadLength::Normal, 2>
PixelsToNormal(
const std::array<TPadLength::Pixel, 2> &pos)
const final 120 return {{pos[0] / fSize[0], pos[1] / fSize[1]}};
123 static const std::vector<std::shared_ptr<TCanvas>> &
GetCanvases();
Namespace for new ROOT classes and functions.
std::string fTitle
use for ID generation
std::string GenerateUniqueId()
Generates unique ID inside the canvas.
image html pict1_TGaxis_012 png width
Define new text attributes for the label number "labNum".
A window's topmost TPad.
uint64_t fModified
Modify counter, incremented every time canvas is changed.
const std::string & GetTitle() const
Get the canvas's title.
TCanvas & operator=(const TCanvas &)=delete
Disable assignment for now.
std::array< TPadLength::Normal, 2 > PixelsToNormal(const std::array< TPadLength::Pixel, 2 > &pos) const final
Convert a Pixel position to Canvas-normalized positions.
uint64_t fIdCounter
counter for objects, id==1 is canvas itself
std::unique_ptr< Internal::TVirtualCanvasPainter > fPainter
The painter of this canvas, bootstrapping the graphics connection.
TCanvas * GetCanvas() override
Access to the top-most canvas, if any (non-const version).
void Update(bool async=false, CanvasCallback_t callback=nullptr)
update drawing
Base class for graphic containers for TDrawable-s.
const std::array< TPadLength::Pixel, 2 > & GetSize() const
Return canvas pixel size as array with two elements - width and height.
void Hide()
Close all canvas displays.
TCanvas()=default
Create a temporary TCanvas; for long-lived ones please use Create().
bool IsModified() const
Returns true is canvas was modified since last painting.
bool AddPanel(std::shared_ptr< PANEL > &panel)
Insert panel into the canvas, canvas should be shown at this moment.
std::array< TPadLength::Pixel, 2 > fSize
Size of the canvas in pixels,.
void SetSize(const std::array< TPadLength::Pixel, 2 > &sz)
Set canvas pixel size as array with two elements - width and height.
void SetSize(const TPadLength::Pixel &width, const TPadLength::Pixel &height)
Set canvas pixel size - width and height.
void SaveAs(const std::string &filename, bool async=false, CanvasCallback_t callback=nullptr)
Save canvas in image file.
std::function< void(bool)> CanvasCallback_t
void Show(const std::string &where="")
Display the canvas.
const TCanvas * GetCanvas() const override
Access to the top-most canvas, if any (const version).
static std::shared_ptr< TCanvas > Create(const std::string &title)
A pixel coordinate: 0 in the left, bottom corner, 1 in the top, right corner of the TPad...
void SetTitle(const std::string &title)
Set the canvas's title.
static const std::vector< std::shared_ptr< TCanvas > > & GetCanvases()