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//
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{0}; // Tab number
38 Int_t fSubTab{0}; // 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 {
54 TRootBrowser(const TRootBrowser&) = delete;
56
57protected:
58
59 TGLayoutHints *fLH0, *fLH1, *fLH2, *fLH3; // Layout hints, part 1
60 TGLayoutHints *fLH4, *fLH5, *fLH6, *fLH7; // Layout hints, part 2
61 TGTab *fTabLeft; // Left Tab
62 TGTab *fTabRight; // Right Tab
63 TGTab *fTabBottom; // Bottom Tab
64 TGTab *fEditTab; // Tab in "Edit" mode
65 Int_t fEditPos; // Id of tab in "Edit" mode
66 Int_t fEditSubPos; // Id of subtab in "Edit" mode
67 TGVerticalFrame *fVf; // Vertical frame
68 TGHorizontalFrame *fHf; // Horizontal frame
69 TGHorizontalFrame *fH1; // Horizontal frame
70 TGHorizontalFrame *fH2; // Horizontal frame
71 TGVerticalFrame *fV1; // Vertical frame
72 TGVerticalFrame *fV2; // Vertical frame
73 TGVSplitter *fVSplitter; // Vertical splitter
74 TGHSplitter *fHSplitter; // Horizontal splitter
75 TGCompositeFrame *fEditFrame; // Frame in "Edit" mode
76 TGHorizontalFrame *fTopMenuFrame; // Top menu frame
77 TGHorizontalFrame *fPreMenuFrame; // First (owned) menu frame
78 TGHorizontalFrame *fMenuFrame; // Shared menu frame
80 TGMenuBar *fMenuBar; // Main (owned) menu bar
81 TGPopupMenu *fMenuFile; // "File" popup menu
82 TGPopupMenu *fMenuExecPlugin; // "Exec Plugin" popup menu
83 TGPopupMenu *fMenuHelp; // "Browser Help" popup menu
84 TGCompositeFrame *fActMenuBar; // Actual (active) menu bar
85 TBrowserImp *fActBrowser; // Actual (active) browser imp
86 TList fBrowsers; // List of (sub)browsers
87 TList fPlugins; // List of plugins
88 TGStatusBar *fStatusBar; // Status bar
89 Int_t fNbInitPlugins; // Number of initial plugins (from .rootrc)
90 Int_t fNbTab[3]; // Number of tab elements (for each Tab)
91 Int_t fCrTab[3]; // Actual (active) tab elements (for each Tab)
92 Int_t fPid; // Current process id
93 Bool_t fShowCloseTab; // kTRUE to show close icon on tab elements
94 const TGPicture *fIconPic; // icon picture
95
96public:
98 kBrowse = 11011,
117 };
118
121 };
122
123 TRootBrowser(TBrowser *b = nullptr, const char *name = "ROOT Browser", UInt_t width = 800, UInt_t height = 500, Option_t *opt = "", Bool_t initshow = kTRUE);
124 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);
125 virtual ~TRootBrowser();
126
127 void InitPlugins(Option_t *opt="");
128
129 void CreateBrowser(const char *name);
130 void CloneBrowser();
131 void CloseWindow() override;
132 virtual void CloseTab(Int_t id);
133 void CloseTabs() override;
134 void DoTab(Int_t id);
135 void EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected);
136 TGFrame *GetActFrame() const { return (TGFrame *)fEditFrame; }
139 TGTab *GetTabLeft() const { return fTabLeft; }
140 TGTab *GetTabRight() const { return fTabRight; }
141 TGTab *GetTabBottom() const { return fTabBottom; }
142 TGTab *GetTab(Int_t pos) const;
143 void SetTab(Int_t pos = kRight, Int_t subpos = -1);
144 void SetTabTitle(const char *title, Int_t pos = kRight, Int_t subpos = -1);
145 void HandleMenu(Int_t id);
146 void RecursiveReparent(TGPopupMenu *popup);
147 void RemoveTab(Int_t pos, Int_t subpos);
149 void ShowMenu(TGCompositeFrame *menu);
150 void StartEmbedding(Int_t pos = kRight, Int_t subpos = -1) override;
151 void StopEmbedding(const char *name = nullptr) override { StopEmbedding(name, 0); }
152 void StopEmbedding(const char *name, TGLayoutHints *layout);
153 void SwitchMenus(TGCompositeFrame *from);
154
155 void BrowseObj(TObject *obj) override; //*SIGNAL*
156 void ExecuteDefaultAction(TObject *obj) override; //*SIGNAL*
157 virtual void DoubleClicked(TObject *obj); //*SIGNAL*
158 virtual void Checked(TObject *obj, Bool_t check); //*SIGNAL*
159
160 void Add(TObject *obj, const char *name = nullptr, Int_t check = -1) override;
161 void RecursiveRemove(TObject *obj) override;
162 void Refresh(Bool_t force = kFALSE) override;
163 void Show() override { MapRaised(); }
164 Option_t *GetDrawOption() const override;
165 TGMainFrame *GetMainFrame() const override { return (TGMainFrame *)this; }
166
167 Long_t ExecPlugin(const char *name = nullptr, const char *fname = nullptr,
168 const char *cmd = nullptr, Int_t pos = kRight,
169 Int_t subpos = -1) override;
170 void SetStatusText(const char *txt, Int_t col) override;
171 Bool_t HandleKey(Event_t *event) override;
172
173 virtual void ShowCloseTab(Bool_t show) { fShowCloseTab = show; }
174 virtual Bool_t IsCloseTabShown() const { return fShowCloseTab; }
176
177 // overridden from TGMainFrame
178 void ReallyDelete() override;
179
180 static TBrowserImp *NewBrowser(TBrowser *b = nullptr, 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 ClassDefOverride(TRootBrowser, 0) // New ROOT Browser
184};
185
186#endif
#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:92
long Long_t
Definition RtypesCore.h:54
bool Bool_t
Definition RtypesCore.h:63
const Bool_t kTRUE
Definition RtypesCore.h:91
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
virtual ~TBrowserPlugin()
void SetCommand(const char *cmd)
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
virtual void MapRaised()
map raised
Definition TGFrame.h:229
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
TGHorizontalFrame * fMenuFrame
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
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
Int_t fCrTab[3]
void ExecuteDefaultAction(TObject *obj) override
Emits signal "ExecuteDefaultAction(TObject*)".
TRootBrowser(const TRootBrowser &)=delete
TGTab * GetTabBottom() const
TGHorizontalFrame * fH2
Int_t fNbTab[3]
TGStatusBar * fStatusBar
Bool_t IsWebGUI()
Check if the GUI factory is set to use the Web GUI.
TGVerticalFrame * fVf
virtual void DoubleClicked(TObject *obj)
Emits signal when double clicking on icon.
TGLayoutHints * fLH6
TGHSplitter * fHSplitter
TBrowserImp * fActBrowser
void SetActBrowser(TBrowserImp *b)
TGCompositeFrame * fEditFrame
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 contructor returning TBrowserImp, as needed by the plugin mechanism.
TGCompositeFrame * fActMenuBar
TGLayoutHints * fLH1
void ReallyDelete() override
Really delete the browser and the this GUI.
void StopEmbedding(const char *name=nullptr) override
const TGPicture * fIconPic
virtual Bool_t IsCloseTabShown() const
Int_t fEditSubPos
TGTab * fEditTab
TGLayoutHints * fLH2
void Show() override
TGVerticalFrame * fV1
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
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.
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
void HandleMenu(Int_t id)
Handle menu entries events.
TGVSplitter * fVSplitter
TGHorizontalFrame * fHf
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
void Refresh(Bool_t force=kFALSE) override
Refresh the actual browser contents.
TGPopupMenu * fMenuFile
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
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 culumn col in status bar.
void CloseWindow() override
Called when window is closed via the window manager.
TGTab * fTabLeft
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
TGLayoutHints * fLH3
TGMenuBar * fMenuBar
Int_t fNbInitPlugins
void InitPlugins(Option_t *opt="")
Initialize default plugins.
TGVerticalFrame * fV2
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
TGHorizontalFrame * fToolbarFrame
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