Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // @(#)root/gui:$Id: 7cf312b9bc9940a03d7c0cee95eea0085dc9898c $
0002 // Author: Bertrand Bellenot   26/09/2007
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 ROOT_TRootBrowser
0013 #define ROOT_TRootBrowser
0014 
0015 #include "TGFrame.h"
0016 
0017 #include "TBrowserImp.h"
0018 
0019 class TGLayoutHints;
0020 class TGTab;
0021 class TGMenuBar;
0022 class TGPopupMenu;
0023 class TGStatusBar;
0024 class TGVSplitter;
0025 class TGHSplitter;
0026 
0027 
0028 /** \class TBrowserPlugin
0029     \ingroup guiwidgets
0030 
0031 Helper class used to manage plugins (command or macro to be executed).
0032 */
0033 
0034 
0035 class TBrowserPlugin : public TNamed
0036 {
0037 public:
0038    Int_t    fTab{0};             ///< Tab number
0039    Int_t    fSubTab{0};          ///< Tab element number
0040    TString  fCommand;            ///< Command to be executed
0041 
0042    TBrowserPlugin(const char *name, const char *cmd = "", Int_t tab = 1,
0043                   Int_t sub = -1) : TNamed(name, cmd), fTab(tab),
0044       fSubTab(sub), fCommand(cmd) { }
0045    ~TBrowserPlugin() override {}
0046 
0047    void     SetTab(Int_t tab) { fTab = tab; }
0048    void     SetSubTab(Int_t sub) { fSubTab = sub; }
0049    void     SetCommand(const char *cmd) { fCommand = cmd; }
0050 
0051    ClassDefOverride(TBrowserPlugin, 0)  // basic plugin description class
0052 };
0053 
0054 class TRootBrowser : public TGMainFrame, public TBrowserImp {
0055    TRootBrowser(const TRootBrowser&) = delete;
0056    TRootBrowser& operator=(const TRootBrowser&) = delete;
0057 
0058 protected:
0059 
0060    TGLayoutHints     *fLH0, *fLH1, *fLH2, *fLH3;   ///< Layout hints, part 1
0061    TGLayoutHints     *fLH4, *fLH5, *fLH6, *fLH7;   ///< Layout hints, part 2
0062    TGTab             *fTabLeft;                    ///< Left Tab
0063    TGTab             *fTabRight;                   ///< Right Tab
0064    TGTab             *fTabBottom;                  ///< Bottom Tab
0065    TGTab             *fEditTab;                    ///< Tab in "Edit" mode
0066    Int_t              fEditPos;                    ///< Id of tab in "Edit" mode
0067    Int_t              fEditSubPos;                 ///< Id of subtab in "Edit" mode
0068    TGVerticalFrame   *fVf;                         ///< Vertical frame
0069    TGHorizontalFrame *fHf;                         ///< Horizontal frame
0070    TGHorizontalFrame *fH1;                         ///< Horizontal frame
0071    TGHorizontalFrame *fH2;                         ///< Horizontal frame
0072    TGVerticalFrame   *fV1;                         ///< Vertical frame
0073    TGVerticalFrame   *fV2;                         ///< Vertical frame
0074    TGVSplitter       *fVSplitter;                  ///< Vertical splitter
0075    TGHSplitter       *fHSplitter;                  ///< Horizontal splitter
0076    TGCompositeFrame  *fEditFrame;                  ///< Frame in "Edit" mode
0077    TGHorizontalFrame *fTopMenuFrame;               ///< Top menu frame
0078    TGHorizontalFrame *fPreMenuFrame;               ///< First (owned) menu frame
0079    TGHorizontalFrame *fMenuFrame;                  ///< Shared menu frame
0080    TGHorizontalFrame *fToolbarFrame;               ///< Toolbar frame
0081    TGMenuBar         *fMenuBar;                    ///< Main (owned) menu bar
0082    TGPopupMenu       *fMenuFile;                   ///< "File" popup menu
0083    TGPopupMenu       *fMenuExecPlugin;             ///< "Exec Plugin" popup menu
0084    TGPopupMenu       *fMenuHelp;                   ///< "Browser Help" popup menu
0085    TGCompositeFrame  *fActMenuBar;                 ///< Actual (active) menu bar
0086    TBrowserImp       *fActBrowser;                 ///< Actual (active) browser imp
0087    TList              fBrowsers;                   ///< List of (sub)browsers
0088    TList              fPlugins;                    ///< List of plugins
0089    TGStatusBar       *fStatusBar;                  ///< Status bar
0090    Int_t              fNbInitPlugins;              ///< Number of initial plugins (from .rootrc)
0091    Int_t              fNbTab[3];                   ///< Number of tab elements (for each Tab)
0092    Int_t              fCrTab[3];                   ///< Actual (active) tab elements (for each Tab)
0093    Int_t              fPid;                        ///< Current process id
0094    Bool_t             fShowCloseTab;               ///< kTRUE to show close icon on tab elements
0095    const TGPicture   *fIconPic;                    ///< icon picture
0096 
0097 public:
0098    enum ENewBrowserMessages {
0099       kBrowse = 11011,
0100       kOpenFile,
0101       kClone,
0102       kHelpAbout,
0103       kHelpOnBrowser,
0104       kHelpOnCanvas,
0105       kHelpOnMenus,
0106       kHelpOnGraphicsEd,
0107       kHelpOnObjects,
0108       kHelpOnPS,
0109       kHelpOnRemote,
0110       kNewEditor,
0111       kNewCanvas,
0112       kNewHtml,
0113       kExecPluginMacro,
0114       kExecPluginCmd,
0115       kCloseTab,
0116       kCloseWindow,
0117       kQuitRoot
0118    };
0119 
0120    enum EInsertPosition {
0121       kLeft, kRight, kBottom
0122    };
0123 
0124    TRootBrowser(TBrowser *b = nullptr, const char *name = "ROOT Browser", UInt_t width = 800, UInt_t height = 500, Option_t *opt = "", Bool_t initshow = kTRUE);
0125    TRootBrowser(TBrowser *b, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height, Option_t *opt = "", Bool_t initshow = kTRUE);
0126    ~TRootBrowser() override;
0127 
0128    void              InitPlugins(Option_t *opt="");
0129 
0130    void              CreateBrowser(const char *name);
0131    void              CloneBrowser();
0132    void              CloseWindow() override;
0133    virtual void      CloseTab(Int_t id);
0134    void              CloseTabs() override;
0135    void              DoTab(Int_t id);
0136    void              EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected);
0137    TGFrame          *GetActFrame() const { return (TGFrame *)fEditFrame; }
0138    TGFrame          *GetToolbarFrame() const { return (TGFrame *)fToolbarFrame; }
0139    TGStatusBar      *GetStatusBar() const { return fStatusBar; }
0140    TGTab            *GetTabLeft() const { return fTabLeft; }
0141    TGTab            *GetTabRight() const { return fTabRight; }
0142    TGTab            *GetTabBottom() const { return fTabBottom; }
0143    TGTab            *GetTab(Int_t pos) const;
0144    void              SetTab(Int_t pos = kRight, Int_t subpos = -1);
0145    void              SetTabTitle(const char *title, Int_t pos = kRight, Int_t subpos = -1);
0146    void              HandleMenu(Int_t id);
0147    void              RecursiveReparent(TGPopupMenu *popup);
0148    void              RemoveTab(Int_t pos, Int_t subpos);
0149    TBrowserImp      *GetActBrowser() const { return fActBrowser; }
0150    void              SetActBrowser(TBrowserImp *b) { fActBrowser = b; }
0151    void              ShowMenu(TGCompositeFrame *menu);
0152    void              StartEmbedding(Int_t pos = kRight, Int_t subpos = -1) override;
0153    void              StopEmbedding(const char *name = nullptr) override { StopEmbedding(name, nullptr); }
0154    void              StopEmbedding(const char *name, TGLayoutHints *layout);
0155    void              SwitchMenus(TGCompositeFrame *from);
0156 
0157    void              BrowseObj(TObject *obj) override;             //*SIGNAL*
0158    void              ExecuteDefaultAction(TObject *obj) override;  //*SIGNAL*
0159    virtual void      DoubleClicked(TObject *obj);         //*SIGNAL*
0160    virtual void      Checked(TObject *obj, Bool_t check); //*SIGNAL*
0161 
0162    void              Add(TObject *obj, const char *name = nullptr, Int_t check = -1) override;
0163    void              RecursiveRemove(TObject *obj) override;
0164    void              Refresh(Bool_t force = kFALSE) override;
0165    void              Show() override { MapRaised(); }
0166    Option_t         *GetDrawOption() const override;
0167    TGMainFrame      *GetMainFrame() const override { return (TGMainFrame *)this; }
0168 
0169    Longptr_t         ExecPlugin(const char *name = nullptr, const char *fname = nullptr,
0170                                 const char *cmd = nullptr, Int_t pos = kRight,
0171                                 Int_t subpos = -1) override;
0172    void              SetStatusText(const char *txt, Int_t col) override;
0173    Bool_t            HandleKey(Event_t *event) override;
0174 
0175    virtual void      ShowCloseTab(Bool_t show) { fShowCloseTab = show; }
0176    virtual Bool_t    IsCloseTabShown() const { return fShowCloseTab; }
0177    Bool_t            IsWebGUI();
0178 
0179    // overridden from TGMainFrame
0180    void              ReallyDelete() override;
0181 
0182    static TBrowserImp *NewBrowser(TBrowser *b = nullptr, const char *title = "ROOT Browser", UInt_t width = 800, UInt_t height = 500, Option_t *opt = "");
0183    static TBrowserImp *NewBrowser(TBrowser *b, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height, Option_t *opt = "");
0184 
0185    ClassDefOverride(TRootBrowser, 0) // New ROOT Browser
0186 };
0187 
0188 #endif