00001
00002
00003
00004
00005
00006
00007
00008
00009
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
00034
00035
00036
00037
00038 class TBrowserPlugin : public TNamed
00039 {
00040 public:
00041 Int_t fTab;
00042 Int_t fSubTab;
00043 TString fCommand;
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)
00055 };
00056
00057 class TRootBrowser : public TGMainFrame, public TBrowserImp {
00058 private:
00059 TRootBrowser(const TRootBrowser&);
00060 TRootBrowser& operator=(const TRootBrowser&);
00061
00062 protected:
00063
00064 TGLayoutHints *fLH0, *fLH1, *fLH2, *fLH3;
00065 TGLayoutHints *fLH4, *fLH5, *fLH6, *fLH7;
00066 TGTab *fTabLeft;
00067 TGTab *fTabRight;
00068 TGTab *fTabBottom;
00069 TGTab *fEditTab;
00070 Int_t fEditPos;
00071 Int_t fEditSubPos;
00072 TGVerticalFrame *fVf;
00073 TGHorizontalFrame *fHf;
00074 TGHorizontalFrame *fH1;
00075 TGHorizontalFrame *fH2;
00076 TGVerticalFrame *fV1;
00077 TGVerticalFrame *fV2;
00078 TGVSplitter *fVSplitter;
00079 TGHSplitter *fHSplitter;
00080 TGCompositeFrame *fEditFrame;
00081 TGHorizontalFrame *fTopMenuFrame;
00082 TGHorizontalFrame *fPreMenuFrame;
00083 TGHorizontalFrame *fMenuFrame;
00084 TGHorizontalFrame *fToolbarFrame;
00085 TGMenuBar *fMenuBar;
00086 TGPopupMenu *fMenuFile;
00087 TGPopupMenu *fMenuExecPlugin;
00088 TGPopupMenu *fMenuHelp;
00089 TGCompositeFrame *fActMenuBar;
00090 TBrowserImp *fActBrowser;
00091 TList fBrowsers;
00092 TList fPlugins;
00093 TGStatusBar *fStatusBar;
00094 Int_t fNbInitPlugins;
00095 Int_t fNbTab[3];
00096 Int_t fCrTab[3];
00097 Int_t fPid;
00098 Bool_t fShowCloseTab;
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);
00136 virtual void ExecuteDefaultAction(TObject *obj);
00137 virtual void DoubleClicked(TObject *obj);
00138 virtual void Checked(TObject *obj, Bool_t check);
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
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)
00163 };
00164
00165 #endif