Logo ROOT  
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
19class TGLayoutHints;
20class TGTab;
21class TGMenuBar;
22class TGPopupMenu;
23class TGStatusBar;
24class TGVSplitter;
25class TGHSplitter;
26
27//_____________________________________________________________________________
28//
29// TBrowserPlugin
30//
31// Helper class used to manage plugins (command or macro to be executed).
32//_____________________________________________________________________________
33
34class TBrowserPlugin : public TNamed
35{
36public:
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
53class TRootBrowser : public TGMainFrame, public TBrowserImp {
54private:
55 TRootBrowser(const TRootBrowser&); // Not implemented
56 TRootBrowser& operator=(const TRootBrowser&); // Not implemented
57
58protected:
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
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
97public:
99 kBrowse = 11011,
118 };
119
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; }
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);
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; }
177
178 // overridden from TGMainFrame
179 virtual void ReallyDelete();
180
181 static TBrowserImp *NewBrowser(TBrowser *b = 0, const char *title = "ROOT Browser", UInt_t width = 800, UInt_t height = 500, Option_t *opt="");
182 static TBrowserImp *NewBrowser(TBrowser *b, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height, Option_t *opt="");
183
184 ClassDef(TRootBrowser, 0) // New ROOT Browser
185};
186
187#endif
#define b(i)
Definition: RSha256.hxx:100
int Int_t
Definition: RtypesCore.h:43
unsigned int UInt_t
Definition: RtypesCore.h:44
const Bool_t kFALSE
Definition: RtypesCore.h:90
long Long_t
Definition: RtypesCore.h:52
bool Bool_t
Definition: RtypesCore.h:61
const Bool_t kTRUE
Definition: RtypesCore.h:89
const char Option_t
Definition: RtypesCore.h:64
#define ClassDef(name, id)
Definition: Rtypes.h:322
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
char name[80]
Definition: TGX11.cxx:109
ABC describing GUI independent browser implementation protocol.
Definition: TBrowserImp.h:29
virtual ~TBrowserPlugin()
Definition: TRootBrowser.h:44
void SetCommand(const char *cmd)
Definition: TRootBrowser.h:48
TString fCommand
Definition: TRootBrowser.h:39
void SetSubTab(Int_t sub)
Definition: TRootBrowser.h:47
TBrowserPlugin(const char *name, const char *cmd="", Int_t tab=1, Int_t sub=-1)
Definition: TRootBrowser.h:41
void SetTab(Int_t tab)
Definition: TRootBrowser.h:46
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
virtual void MapRaised()
map raised
Definition: TGFrame.h:230
Definition: TGTab.h:62
A doubly linked list.
Definition: TList.h:44
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
Mother of all ROOT objects.
Definition: TObject.h:37
TGPopupMenu * fMenuExecPlugin
Definition: TRootBrowser.h:83
TGHorizontalFrame * fMenuFrame
Definition: TRootBrowser.h:79
TGTab * GetTabLeft() const
Definition: TRootBrowser.h:140
TGTab * GetTab(Int_t pos) const
Returns the TGTab at position pos.
TGLayoutHints * fLH4
Definition: TRootBrowser.h:61
Bool_t fShowCloseTab
Definition: TRootBrowser.h:94
virtual void ExecuteDefaultAction(TObject *obj)
Emits signal "ExecuteDefaultAction(TObject*)".
void SetTabTitle(const char *title, Int_t pos=kRight, Int_t subpos=-1)
Set text "title" of Tab "subpos" in TGTab "pos".
TGPopupMenu * fMenuHelp
Definition: TRootBrowser.h:84
Int_t fCrTab[3]
Definition: TRootBrowser.h:92
TGTab * GetTabBottom() const
Definition: TRootBrowser.h:142
TGHorizontalFrame * fH2
Definition: TRootBrowser.h:71
Int_t fNbTab[3]
Definition: TRootBrowser.h:91
TGStatusBar * fStatusBar
Definition: TRootBrowser.h:89
Bool_t IsWebGUI()
Check if the GUI factory is set to use the Web GUI.
TGVerticalFrame * fVf
Definition: TRootBrowser.h:68
virtual void DoubleClicked(TObject *obj)
Emits signal when double clicking on icon.
TGLayoutHints * fLH6
Definition: TRootBrowser.h:61
TGHSplitter * fHSplitter
Definition: TRootBrowser.h:75
TBrowserImp * fActBrowser
Definition: TRootBrowser.h:86
void SetActBrowser(TBrowserImp *b)
Definition: TRootBrowser.h:149
TGCompositeFrame * fEditFrame
Definition: TRootBrowser.h:76
virtual void CloseTab(Int_t id)
Remove tab element id from right tab.
virtual void RecursiveRemove(TObject *obj)
Recursively remove object from browser.
TGCompositeFrame * fActMenuBar
Definition: TRootBrowser.h:85
Int_t fEditPos
Definition: TRootBrowser.h:66
TGLayoutHints * fLH1
Definition: TRootBrowser.h:60
virtual void CloseTabs()
Properly close the mainframes embedded in the different tabs.
const TGPicture * fIconPic
Definition: TRootBrowser.h:95
TRootBrowser(const TRootBrowser &)
virtual Bool_t IsCloseTabShown() const
Definition: TRootBrowser.h:175
Int_t fEditSubPos
Definition: TRootBrowser.h:67
TList fBrowsers
Definition: TRootBrowser.h:87
TGTab * fEditTab
Definition: TRootBrowser.h:65
TGLayoutHints * fLH2
Definition: TRootBrowser.h:60
static TBrowserImp * NewBrowser(TBrowser *b=0, const char *title="ROOT Browser", UInt_t width=800, UInt_t height=500, Option_t *opt="")
static contructor returning TBrowserImp, as needed by the plugin mechanism.
TGVerticalFrame * fV1
Definition: TRootBrowser.h:72
void DoTab(Int_t id)
Handle Tab navigation.
TGMainFrame * GetMainFrame() const
Definition: TRootBrowser.h:166
Option_t * GetDrawOption() const
Returns drawing option.
TGLayoutHints * fLH0
Definition: TRootBrowser.h:60
TGFrame * GetActFrame() const
Definition: TRootBrowser.h:137
void CreateBrowser(const char *name)
TGFrame * GetToolbarFrame() const
Definition: TRootBrowser.h:138
virtual void ShowCloseTab(Bool_t show)
Definition: TRootBrowser.h:174
TGHorizontalFrame * fPreMenuFrame
Definition: TRootBrowser.h:78
TGLayoutHints * fLH5
Definition: TRootBrowser.h:61
void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
Display a tooltip with infos about the primitive below the cursor.
TList fPlugins
Definition: TRootBrowser.h:88
void SetTab(Int_t pos=kRight, Int_t subpos=-1)
Switch to Tab "subpos" in TGTab "pos".
virtual Bool_t HandleKey(Event_t *event)
Handle keyboard events.
void CloneBrowser()
Clone the browser.
TGTab * fTabRight
Definition: TRootBrowser.h:63
void HandleMenu(Int_t id)
Handle menu entries events.
TGVSplitter * fVSplitter
Definition: TRootBrowser.h:74
virtual void StopEmbedding(const char *name=0)
Definition: TRootBrowser.h:152
TGHorizontalFrame * fHf
Definition: TRootBrowser.h:69
void RemoveTab(Int_t pos, Int_t subpos)
Remove tab element "subpos" from tab "pos".
virtual void StartEmbedding(Int_t pos=kRight, Int_t subpos=-1)
Start embedding external frame in the tab "pos" and tab element "subpos".
TGTab * fTabBottom
Definition: TRootBrowser.h:64
TGPopupMenu * fMenuFile
Definition: TRootBrowser.h:82
void SwitchMenus(TGCompositeFrame *from)
Move the menu from original frame to our TGMenuFrame, or display the menu associated to the current t...
TGLayoutHints * fLH7
Definition: TRootBrowser.h:61
virtual void Checked(TObject *obj, Bool_t check)
Emits signal when double clicking on icon.
virtual Long_t ExecPlugin(const char *name=0, const char *fname=0, const char *cmd=0, Int_t pos=kRight, Int_t subpos=-1)
Execute a macro and embed the created frame in the tab "pos" and tab element "subpos".
void ShowMenu(TGCompositeFrame *menu)
Show the selected frame's menu and hide previous one.
TGTab * fTabLeft
Definition: TRootBrowser.h:62
TGStatusBar * GetStatusBar() const
Definition: TRootBrowser.h:139
TGTab * GetTabRight() const
Definition: TRootBrowser.h:141
TGHorizontalFrame * fTopMenuFrame
Definition: TRootBrowser.h:77
virtual void Show()
Definition: TRootBrowser.h:164
virtual void BrowseObj(TObject *obj)
Browse object.
TGLayoutHints * fLH3
Definition: TRootBrowser.h:60
TRootBrowser & operator=(const TRootBrowser &)
TGMenuBar * fMenuBar
Definition: TRootBrowser.h:81
virtual void SetStatusText(const char *txt, Int_t col)
Set text in culumn col in status bar.
virtual void Add(TObject *obj, const char *name=0, Int_t check=-1)
Add items to the actual browser.
virtual void Refresh(Bool_t force=kFALSE)
Refresh the actual browser contents.
Int_t fNbInitPlugins
Definition: TRootBrowser.h:90
void InitPlugins(Option_t *opt="")
Initialize default plugins.
TGVerticalFrame * fV2
Definition: TRootBrowser.h:73
virtual ~TRootBrowser()
Clean up all widgets, frames and layouthints that were used.
void RecursiveReparent(TGPopupMenu *popup)
Recursively reparent TGPopupMenu to gClient->GetDefaultRoot().
virtual void ReallyDelete()
Really delete the browser and the this GUI.
virtual void CloseWindow()
Called when window is closed via the window manager.
TGHorizontalFrame * fH1
Definition: TRootBrowser.h:70
TGHorizontalFrame * fToolbarFrame
Definition: TRootBrowser.h:80
Basic string class.
Definition: TString.h:131
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17