File indexing completed on 2025-01-30 10:22:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef ROOT7_RBrowser
0014 #define ROOT7_RBrowser
0015
0016 #include <ROOT/RWebWindow.hxx>
0017 #include <ROOT/RBrowserData.hxx>
0018
0019 #include <vector>
0020 #include <memory>
0021
0022 namespace ROOT {
0023
0024 class RBrowserWidget;
0025 class RBrowserTimer;
0026
0027 class RBrowser {
0028
0029 friend class RBrowserTimer;
0030
0031 protected:
0032
0033 std::string fTitle;
0034 unsigned fConnId{0};
0035
0036 bool fUseRCanvas{false};
0037 bool fCatchWindowShow{true};
0038 std::string fActiveWidgetName;
0039 std::vector<std::shared_ptr<RBrowserWidget>> fWidgets;
0040 int fWidgetCnt{0};
0041 std::string fPromptFileOutput;
0042 float fLastProgressSend{0};
0043 long long fLastProgressSendTm{0};
0044
0045 std::shared_ptr<RWebWindow> fWebWindow;
0046
0047 RBrowserData fBrowsable;
0048 std::unique_ptr<RBrowserTimer> fTimer;
0049 std::vector<std::vector<std::string>> fPostponed;
0050
0051 std::shared_ptr<RBrowserWidget> AddWidget(const std::string &kind);
0052 std::shared_ptr<RBrowserWidget> AddCatchedWidget(RWebWindow *win, const std::string &kind);
0053 std::shared_ptr<RBrowserWidget> FindWidget(const std::string &name, const std::string &kind = "") const;
0054 std::shared_ptr<RBrowserWidget> GetActiveWidget() const { return FindWidget(fActiveWidgetName); }
0055
0056 void CloseTab(const std::string &name);
0057
0058 std::string ProcessBrowserRequest(const std::string &msg);
0059 std::string ProcessDblClick(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();
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
0089 void Show(const RWebDisplayArgs &args = "", bool always_start_new_browser = false);
0090
0091
0092 void Hide();
0093
0094 std::string GetWindowUrl(bool remote);
0095
0096 void SetWorkingPath(const std::string &path);
0097
0098
0099 void SetCatchWindowShow(bool on = true) { fCatchWindowShow = on; }
0100
0101
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 }
0111
0112 #endif