TRootBrowser.h

Go to the documentation of this file.
00001 // @(#)root/gui:$Id: TRootBrowser.h 30884 2009-10-27 12:26:33Z rdm $
00002 // Author: Bertrand Bellenot   26/09/2007
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TRootBrowser
00013 #define ROOT_TRootBrowser
00014 
00015 #ifndef ROOT_TGFrame
00016 #include "TGFrame.h"
00017 #endif
00018 
00019 #ifndef ROOT_TBrowserImp
00020 #include "TBrowserImp.h"
00021 #endif
00022 
00023 class TGLayoutHints;
00024 class TGTab;
00025 class TGMenuBar;
00026 class TGPopupMenu;
00027 class TGStatusBar;
00028 class TGVSplitter;
00029 class TGHSplitter;
00030 
00031 //_____________________________________________________________________________
00032 //
00033 // TBrowserPlugin
00034 //
00035 // Helper class used to manage plugins (command or macro to be executed).
00036 //_____________________________________________________________________________
00037 
00038 class TBrowserPlugin : public TNamed
00039 {
00040 public:
00041    Int_t    fTab;             // Tab number
00042    Int_t    fSubTab;          // Tab element number
00043    TString  fCommand;         // Command to be executed
00044 
00045    TBrowserPlugin(const char *name, const char *cmd = "", Int_t tab = 1,
00046                   Int_t sub = -1) : TNamed(name, cmd), fTab(tab),
00047       fSubTab(sub), fCommand(cmd) { }
00048    virtual ~TBrowserPlugin() {}
00049 
00050    void     SetTab(Int_t tab) { fTab = tab; }
00051    void     SetSubTab(Int_t sub) { fSubTab = sub; }
00052    void     SetCommand(const char *cmd) { fCommand = cmd; }
00053 
00054    ClassDef(TBrowserPlugin, 0)  // basic plugin description class
00055 };
00056 
00057 class TRootBrowser : public TGMainFrame, public TBrowserImp {
00058 private:
00059    TRootBrowser(const TRootBrowser&); // Not implemented
00060    TRootBrowser& operator=(const TRootBrowser&); // Not implemented
00061 
00062 protected:
00063 
00064    TGLayoutHints     *fLH0, *fLH1, *fLH2, *fLH3;   // Layout hints, part 1
00065    TGLayoutHints     *fLH4, *fLH5, *fLH6, *fLH7;   // Layout hints, part 2
00066    TGTab             *fTabLeft;                    // Left Tab
00067    TGTab             *fTabRight;                   // Right Tab
00068    TGTab             *fTabBottom;                  // Bottom Tab
00069    TGTab             *fEditTab;                    // Tab in "Edit" mode
00070    Int_t              fEditPos;                    // Id of tab in "Edit" mode
00071    Int_t              fEditSubPos;                 // Id of subtab in "Edit" mode
00072    TGVerticalFrame   *fVf;                         // Vertical frame
00073    TGHorizontalFrame *fHf;                         // Horizontal frame
00074    TGHorizontalFrame *fH1;                         // Horizontal frame
00075    TGHorizontalFrame *fH2;                         // Horizontal frame
00076    TGVerticalFrame   *fV1;                         // Vertical frame
00077    TGVerticalFrame   *fV2;                         // Vertical frame
00078    TGVSplitter       *fVSplitter;                  // Vertical splitter
00079    TGHSplitter       *fHSplitter;                  // Horizontal splitter
00080    TGCompositeFrame  *fEditFrame;                  // Frame in "Edit" mode
00081    TGHorizontalFrame *fTopMenuFrame;               // Top menu frame
00082    TGHorizontalFrame *fPreMenuFrame;               // First (owned) menu frame
00083    TGHorizontalFrame *fMenuFrame;                  // Shared menu frame
00084    TGHorizontalFrame *fToolbarFrame;               // Toolbar frame
00085    TGMenuBar         *fMenuBar;                    // Main (owned) menu bar
00086    TGPopupMenu       *fMenuFile;                   // "File" popup menu
00087    TGPopupMenu       *fMenuExecPlugin;             // "Exec Plugin" popup menu
00088    TGPopupMenu       *fMenuHelp;                   // "Browser Help" popup menu
00089    TGCompositeFrame  *fActMenuBar;                 // Actual (active) menu bar
00090    TBrowserImp       *fActBrowser;                 // Actual (active) browser imp
00091    TList              fBrowsers;                   // List of (sub)browsers
00092    TList              fPlugins;                    // List of plugins
00093    TGStatusBar       *fStatusBar;                  // Status bar
00094    Int_t              fNbInitPlugins;              // Number of initial plugins (from .rootrc)
00095    Int_t              fNbTab[3];                   // Number of tab elements (for each Tab)
00096    Int_t              fCrTab[3];                   // Actual (active) tab elements (for each Tab)
00097    Int_t              fPid;                        // Current process id
00098    Bool_t             fShowCloseTab;               // kTRUE to show close icon on tab elements
00099 
00100 public:
00101    enum EInsertPosition {
00102       kLeft, kRight, kBottom
00103    };
00104 
00105    TRootBrowser(TBrowser *b = 0, const char *name = "ROOT Browser", UInt_t width = 800, UInt_t height = 500, Option_t *opt="", Bool_t initshow=kTRUE);
00106    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);
00107    virtual ~TRootBrowser();
00108 
00109    void              InitPlugins(Option_t *opt="");
00110 
00111    void              CreateBrowser(const char *name);
00112    void              CloneBrowser();
00113    void              CloseWindow();
00114    void              CloseTab(Int_t id);
00115    void              DoTab(Int_t id);
00116    TGFrame          *GetActFrame() const { return (TGFrame *)fEditFrame; }
00117    TGFrame          *GetToolbarFrame() const { return (TGFrame *)fToolbarFrame; }
00118    TGStatusBar      *GetStatusBar() const { return fStatusBar; }
00119    TGTab            *GetTabLeft() const { return fTabLeft; }
00120    TGTab            *GetTabRight() const { return fTabRight; }
00121    TGTab            *GetTabBottom() const { return fTabBottom; }
00122    TGTab            *GetTab(Int_t pos) const;
00123    void              SetTab(Int_t pos = kRight, Int_t subpos = -1);
00124    void              SetTabTitle(const char *title, Int_t pos = kRight, Int_t subpos = -1);
00125    void              HandleMenu(Int_t id);
00126    void              RecursiveReparent(TGPopupMenu *popup);
00127    void              RemoveTab(Int_t pos, Int_t subpos);
00128    void              SetActBrowser(TBrowserImp *b) { fActBrowser = b; }
00129    void              ShowMenu(TGCompositeFrame *menu);
00130    virtual void      StartEmbedding(Int_t pos = kRight, Int_t subpos = -1);
00131    virtual void      StopEmbedding(const char *name = 0) { StopEmbedding(name, 0); }
00132    void              StopEmbedding(const char *name, TGLayoutHints *layout);
00133    void              SwitchMenus(TGCompositeFrame *from);
00134 
00135    virtual void      BrowseObj(TObject *obj);             //*SIGNAL*
00136    virtual void      ExecuteDefaultAction(TObject *obj);  //*SIGNAL*
00137    virtual void      DoubleClicked(TObject *obj);         //*SIGNAL*
00138    virtual void      Checked(TObject *obj, Bool_t check); //*SIGNAL*
00139 
00140    virtual void      Add(TObject *obj, const char *name = 0, Int_t check = -1);
00141    virtual void      RecursiveRemove(TObject *obj);
00142    virtual void      Refresh(Bool_t force = kFALSE);
00143    virtual void      Show() { MapRaised(); }
00144    Option_t         *GetDrawOption() const;
00145    TGMainFrame      *GetMainFrame() const { return (TGMainFrame *)this; }
00146 
00147    virtual Long_t    ExecPlugin(const char *name = 0, const char *fname = 0,
00148                                 const char *cmd = 0, Int_t pos = kRight,
00149                                 Int_t subpos = -1);
00150    virtual void      SetStatusText(const char *txt, Int_t col);
00151    virtual Bool_t    HandleKey(Event_t *event);
00152 
00153    virtual void      ShowCloseTab(Bool_t show) { fShowCloseTab = show; }
00154    virtual Bool_t    IsCloseTabShown() const { return fShowCloseTab; }
00155    
00156    // overridden from TGMainFrame
00157    virtual void      ReallyDelete();
00158 
00159    static TBrowserImp *NewBrowser(TBrowser *b = 0, const char *title = "ROOT Browser", UInt_t width = 800, UInt_t height = 500, Option_t *opt="");
00160    static TBrowserImp *NewBrowser(TBrowser *b, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height, Option_t *opt="");
00161 
00162    ClassDef(TRootBrowser, 0) // New ROOT Browser
00163 };
00164 
00165 #endif

Generated on Tue Jul 5 14:20:11 2011 for ROOT_528-00b_version by  doxygen 1.5.1