Logo ROOT   6.12/07
Reference Guide
TRootBrowser.h
Go to the documentation of this file.
1 // @(#)root/gui:$Id: 7cf312b9bc9940a03d7c0cee95eea0085dc9898c $
2 // Author: Bertrand Bellenot 26/09/2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TRootBrowser
13 #define ROOT_TRootBrowser
14 
15 #include "TGFrame.h"
16 
17 #include "TBrowserImp.h"
18 
19 class TGLayoutHints;
20 class TGTab;
21 class TGMenuBar;
22 class TGPopupMenu;
23 class TGStatusBar;
24 class TGVSplitter;
25 class TGHSplitter;
26 
27 //_____________________________________________________________________________
28 //
29 // TBrowserPlugin
30 //
31 // Helper class used to manage plugins (command or macro to be executed).
32 //_____________________________________________________________________________
33 
34 class TBrowserPlugin : public TNamed
35 {
36 public:
37  Int_t fTab; // Tab number
38  Int_t fSubTab; // Tab element number
39  TString fCommand; // Command to be executed
40 
41  TBrowserPlugin(const char *name, const char *cmd = "", Int_t tab = 1,
42  Int_t sub = -1) : TNamed(name, cmd), fTab(tab),
43  fSubTab(sub), fCommand(cmd) { }
44  virtual ~TBrowserPlugin() {}
45 
46  void SetTab(Int_t tab) { fTab = tab; }
47  void SetSubTab(Int_t sub) { fSubTab = sub; }
48  void SetCommand(const char *cmd) { fCommand = cmd; }
49 
50  ClassDef(TBrowserPlugin, 0) // basic plugin description class
51 };
52 
53 class TRootBrowser : public TGMainFrame, public TBrowserImp {
54 private:
55  TRootBrowser(const TRootBrowser&); // Not implemented
56  TRootBrowser& operator=(const TRootBrowser&); // Not implemented
57 
58 protected:
59 
60  TGLayoutHints *fLH0, *fLH1, *fLH2, *fLH3; // Layout hints, part 1
61  TGLayoutHints *fLH4, *fLH5, *fLH6, *fLH7; // Layout hints, part 2
62  TGTab *fTabLeft; // Left Tab
63  TGTab *fTabRight; // Right Tab
64  TGTab *fTabBottom; // Bottom Tab
65  TGTab *fEditTab; // Tab in "Edit" mode
66  Int_t fEditPos; // Id of tab in "Edit" mode
67  Int_t fEditSubPos; // Id of subtab in "Edit" mode
68  TGVerticalFrame *fVf; // Vertical frame
69  TGHorizontalFrame *fHf; // Horizontal frame
70  TGHorizontalFrame *fH1; // Horizontal frame
71  TGHorizontalFrame *fH2; // Horizontal frame
72  TGVerticalFrame *fV1; // Vertical frame
73  TGVerticalFrame *fV2; // Vertical frame
74  TGVSplitter *fVSplitter; // Vertical splitter
75  TGHSplitter *fHSplitter; // Horizontal splitter
76  TGCompositeFrame *fEditFrame; // Frame in "Edit" mode
77  TGHorizontalFrame *fTopMenuFrame; // Top menu frame
78  TGHorizontalFrame *fPreMenuFrame; // First (owned) menu frame
79  TGHorizontalFrame *fMenuFrame; // Shared menu frame
80  TGHorizontalFrame *fToolbarFrame; // Toolbar frame
81  TGMenuBar *fMenuBar; // Main (owned) menu bar
82  TGPopupMenu *fMenuFile; // "File" popup menu
83  TGPopupMenu *fMenuExecPlugin; // "Exec Plugin" popup menu
84  TGPopupMenu *fMenuHelp; // "Browser Help" popup menu
85  TGCompositeFrame *fActMenuBar; // Actual (active) menu bar
86  TBrowserImp *fActBrowser; // Actual (active) browser imp
87  TList fBrowsers; // List of (sub)browsers
88  TList fPlugins; // List of plugins
89  TGStatusBar *fStatusBar; // Status bar
90  Int_t fNbInitPlugins; // Number of initial plugins (from .rootrc)
91  Int_t fNbTab[3]; // Number of tab elements (for each Tab)
92  Int_t fCrTab[3]; // Actual (active) tab elements (for each Tab)
93  Int_t fPid; // Current process id
94  Bool_t fShowCloseTab; // kTRUE to show close icon on tab elements
95  const TGPicture *fIconPic; // icon picture
96 
97 public:
99  kBrowse = 11011,
117  kQuitRoot
118  };
119 
121  kLeft, kRight, kBottom
122  };
123 
124  TRootBrowser(TBrowser *b = 0, const char *name = "ROOT Browser", UInt_t width = 800, UInt_t height = 500, Option_t *opt="", Bool_t initshow=kTRUE);
125  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);
126  virtual ~TRootBrowser();
127 
128  void InitPlugins(Option_t *opt="");
129 
130  void CreateBrowser(const char *name);
131  void CloneBrowser();
132  virtual void CloseWindow();
133  virtual void CloseTab(Int_t id);
134  virtual void CloseTabs();
135  void DoTab(Int_t id);
136  void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected);
137  TGFrame *GetActFrame() const { return (TGFrame *)fEditFrame; }
138  TGFrame *GetToolbarFrame() const { return (TGFrame *)fToolbarFrame; }
139  TGStatusBar *GetStatusBar() const { return fStatusBar; }
140  TGTab *GetTabLeft() const { return fTabLeft; }
141  TGTab *GetTabRight() const { return fTabRight; }
142  TGTab *GetTabBottom() const { return fTabBottom; }
143  TGTab *GetTab(Int_t pos) const;
144  void SetTab(Int_t pos = kRight, Int_t subpos = -1);
145  void SetTabTitle(const char *title, Int_t pos = kRight, Int_t subpos = -1);
146  void HandleMenu(Int_t id);
147  void RecursiveReparent(TGPopupMenu *popup);
148  void RemoveTab(Int_t pos, Int_t subpos);
149  void SetActBrowser(TBrowserImp *b) { fActBrowser = b; }
150  void ShowMenu(TGCompositeFrame *menu);
151  virtual void StartEmbedding(Int_t pos = kRight, Int_t subpos = -1);
152  virtual void StopEmbedding(const char *name = 0) { StopEmbedding(name, 0); }
153  void StopEmbedding(const char *name, TGLayoutHints *layout);
154  void SwitchMenus(TGCompositeFrame *from);
155 
156  virtual void BrowseObj(TObject *obj); //*SIGNAL*
157  virtual void ExecuteDefaultAction(TObject *obj); //*SIGNAL*
158  virtual void DoubleClicked(TObject *obj); //*SIGNAL*
159  virtual void Checked(TObject *obj, Bool_t check); //*SIGNAL*
160 
161  virtual void Add(TObject *obj, const char *name = 0, Int_t check = -1);
162  virtual void RecursiveRemove(TObject *obj);
163  virtual void Refresh(Bool_t force = kFALSE);
164  virtual void Show() { MapRaised(); }
165  Option_t *GetDrawOption() const;
166  TGMainFrame *GetMainFrame() const { return (TGMainFrame *)this; }
167 
168  virtual Long_t ExecPlugin(const char *name = 0, const char *fname = 0,
169  const char *cmd = 0, Int_t pos = kRight,
170  Int_t subpos = -1);
171  virtual void SetStatusText(const char *txt, Int_t col);
172  virtual Bool_t HandleKey(Event_t *event);
173 
174  virtual void ShowCloseTab(Bool_t show) { fShowCloseTab = show; }
175  virtual Bool_t IsCloseTabShown() const { return fShowCloseTab; }
176 
177  // overridden from TGMainFrame
178  virtual void ReallyDelete();
179 
180  static TBrowserImp *NewBrowser(TBrowser *b = 0, const char *title = "ROOT Browser", UInt_t width = 800, UInt_t height = 500, Option_t *opt="");
181  static TBrowserImp *NewBrowser(TBrowser *b, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height, Option_t *opt="");
182 
183  ClassDef(TRootBrowser, 0) // New ROOT Browser
184 };
185 
186 #endif
TGCompositeFrame * fEditFrame
Definition: TRootBrowser.h:76
virtual Bool_t IsCloseTabShown() const
Definition: TRootBrowser.h:175
Definition: TGTab.h:62
TList fPlugins
Definition: TRootBrowser.h:88
TGPopupMenu * fMenuExecPlugin
Definition: TRootBrowser.h:83
const char Option_t
Definition: RtypesCore.h:62
TGVerticalFrame * fVf
Definition: TRootBrowser.h:68
TGTab * GetTabBottom() const
Definition: TRootBrowser.h:142
TList fBrowsers
Definition: TRootBrowser.h:87
TGHorizontalFrame * fToolbarFrame
Definition: TRootBrowser.h:80
TGCompositeFrame * fActMenuBar
Definition: TRootBrowser.h:85
Basic string class.
Definition: TString.h:125
TGHorizontalFrame * fH2
Definition: TRootBrowser.h:71
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TGStatusBar * fStatusBar
Definition: TRootBrowser.h:89
void SetSubTab(Int_t sub)
Definition: TRootBrowser.h:47
TGLayoutHints * fLH7
Definition: TRootBrowser.h:61
virtual void RecursiveRemove(TObject *obj)
Recursively remove this object from a list.
Definition: TObject.cxx:572
Int_t fEditSubPos
Definition: TRootBrowser.h:67
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:320
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
TGHorizontalFrame * fTopMenuFrame
Definition: TRootBrowser.h:77
TGVSplitter * fVSplitter
Definition: TRootBrowser.h:74
virtual ~TBrowserPlugin()
Definition: TRootBrowser.h:44
TGStatusBar * GetStatusBar() const
Definition: TRootBrowser.h:139
TGLayoutHints * fLH3
Definition: TRootBrowser.h:60
TGVerticalFrame * fV2
Definition: TRootBrowser.h:73
void SetCommand(const char *cmd)
Definition: TRootBrowser.h:48
TGFrame * GetToolbarFrame() const
Definition: TRootBrowser.h:138
virtual Option_t * GetDrawOption() const
Get option used by the graphics system to draw this object.
Definition: TObject.cxx:341
A doubly linked list.
Definition: TList.h:44
Int_t fEditPos
Definition: TRootBrowser.h:66
TGTab * fTabRight
Definition: TRootBrowser.h:63
TGHorizontalFrame * fHf
Definition: TRootBrowser.h:69
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
void SetTab(Int_t tab)
Definition: TRootBrowser.h:46
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Definition: TNamed.cxx:51
virtual void Show()
Definition: TRootBrowser.h:164
unsigned int UInt_t
Definition: RtypesCore.h:42
TString fCommand
Definition: TRootBrowser.h:39
TGTab * fTabBottom
Definition: TRootBrowser.h:64
TGTab * GetTabLeft() const
Definition: TRootBrowser.h:140
virtual void ShowCloseTab(Bool_t show)
Definition: TRootBrowser.h:174
TGTab * fTabLeft
Definition: TRootBrowser.h:62
TGTab * GetTabRight() const
Definition: TRootBrowser.h:141
const Bool_t kFALSE
Definition: RtypesCore.h:88
long Long_t
Definition: RtypesCore.h:50
void Add(THist< DIMENSIONS, PRECISION_TO, STAT_TO... > &to, const THist< DIMENSIONS, PRECISION_FROM, STAT_FROM... > &from)
Add two histograms.
Definition: THist.hxx:308
TGHorizontalFrame * fPreMenuFrame
Definition: TRootBrowser.h:78
const TGPicture * fIconPic
Definition: TRootBrowser.h:95
Double_t y[n]
Definition: legend1.C:17
TGPopupMenu * fMenuFile
Definition: TRootBrowser.h:82
TGFrame * GetActFrame() const
Definition: TRootBrowser.h:137
virtual void StopEmbedding(const char *name=0)
Definition: TRootBrowser.h:152
TGHSplitter * fHSplitter
Definition: TRootBrowser.h:75
Mother of all ROOT objects.
Definition: TObject.h:37
TGHorizontalFrame * fMenuFrame
Definition: TRootBrowser.h:79
TBrowserImp * fActBrowser
Definition: TRootBrowser.h:86
TGPopupMenu * fMenuHelp
Definition: TRootBrowser.h:84
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
Int_t fNbInitPlugins
Definition: TRootBrowser.h:90
TGMainFrame * GetMainFrame() const
Definition: TRootBrowser.h:166
void SetActBrowser(TBrowserImp *b)
Definition: TRootBrowser.h:149
TGVerticalFrame * fV1
Definition: TRootBrowser.h:72
const Bool_t kTRUE
Definition: RtypesCore.h:87
TGHorizontalFrame * fH1
Definition: TRootBrowser.h:70
TGTab * fEditTab
Definition: TRootBrowser.h:65
char name[80]
Definition: TGX11.cxx:109
TBrowserPlugin(const char *name, const char *cmd="", Int_t tab=1, Int_t sub=-1)
Definition: TRootBrowser.h:41
Bool_t fShowCloseTab
Definition: TRootBrowser.h:94
TGMenuBar * fMenuBar
Definition: TRootBrowser.h:81
ABC describing GUI independent browser implementation protocol.
Definition: TBrowserImp.h:29