Logo ROOT  
Reference Guide
Go to the documentation of this file.
1// @(#)root/gui:$Id: 7cf312b9bc9940a03d7c0cee95eea0085dc9898c $
2// Author: Bertrand Bellenot 26/09/2007
5 * Copyright (C) 1995-2021, 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 *************************************************************************/
12#ifndef ROOT_TRootBrowser
13#define ROOT_TRootBrowser
15#include "TGFrame.h"
17#include "TBrowserImp.h"
19class TGLayoutHints;
20class TGTab;
21class TGMenuBar;
22class TGPopupMenu;
23class TGStatusBar;
24class TGVSplitter;
25class TGHSplitter;
28/** \class TBrowserPlugin
29 \ingroup guiwidgets
31Helper class used to manage plugins (command or macro to be executed).
35class TBrowserPlugin : public TNamed
38 Int_t fTab{0}; ///< Tab number
39 Int_t fSubTab{0}; ///< Tab element number
40 TString fCommand; ///< Command to be executed
42 TBrowserPlugin(const char *name, const char *cmd = "", Int_t tab = 1,
43 Int_t sub = -1) : TNamed(name, cmd), fTab(tab),
44 fSubTab(sub), fCommand(cmd) { }
45 virtual ~TBrowserPlugin() {}
47 void SetTab(Int_t tab) { fTab = tab; }
48 void SetSubTab(Int_t sub) { fSubTab = sub; }
49 void SetCommand(const char *cmd) { fCommand = cmd; }
51 ClassDef(TBrowserPlugin, 0) // basic plugin description class
54class TRootBrowser : public TGMainFrame, public TBrowserImp {
55 TRootBrowser(const TRootBrowser&) = delete;
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
99 kBrowse = 11011,
118 };
122 };
124 TRootBrowser(TBrowser *b = nullptr, 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();
128 void InitPlugins(Option_t *opt="");
130 void CreateBrowser(const char *name);
131 void CloneBrowser();
132 void CloseWindow() override;
133 virtual void CloseTab(Int_t id);
134 void CloseTabs() override;
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 void StartEmbedding(Int_t pos = kRight, Int_t subpos = -1) override;
152 void StopEmbedding(const char *name = nullptr) override { StopEmbedding(name, 0); }
153 void StopEmbedding(const char *name, TGLayoutHints *layout);
154 void SwitchMenus(TGCompositeFrame *from);
156 void BrowseObj(TObject *obj) override; //*SIGNAL*
157 void ExecuteDefaultAction(TObject *obj) override; //*SIGNAL*
158 virtual void DoubleClicked(TObject *obj); //*SIGNAL*
159 virtual void Checked(TObject *obj, Bool_t check); //*SIGNAL*
161 void Add(TObject *obj, const char *name = nullptr, Int_t check = -1) override;
162 void RecursiveRemove(TObject *obj) override;
163 void Refresh(Bool_t force = kFALSE) override;
164 void Show() override { MapRaised(); }
165 Option_t *GetDrawOption() const override;
166 TGMainFrame *GetMainFrame() const override { return (TGMainFrame *)this; }
168 Long_t ExecPlugin(const char *name = nullptr, const char *fname = nullptr,
169 const char *cmd = nullptr, Int_t pos = kRight,
170 Int_t subpos = -1) override;
171 void SetStatusText(const char *txt, Int_t col) override;
172 Bool_t HandleKey(Event_t *event) override;
174 virtual void ShowCloseTab(Bool_t show) { fShowCloseTab = show; }
175 virtual Bool_t IsCloseTabShown() const { return fShowCloseTab; }
178 // overridden from TGMainFrame
179 void ReallyDelete() override;
181 static TBrowserImp *NewBrowser(TBrowser *b = nullptr, 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 = "");
184 ClassDefOverride(TRootBrowser, 0) // New ROOT Browser
#define b(i)
Definition: RSha256.hxx:100
int Int_t
Definition: RtypesCore.h:45
unsigned int UInt_t
Definition: RtypesCore.h:46
const Bool_t kFALSE
Definition: RtypesCore.h:101
long Long_t
Definition: RtypesCore.h:54
bool Bool_t
Definition: RtypesCore.h:63
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassDef(name, id)
Definition: Rtypes.h:325
#define ClassDefOverride(name, id)
Definition: Rtypes.h:329
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
char name[80]
Definition: TGX11.cxx:110
ABC describing GUI independent browser implementation protocol.
Definition: TBrowserImp.h:29
Helper class used to manage plugins (command or macro to be executed).
Definition: TRootBrowser.h:36
virtual ~TBrowserPlugin()
Definition: TRootBrowser.h:45
void SetCommand(const char *cmd)
Definition: TRootBrowser.h:49
TString fCommand
Command to be executed.
Definition: TRootBrowser.h:40
Int_t fSubTab
Tab element number.
Definition: TRootBrowser.h:39
Int_t fTab
Tab number.
Definition: TRootBrowser.h:38
void SetSubTab(Int_t sub)
Definition: TRootBrowser.h:48
TBrowserPlugin(const char *name, const char *cmd="", Int_t tab=1, Int_t sub=-1)
Definition: TRootBrowser.h:42
void SetTab(Int_t tab)
Definition: TRootBrowser.h:47
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition: TGFrame.h:80
virtual void MapRaised()
map raised
Definition: TGFrame.h:205
A composite frame that layout their children in horizontal way.
Definition: TGFrame.h:386
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
Defines top level windows that interact with the system Window Manager.
Definition: TGFrame.h:398
The TGMenu.h header contains all different menu classes.
Definition: TGMenu.h:282
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition: TGPicture.h:25
This class creates a popup menu object.
Definition: TGMenu.h:110
Provides a StatusBar widget.
Definition: TGStatusBar.h:21
A tab widget contains a set of composite frames each with a little tab with a name (like a set of fol...
Definition: TGTab.h:46
A composite frame that layout their children in vertical way.
Definition: TGFrame.h:375
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
This class creates a ROOT object browser, constituted by three main tabs.
Definition: TRootBrowser.h:54
TGPopupMenu * fMenuExecPlugin
"Exec Plugin" popup menu
Definition: TRootBrowser.h:83
TGHorizontalFrame * fMenuFrame
Shared menu frame.
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
void StartEmbedding(Int_t pos=kRight, Int_t subpos=-1) override
Start embedding external frame in the tab "pos" and tab element "subpos".
TGMainFrame * GetMainFrame() const override
Definition: TRootBrowser.h:166
Bool_t fShowCloseTab
kTRUE to show close icon on tab elements
Definition: TRootBrowser.h:94
void SetTabTitle(const char *title, Int_t pos=kRight, Int_t subpos=-1)
Set text "title" of Tab "subpos" in TGTab "pos".
TRootBrowser & operator=(const TRootBrowser &)=delete
TGPopupMenu * fMenuHelp
"Browser Help" popup menu
Definition: TRootBrowser.h:84
Int_t fCrTab[3]
Actual (active) tab elements (for each Tab)
Definition: TRootBrowser.h:92
void ExecuteDefaultAction(TObject *obj) override
Emits signal "ExecuteDefaultAction(TObject*)".
TRootBrowser(const TRootBrowser &)=delete
TGTab * GetTabBottom() const
Definition: TRootBrowser.h:142
TGHorizontalFrame * fH2
Horizontal frame.
Definition: TRootBrowser.h:71
Int_t fNbTab[3]
Number of tab elements (for each Tab)
Definition: TRootBrowser.h:91
TGStatusBar * fStatusBar
Status bar.
Definition: TRootBrowser.h:89
Bool_t IsWebGUI()
Check if the GUI factory is set to use the Web GUI.
TGVerticalFrame * fVf
Vertical frame.
Definition: TRootBrowser.h:68
virtual void DoubleClicked(TObject *obj)
Emits signal when double clicking on icon.
TGLayoutHints * fLH6
Definition: TRootBrowser.h:61
TGHSplitter * fHSplitter
Horizontal splitter.
Definition: TRootBrowser.h:75
TBrowserImp * fActBrowser
Actual (active) browser imp.
Definition: TRootBrowser.h:86
void SetActBrowser(TBrowserImp *b)
Definition: TRootBrowser.h:149
TGCompositeFrame * fEditFrame
Frame in "Edit" mode.
Definition: TRootBrowser.h:76
virtual void CloseTab(Int_t id)
Remove tab element id from right tab.
static TBrowserImp * NewBrowser(TBrowser *b=nullptr, const char *title="ROOT Browser", UInt_t width=800, UInt_t height=500, Option_t *opt="")
static constructor returning TBrowserImp, as needed by the plugin mechanism.
Int_t fPid
Current process id.
Definition: TRootBrowser.h:93
TGCompositeFrame * fActMenuBar
Actual (active) menu bar.
Definition: TRootBrowser.h:85
Int_t fEditPos
Id of tab in "Edit" mode.
Definition: TRootBrowser.h:66
TGLayoutHints * fLH1
Definition: TRootBrowser.h:60
void ReallyDelete() override
Really delete the browser and the this GUI.
void StopEmbedding(const char *name=nullptr) override
Definition: TRootBrowser.h:152
const TGPicture * fIconPic
icon picture
Definition: TRootBrowser.h:95
virtual Bool_t IsCloseTabShown() const
Definition: TRootBrowser.h:175
Int_t fEditSubPos
Id of subtab in "Edit" mode.
Definition: TRootBrowser.h:67
TList fBrowsers
List of (sub)browsers.
Definition: TRootBrowser.h:87
TGTab * fEditTab
Tab in "Edit" mode.
Definition: TRootBrowser.h:65
TGLayoutHints * fLH2
Definition: TRootBrowser.h:60
void Show() override
Definition: TRootBrowser.h:164
TGVerticalFrame * fV1
Vertical frame.
Definition: TRootBrowser.h:72
void DoTab(Int_t id)
Handle Tab navigation.
TGLayoutHints * fLH0
Definition: TRootBrowser.h:60
void RecursiveRemove(TObject *obj) override
Recursively remove object from browser.
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
First (owned) menu frame.
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
List of plugins.
Definition: TRootBrowser.h:88
Bool_t HandleKey(Event_t *event) override
Handle keyboard events.
void SetTab(Int_t pos=kRight, Int_t subpos=-1)
Switch to Tab "subpos" in TGTab "pos".
void CloneBrowser()
Clone the browser.
TGTab * fTabRight
Right Tab.
Definition: TRootBrowser.h:63
void HandleMenu(Int_t id)
Handle menu entries events.
TGVSplitter * fVSplitter
Vertical splitter.
Definition: TRootBrowser.h:74
TGHorizontalFrame * fHf
Horizontal frame.
Definition: TRootBrowser.h:69
Long_t ExecPlugin(const char *name=nullptr, const char *fname=nullptr, const char *cmd=nullptr, Int_t pos=kRight, Int_t subpos=-1) override
Execute a macro and embed the created frame in the tab "pos" and tab element "subpos".
void RemoveTab(Int_t pos, Int_t subpos)
Remove tab element "subpos" from tab "pos".
TGTab * fTabBottom
Bottom Tab.
Definition: TRootBrowser.h:64
void Refresh(Bool_t force=kFALSE) override
Refresh the actual browser contents.
TGPopupMenu * fMenuFile
"File" popup menu
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...
void BrowseObj(TObject *obj) override
Browse object.
TGLayoutHints * fLH7
Layout hints, part 2.
Definition: TRootBrowser.h:61
virtual void Checked(TObject *obj, Bool_t check)
Emits signal when double clicking on icon.
void ShowMenu(TGCompositeFrame *menu)
Show the selected frame's menu and hide previous one.
void SetStatusText(const char *txt, Int_t col) override
Set text in column col in status bar.
void CloseWindow() override
Called when window is closed via the window manager.
TGTab * fTabLeft
Left Tab.
Definition: TRootBrowser.h:62
TGStatusBar * GetStatusBar() const
Definition: TRootBrowser.h:139
TGTab * GetTabRight() const
Definition: TRootBrowser.h:141
void Add(TObject *obj, const char *name=nullptr, Int_t check=-1) override
Add items to the actual browser.
TGHorizontalFrame * fTopMenuFrame
Top menu frame.
Definition: TRootBrowser.h:77
TGLayoutHints * fLH3
Layout hints, part 1.
Definition: TRootBrowser.h:60
TGMenuBar * fMenuBar
Main (owned) menu bar.
Definition: TRootBrowser.h:81
Int_t fNbInitPlugins
Number of initial plugins (from .rootrc)
Definition: TRootBrowser.h:90
void InitPlugins(Option_t *opt="")
Initialize default plugins.
TGVerticalFrame * fV2
Vertical frame.
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().
void CloseTabs() override
Properly close the mainframes embedded in the different tabs.
Option_t * GetDrawOption() const override
Returns drawing option.
TGHorizontalFrame * fH1
Horizontal frame.
Definition: TRootBrowser.h:70
TGHorizontalFrame * fToolbarFrame
Toolbar frame.
Definition: TRootBrowser.h:80
Basic string class.
Definition: TString.h:136
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
Event structure.
Definition: GuiTypes.h:174