Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:49

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