Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/ROOT/RBrowser.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Authors: Bertrand Bellenot <bertrand.bellenot@cern.ch> Sergey Linev <S.Linev@gsi.de>
0002 // Date: 2019-02-28
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT7_RBrowser
0013 #define ROOT7_RBrowser
0014 
0015 #include <ROOT/RWebWindow.hxx>
0016 #include <ROOT/RBrowserData.hxx>
0017 
0018 #include <vector>
0019 #include <memory>
0020 
0021 namespace ROOT {
0022 
0023 class RBrowserWidget;
0024 class RBrowserTimer;
0025 
0026 class RBrowser {
0027 
0028    friend class RBrowserTimer;
0029 
0030 protected:
0031 
0032    std::string fTitle;  ///<! title
0033    unsigned fConnId{0}; ///<! default connection id
0034 
0035    bool fUseRCanvas{false};              ///<!  which canvas should be used
0036    bool fCatchWindowShow{true};          ///<! if arbitrary RWebWindow::Show calls should be catched by browser
0037    std::string fActiveWidgetName;        ///<! name of active widget
0038    std::vector<std::shared_ptr<RBrowserWidget>> fWidgets; ///<!  all browser widgets
0039    int fWidgetCnt{0};                                     ///<! counter for created widgets
0040    std::string fPromptFileOutput;        ///<! file name for prompt output
0041    float fLastProgressSend{0};           ///<! last value of send progress
0042    long long fLastProgressSendTm{0};      ///<! time when last progress message was send
0043 
0044    std::shared_ptr<RWebWindow> fWebWindow;   ///<! web window to browser
0045 
0046    RBrowserData  fBrowsable;                 ///<! central browsing element
0047    std::unique_ptr<RBrowserTimer>    fTimer; ///<!  timer to handle postponed requests
0048    std::vector<std::vector<std::string>> fPostponed; ///<! postponed messages, handled in timer
0049 
0050    std::shared_ptr<RBrowserWidget> AddWidget(const std::string &kind);
0051    std::shared_ptr<RBrowserWidget> AddCatchedWidget(RWebWindow *win, const std::string &kind);
0052    std::shared_ptr<RBrowserWidget> FindWidget(const std::string &name, const std::string &kind = "") const;
0053    std::shared_ptr<RBrowserWidget> GetActiveWidget() const { return FindWidget(fActiveWidgetName); }
0054 
0055    void CloseTab(const std::string &name);
0056 
0057    std::string ProcessBrowserRequest(const std::string &msg);
0058    std::string ProcessDblClick(unsigned connid, std::vector<std::string> &args);
0059    std::string ProcessDrop(unsigned connid, std::vector<std::string> &args);
0060    std::string NewWidgetMsg(std::shared_ptr<RBrowserWidget> &widget);
0061    void ProcessRunMacro(const std::string &file_path);
0062    void ProcessSaveFile(const std::string &fname, const std::string &content);
0063    std::string GetCurrentWorkingDirectory();
0064 
0065    std::vector<std::string> GetRootHistory();
0066    std::vector<std::string> GetRootLogs();
0067 
0068    void SendInitMsg(unsigned connid);
0069    void ProcessMsg(unsigned connid, const std::string &arg);
0070    void SendProgress(unsigned connid, float progr);
0071 
0072    void AddInitWidget(const std::string &kind);
0073 
0074    void CheckWidgtesModified(unsigned connid);
0075 
0076    void ProcessPostponedRequests();
0077 
0078 public:
0079    RBrowser(bool use_rcanvas = false);
0080    virtual ~RBrowser();
0081 
0082    bool GetUseRCanvas() const { return fUseRCanvas; }
0083    void SetUseRCanvas(bool on = true) { fUseRCanvas = on; }
0084 
0085    void AddTCanvas() { AddInitWidget("tcanvas"); }
0086    void AddRCanvas() { AddInitWidget("rcanvas"); }
0087 
0088    void Show(const RWebDisplayArgs &args = "", bool always_start_new_browser = false);
0089 
0090    void Hide();
0091 
0092    void Sync();
0093 
0094    std::string GetWindowUrl(bool remote);
0095 
0096    void SetWorkingPath(const std::string &path);
0097 
0098    /// Enable/disable catch of RWebWindow::Show calls to embed created widgets, default on
0099    void SetCatchWindowShow(bool on = true) { fCatchWindowShow = on; }
0100 
0101    /// Is RWebWindow::Show calls catched for embeding of created widgets
0102    bool GetCatchWindowShow() const { return fCatchWindowShow; }
0103 
0104    bool ActivateWidget(const std::string &title, const std::string &kind = "");
0105 
0106    void ClearOnClose(const std::shared_ptr<void> &handle);
0107 
0108 };
0109 
0110 } // namespace ROOT
0111 
0112 #endif