Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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-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 *************************************************************************/
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/** \class TBrowserPlugin
29 \ingroup guiwidgets
30
31Helper class used to manage plugins (command or macro to be executed).
32*/
33
34
35class TBrowserPlugin : public TNamed
36{
37public:
38 Int_t fTab{0}; ///< Tab number
39 Int_t fSubTab{0}; ///< Tab element number
40 TString fCommand; ///< Command to be executed
41
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() {}
46
47 void SetTab(Int_t tab) { fTab = tab; }
48 void SetSubTab(Int_t sub) { fSubTab = sub; }
49 void SetCommand(const char *cmd) { fCommand = cmd; }
50
51 ClassDef(TBrowserPlugin, 0) // basic plugin description class
52};
53
54class TRootBrowser : public TGMainFrame, public TBrowserImp {
55 TRootBrowser(const TRootBrowser&) = delete;
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
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
97public:
99 kBrowse = 11011,
118 };
119
122 };
123
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();
127
128 void InitPlugins(Option_t *opt="");
129
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);
155
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*
160
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; }
167
168 Longptr_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;
173
174 virtual void ShowCloseTab(Bool_t show) { fShowCloseTab = show; }
175 virtual Bool_t IsCloseTabShown() const { return fShowCloseTab; }
177
178 // overridden from TGMainFrame
179 void ReallyDelete() override;
180
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 = "");
183
184 ClassDefOverride(TRootBrowser, 0) // New ROOT Browser
185};
186
187#endif
#define b(i)
Definition RSha256.hxx:100
int Int_t
Definition RtypesCore.h:45
long Longptr_t
Definition RtypesCore.h:82
unsigned int UInt_t
Definition RtypesCore.h:46
const Bool_t kFALSE
Definition RtypesCore.h:101
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
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).
virtual ~TBrowserPlugin()
void SetCommand(const char *cmd)
TString fCommand
Command to be executed.
Int_t fSubTab
Tab element number.
Int_t fTab
Tab number.
void SetSubTab(Int_t sub)
TBrowserPlugin(const char *name, const char *cmd="", Int_t tab=1, Int_t sub=-1)
void SetTab(Int_t tab)
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:38
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Mother of all ROOT objects.
Definition TObject.h:41
This class creates a ROOT object browser, constituted by three main tabs.
TGPopupMenu * fMenuExecPlugin
"Exec Plugin" popup menu
TGHorizontalFrame * fMenuFrame
Shared menu frame.
TGTab * GetTabLeft() const
TGTab * GetTab(Int_t pos) const
Returns the TGTab at position pos.
TGLayoutHints * fLH4
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
Returns top level main frame.
Bool_t fShowCloseTab
kTRUE to show close icon on tab elements
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
Int_t fCrTab[3]
Actual (active) tab elements (for each Tab)
void ExecuteDefaultAction(TObject *obj) override
Emits signal "ExecuteDefaultAction(TObject*)".
TRootBrowser(const TRootBrowser &)=delete
Longptr_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".
TGTab * GetTabBottom() const
TGHorizontalFrame * fH2
Horizontal frame.
Int_t fNbTab[3]
Number of tab elements (for each Tab)
TGStatusBar * fStatusBar
Status bar.
Bool_t IsWebGUI()
Check if the GUI factory is set to use the Web GUI.
TGVerticalFrame * fVf
Vertical frame.
virtual void DoubleClicked(TObject *obj)
Emits signal when double clicking on icon.
TGLayoutHints * fLH6
TGHSplitter * fHSplitter
Horizontal splitter.
TBrowserImp * fActBrowser
Actual (active) browser imp.
void SetActBrowser(TBrowserImp *b)
TGCompositeFrame * fEditFrame
Frame in "Edit" mode.
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.
TGCompositeFrame * fActMenuBar
Actual (active) menu bar.
Int_t fEditPos
Id of tab in "Edit" mode.
TGLayoutHints * fLH1
void ReallyDelete() override
Really delete the browser and the this GUI.
void StopEmbedding(const char *name=nullptr) override
const TGPicture * fIconPic
icon picture
virtual Bool_t IsCloseTabShown() const
Int_t fEditSubPos
Id of subtab in "Edit" mode.
TList fBrowsers
List of (sub)browsers.
TGTab * fEditTab
Tab in "Edit" mode.
TGLayoutHints * fLH2
void Show() override
TGVerticalFrame * fV1
Vertical frame.
void DoTab(Int_t id)
Handle Tab navigation.
TGLayoutHints * fLH0
void RecursiveRemove(TObject *obj) override
Recursively remove object from browser.
TGFrame * GetActFrame() const
void CreateBrowser(const char *name)
TGFrame * GetToolbarFrame() const
virtual void ShowCloseTab(Bool_t show)
TGHorizontalFrame * fPreMenuFrame
First (owned) menu frame.
TGLayoutHints * fLH5
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.
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.
void HandleMenu(Int_t id)
Handle menu entries events.
TGVSplitter * fVSplitter
Vertical splitter.
TGHorizontalFrame * fHf
Horizontal frame.
void RemoveTab(Int_t pos, Int_t subpos)
Remove tab element "subpos" from tab "pos".
TGTab * fTabBottom
Bottom Tab.
void Refresh(Bool_t force=kFALSE) override
Refresh the actual browser contents.
TGPopupMenu * fMenuFile
"File" popup menu
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.
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.
TGStatusBar * GetStatusBar() const
TGTab * GetTabRight() const
void Add(TObject *obj, const char *name=nullptr, Int_t check=-1) override
Add items to the actual browser.
TGHorizontalFrame * fTopMenuFrame
Top menu frame.
TGLayoutHints * fLH3
Layout hints, part 1.
TGMenuBar * fMenuBar
Main (owned) menu bar.
Int_t fNbInitPlugins
Number of initial plugins (from .rootrc)
void InitPlugins(Option_t *opt="")
Initialize default plugins.
TGVerticalFrame * fV2
Vertical frame.
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.
TGHorizontalFrame * fToolbarFrame
Toolbar frame.
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