Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-05 09:08:10

0001 /*************************************************************************
0002  * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers.               *
0003  * All rights reserved.                                                  *
0004  *                                                                       *
0005  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0006  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0007  *************************************************************************/
0008 
0009 #ifndef ROOT7_RVirtualCanvasPainter
0010 #define ROOT7_RVirtualCanvasPainter
0011 
0012 #include <cstdint>
0013 #include <memory>
0014 #include <functional>
0015 #include <string>
0016 
0017 namespace ROOT {
0018 
0019 class RWebWindow;
0020 
0021 namespace Experimental {
0022 
0023 using CanvasCallback_t = std::function<void(bool)>;
0024 
0025 class RCanvas;
0026 
0027 namespace Internal {
0028 
0029 /** \class ROOT::Experimental::Internal::RVirtualCanvasPainter
0030 \ingroup GpadROOT7
0031 \brief Abstract interface for painting a canvas.
0032 \author Axel Naumann <axel@cern.ch>
0033 \date 2017-05-31
0034 \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
0035 */
0036 
0037 class RVirtualCanvasPainter {
0038 protected:
0039    class Generator {
0040    public:
0041       /// Abstract interface to create a RVirtualCanvasPainter implementation.
0042       virtual std::unique_ptr<RVirtualCanvasPainter> Create(RCanvas &canv) const = 0;
0043       /// Default destructor.
0044       virtual ~Generator();
0045    };
0046 
0047    /// generator getter
0048    static std::unique_ptr<Generator> &GetGenerator();
0049 
0050 public:
0051    /// Default destructor.
0052    virtual ~RVirtualCanvasPainter();
0053 
0054    /// indicate that canvas changed, provides current version of the canvas
0055    virtual void CanvasUpdated(uint64_t, bool, CanvasCallback_t) = 0;
0056 
0057    /// return true if canvas modified since last painting
0058    virtual bool IsCanvasModified(uint64_t) const = 0;
0059 
0060    /// perform special action when drawing is ready
0061    virtual void DoWhenReady(const std::string &, const std::string &, bool, CanvasCallback_t) = 0;
0062 
0063    /// produce file output in batch mode like png, jpeg, svg or pdf
0064    virtual bool ProduceBatchOutput(const std::string &, int, int) = 0;
0065 
0066    /// produce canvas JSON
0067    virtual std::string ProduceJSON() = 0;
0068 
0069    virtual void NewDisplay(const std::string &where) = 0;
0070 
0071    virtual int NumDisplays() const = 0;
0072 
0073    virtual std::string GetWindowAddr() const = 0;
0074 
0075    virtual std::string GetWindowUrl(bool remote) = 0;
0076 
0077    /// run canvas functionality in caller thread, not needed when main thread is used
0078    virtual void Run(double tm = 0.) = 0;
0079 
0080    virtual bool AddPanel(std::shared_ptr<ROOT::RWebWindow>) { return false; }
0081 
0082    virtual void SetClearOnClose(const std::shared_ptr<void> &) {}
0083 
0084    /// Loads the plugin that implements this class.
0085    static std::unique_ptr<RVirtualCanvasPainter> Create(RCanvas &canv);
0086 };
0087 } // namespace Internal
0088 } // namespace Experimental
0089 } // namespace ROOT
0090 
0091 #endif // ROOT7_RVirtualCanvasPainter