Logo ROOT  
Reference Guide
TRootBrowserLite.h
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 27/02/98
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 
13 #ifndef ROOT_TRootBrowserLite
14 #define ROOT_TRootBrowserLite
15 
16 
17 #include "TBrowserImp.h"
18 #include "TGFrame.h"
19 
20 class TGMenuBar;
21 class TGPopupMenu;
22 class TGLayoutHints;
23 class TGStatusBar;
24 class TGHorizontal3DLine;
25 class TGToolBar;
26 class TGButton;
27 class TGFSComboBox;
28 class TGLabel;
29 class TGListView;
30 class TRootIconBox;
31 class TGCanvas;
32 class TGListTree;
33 class TGListTreeItem;
34 class TGFileItem;
35 class TList;
36 class TGFileContainer;
37 class TGComboBox;
38 class TGTextEdit;
39 
40 class TRootBrowserLite : public TGMainFrame, public TBrowserImp {
41 
42 friend class TRootIconBox;
43 
44 private:
55 
61  TGComboBox *fDrawOption; ///< drawing option entry
65 
67  TList *fHistory; ///< history of browsing
68  TObject *fHistoryCursor; ///< current history position
69  const TGPicture *fIconPic; ///< icon picture
70 
71  void CreateBrowser(const char *name);
74  void HighlightListLevel();
75  void AddToHistory(TGListTreeItem *item);
76  void IconBoxAction(TObject *obj);
77  void Chdir(TGListTreeItem *item);
78  void DisplayDirectory();
79  void DisplayTotal(Int_t total, Int_t selected);
80  void SetViewMode(Int_t new_mode, Bool_t force = kFALSE);
81  void ToSystemDirectory(const char *dirname);
82  void UpdateDrawOption();
83  void Search();
84  void BrowseTextFile(const char *file);
85  void HideTextEdit();
86  void ShowMacroButtons(Bool_t show = kTRUE);
87 
90  void ClearHistory();
91 
94 
95 protected:
105  TGButton *fToolBarButton[7]; ///< same size as gToolBarData[]
108  TGListTreeItem *fListLevel; ///< current TGListTree level
109  Bool_t fTreeLock; ///< true when we want to lock TGListTree
110  Int_t fViewMode; ///< current IconBox view mode
111  Int_t fSortMode; ///< current IconBox sort mode
112  TGTextEdit *fTextEdit; ///< contents of browsed text file
113 
114 public:
115  TRootBrowserLite(TBrowser *b = nullptr, const char *title = "ROOT Browser", UInt_t width = 800, UInt_t height = 500);
116  TRootBrowserLite(TBrowser *b, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height);
117  virtual ~TRootBrowserLite();
118 
119  void Add(TObject *obj, const char *name = nullptr, Int_t check = -1) override;
120  virtual void AddToBox(TObject *obj, const char *name);
121  virtual void AddToTree(TObject *obj, const char *name, Int_t check = -1);
122 
123  void AddCheckBox(TObject *obj, Bool_t check = kFALSE) override;
124  void CheckObjectItem(TObject *obj, Bool_t check = kFALSE) override;
125  void RemoveCheckBox(TObject *obj) override;
126 
127  void BrowseObj(TObject *obj) override; //*SIGNAL*
128  void ExecuteDefaultAction(TObject *obj) override; //*SIGNAL*
129  virtual void DoubleClicked(TObject *obj); //*SIGNAL*
130  virtual void Checked(TObject *obj, Bool_t check); //*SIGNAL*
131  void CloseTabs() override { }
132  void Iconify() override { }
133  void RecursiveRemove(TObject *obj) override;
134  void Refresh(Bool_t force = kFALSE) override;
135  virtual void ResizeBrowser() { }
136  virtual void ShowToolBar(Bool_t show = kTRUE);
137  virtual void ShowStatusBar(Bool_t show = kTRUE);
138  void Show() override { MapRaised(); }
139  virtual void SetDefaults(const char *iconStyle = nullptr, const char *sortBy = nullptr);
140  Bool_t HandleKey(Event_t *event) override;
141  void SetStatusText(const char *txt, Int_t col) override;
142 
143  TGListTree *GetListTree() const { return fLt; }
144  TGFileContainer *GetIconBox() const;
145  TGStatusBar *GetStatusBar() const { return fStatusBar; }
146  TGMenuBar *GetMenuBar() const { return fMenuBar; }
147  TGToolBar *GetToolBar() const { return fToolBar; }
148  void SetDrawOption(Option_t *option = "") override;
149  Option_t *GetDrawOption() const override;
150  void SetSortMode(Int_t new_mode);
151  TGMainFrame *GetMainFrame() const override { return (TGMainFrame *)this; }
152 
153  // overridden from TGMainFrame
154  void CloseWindow() override;
155  Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) override;
156  void ReallyDelete() override;
157 
158  // auxiliary (a la private) methods
159  void ExecMacro();
160  void InterruptMacro();
161 
162  static TBrowserImp *NewBrowser(TBrowser *b = nullptr, const char *title = "ROOT Browser", UInt_t width = 800, UInt_t height = 500, Option_t *opt="");
163  static TBrowserImp *NewBrowser(TBrowser *b, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height, Option_t *opt="");
164 
165  ClassDefOverride(TRootBrowserLite,0) //ROOT native GUI version of browser
166 };
167 
168 #endif
TRootBrowserLite::DoubleClicked
virtual void DoubleClicked(TObject *obj)
Emits signal when double clicking on icon.
Definition: TRootBrowserLite.cxx:2551
TRootBrowserLite::Refresh
void Refresh(Bool_t force=kFALSE) override
Refresh the browser contents.
Definition: TRootBrowserLite.cxx:2760
TRootBrowserLite::SetStatusText
void SetStatusText(const char *txt, Int_t col) override
Set text in column col in status bar.
Definition: TRootBrowserLite.cxx:3143
TRootBrowserLite::fSortMode
Int_t fSortMode
current IconBox sort mode
Definition: TRootBrowserLite.h:111
TRootBrowserLite::ExecuteDefaultAction
void ExecuteDefaultAction(TObject *obj) override
Execute default action for selected object (action is specified in the $HOME/.root....
Definition: TRootBrowserLite.cxx:1642
TBrowser
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
TRootBrowserLite::HistoryForward
Bool_t HistoryForward()
go to the future
Definition: TRootBrowserLite.cxx:2345
TRootBrowserLite::fStatusBar
TGStatusBar * fStatusBar
Definition: TRootBrowserLite.h:107
TRootBrowserLite::fTreeView
TGCanvas * fTreeView
Definition: TRootBrowserLite.h:103
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
TRootBrowserLite::Search
void Search()
starts serach dialog
Definition: TRootBrowserLite.cxx:2964
TRootBrowserLite::fTextFileName
TString fTextFileName
Definition: TRootBrowserLite.h:64
TGMainFrame
Defines top level windows that interact with the system Window Manager.
Definition: TGFrame.h:398
TGFileContainer
Definition: TGFSContainer.h:115
TRootBrowserLite::DisplayDirectory
void DisplayDirectory()
Display current directory in second label, fLbl2.
Definition: TRootBrowserLite.cxx:1601
TRootBrowserLite::operator=
TRootBrowserLite & operator=(const TRootBrowserLite &)=delete
TGPicture
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition: TGPicture.h:25
TGFileItem
Definition: TGFSContainer.h:42
TRootBrowserLite::fHf
TGHorizontalFrame * fHf
Definition: TRootBrowserLite.h:52
Option_t
const char Option_t
Definition: RtypesCore.h:66
TRootBrowserLite::ReallyDelete
void ReallyDelete() override
Really delete the browser and the this GUI.
Definition: TRootBrowserLite.cxx:1566
TGHorizontal3DLine
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition: TG3DLine.h:18
TRootBrowserLite::~TRootBrowserLite
virtual ~TRootBrowserLite()
Browser destructor.
Definition: TRootBrowserLite.cxx:929
TRootBrowserLite::GetDrawOption
Option_t * GetDrawOption() const override
returns drawing option
Definition: TRootBrowserLite.cxx:2544
TRootBrowserLite::ProcessMessage
Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) override
Handle menu and other command generated by the user.
Definition: TRootBrowserLite.cxx:1767
TRootBrowserLite::DeleteListTreeItem
void DeleteListTreeItem(TGListTreeItem *item)
delete list tree item, remove it from history
Definition: TRootBrowserLite.cxx:2382
TRootBrowserLite::GetIconBox
TGFileContainer * GetIconBox() const
returns pointer to fIconBox object
Definition: TRootBrowserLite.cxx:1558
TRootBrowserLite::fLbl2
TGLabel * fLbl2
Definition: TRootBrowserLite.h:51
TRootBrowserLite::AddToTree
virtual void AddToTree(TObject *obj, const char *name, Int_t check=-1)
Add items to the current TGListTree of the browser.
Definition: TRootBrowserLite.cxx:1422
TRootBrowserLite::ExecMacro
void ExecMacro()
executed browsed text macro
Definition: TRootBrowserLite.cxx:3091
TRootBrowserLite::CloseTabs
void CloseTabs() override
Definition: TRootBrowserLite.h:131
TRootBrowserLite::fBrowseTextFile
Bool_t fBrowseTextFile
Definition: TRootBrowserLite.h:63
TGLabel
This class handles GUI labels.
Definition: TGLabel.h:24
TRootBrowserLite::fTreeHdr
TGCompositeFrame * fTreeHdr
Definition: TRootBrowserLite.h:53
TGToolBar
A toolbar is a composite frame that contains TGPictureButtons.
Definition: TGToolBar.h:33
TRootBrowserLite::fLt
TGListTree * fLt
Definition: TRootBrowserLite.h:104
TRootBrowserLite::AddToBox
virtual void AddToBox(TObject *obj, const char *name)
Add items to the iconbox of the browser.
Definition: TRootBrowserLite.cxx:1392
width
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
TRootBrowserLite::GetToolBar
TGToolBar * GetToolBar() const
Definition: TRootBrowserLite.h:147
TRootBrowserLite::fToolBar
TGToolBar * fToolBar
Definition: TRootBrowserLite.h:46
TRootBrowserLite::GetMainFrame
TGMainFrame * GetMainFrame() const override
Definition: TRootBrowserLite.h:151
Int_t
int Int_t
Definition: RtypesCore.h:45
TRootBrowserLite::fIconBox
TRootIconBox * fIconBox
Definition: TRootBrowserLite.h:102
TGListTree
A list tree is a widget that can contain a number of items arranged in a tree structure.
Definition: TGListTree.h:195
TRootBrowserLite::SetDrawOption
void SetDrawOption(Option_t *option="") override
sets drawing option
Definition: TRootBrowserLite.cxx:2536
TRootBrowserLite
This class creates a ROOT object browser (looking like Windows Explorer).
Definition: TRootBrowserLite.h:40
event
Definition: triangle.c:553
x
Double_t x[n]
Definition: legend1.C:17
TRootBrowserLite::ShowToolBar
virtual void ShowToolBar(Bool_t show=kTRUE)
Show or hide toolbar.
Definition: TRootBrowserLite.cxx:2802
TGHorizontalFrame
A composite frame that layout their children in horizontal way.
Definition: TGFrame.h:386
TRootBrowserLite::SetSortMode
void SetSortMode(Int_t new_mode)
Set iconbox's sort mode and update menu radio buttons accordingly.
Definition: TRootBrowserLite.cxx:2933
TRootBrowserLite::ShowMacroButtons
void ShowMacroButtons(Bool_t show=kTRUE)
show/hide macro buttons
Definition: TRootBrowserLite.cxx:3115
TRootBrowserLite::TRootBrowserLite
TRootBrowserLite(const TRootBrowserLite &)=delete
TRootBrowserLite::fMenuBarLayout
TGLayoutHints * fMenuBarLayout
Definition: TRootBrowserLite.h:56
TRootBrowserLite::fExpandLayout
TGLayoutHints * fExpandLayout
Definition: TRootBrowserLite.h:62
TRootBrowserLite::Iconify
void Iconify() override
Definition: TRootBrowserLite.h:132
TRootBrowserLite::ClearHistory
void ClearHistory()
clear navigation history
Definition: TRootBrowserLite.cxx:2298
TString
Basic string class.
Definition: TString.h:136
ClassDefOverride
#define ClassDefOverride(name, id)
Definition: Rtypes.h:329
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TRootBrowserLite::NewBrowser
static TBrowserImp * NewBrowser(TBrowser *b=nullptr, const char *title="ROOT Browser", UInt_t width=800, UInt_t height=500, Option_t *opt="")
Interface method to the old browser.
Definition: TRootBrowserLite.cxx:3155
TGListView
A list view is a widget that can contain a number of items arranged in a grid or list.
Definition: TGListView.h:115
b
#define b(i)
Definition: RSha256.hxx:100
TRootBrowserLite::fToolBarButton
TGButton * fToolBarButton[7]
same size as gToolBarData[]
Definition: TRootBrowserLite.h:105
bool
TRootBrowserLite::fHelpMenu
TGPopupMenu * fHelpMenu
Definition: TRootBrowserLite.h:99
TRootBrowserLite::UpdateDrawOption
void UpdateDrawOption()
add new draw option to the "history"
Definition: TRootBrowserLite.cxx:1534
TRootBrowserLite::ShowStatusBar
virtual void ShowStatusBar(Bool_t show=kTRUE)
Show or hide statusbar.
Definition: TRootBrowserLite.cxx:2818
TRootBrowserLite::fBarLayout
TGLayoutHints * fBarLayout
Definition: TRootBrowserLite.h:60
TBrowserImp.h
TGStatusBar
Provides a StatusBar widget.
Definition: TGStatusBar.h:21
total
static unsigned int total
Definition: TGWin32ProxyDefs.h:40
TRootBrowserLite::GetStatusBar
TGStatusBar * GetStatusBar() const
Definition: TRootBrowserLite.h:145
TRootBrowserLite::fHistory
TList * fHistory
history of browsing
Definition: TRootBrowserLite.h:67
TRootBrowserLite::CreateBrowser
void CreateBrowser(const char *name)
Create the actual browser.
Definition: TRootBrowserLite.cxx:974
TRootBrowserLite::fV2
TGVerticalFrame * fV2
Definition: TRootBrowserLite.h:49
TGTextEdit
A TGTextEdit is a specialization of TGTextView.
Definition: TGTextEdit.h:22
TRootBrowserLite::fComboLayout
TGLayoutHints * fComboLayout
Definition: TRootBrowserLite.h:59
TBrowserImp
ABC describing GUI independent browser implementation protocol.
Definition: TBrowserImp.h:29
TRootBrowserLite::AddToHistory
void AddToHistory(TGListTreeItem *item)
helper method to track history
Definition: TRootBrowserLite.cxx:2276
TRootBrowserLite::fMenuBarItemLayout
TGLayoutHints * fMenuBarItemLayout
Definition: TRootBrowserLite.h:57
TRootBrowserLite::Show
void Show() override
Definition: TRootBrowserLite.h:138
TRootBrowserLite::fTextEdit
TGTextEdit * fTextEdit
contents of browsed text file
Definition: TRootBrowserLite.h:112
TGVerticalFrame
A composite frame that layout their children in vertical way.
Definition: TGFrame.h:375
TRootBrowserLite::fListLevel
TGListTreeItem * fListLevel
current TGListTree level
Definition: TRootBrowserLite.h:108
TRootBrowserLite::HistoryBackward
Bool_t HistoryBackward()
go to the past
Definition: TRootBrowserLite.cxx:2310
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
TRootBrowserLite::fFSComboBox
TGFSComboBox * fFSComboBox
Definition: TRootBrowserLite.h:106
TRootBrowserLite::IconBoxAction
void IconBoxAction(TObject *obj)
Default action when double clicking on icon.
Definition: TRootBrowserLite.cxx:2572
TGFrame.h
Long_t
long Long_t
Definition: RtypesCore.h:54
TRootBrowserLite::Add
void Add(TObject *obj, const char *name=nullptr, Int_t check=-1) override
Add items to the browser.
Definition: TRootBrowserLite.cxx:1286
TGLayoutHints
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
TRootBrowserLite::fHistoryCursor
TObject * fHistoryCursor
current history position
Definition: TRootBrowserLite.h:68
TRootBrowserLite::fSortMenu
TGPopupMenu * fSortMenu
Definition: TRootBrowserLite.h:100
TGFrame::MapRaised
virtual void MapRaised()
map raised
Definition: TGFrame.h:205
TRootBrowserLite::ToSystemDirectory
void ToSystemDirectory(const char *dirname)
display directory
Definition: TRootBrowserLite.cxx:2499
TRootBrowserLite::HandleKey
Bool_t HandleKey(Event_t *event) override
handle keys
Definition: TRootBrowserLite.cxx:1249
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
TRootBrowserLite::ListTreeHighlight
void ListTreeHighlight(TGListTreeItem *item)
Open tree item and list in iconbox its contents.
Definition: TRootBrowserLite.cxx:2391
TRootBrowserLite::SetViewMode
void SetViewMode(Int_t new_mode, Bool_t force=kFALSE)
Set iconbox's view mode and update menu and toolbar buttons accordingly.
Definition: TRootBrowserLite.cxx:2874
y
Double_t y[n]
Definition: legend1.C:17
TRootBrowserLite::fMenuBar
TGMenuBar * fMenuBar
Definition: TRootBrowserLite.h:45
TRootBrowserLite::fViewMode
Int_t fViewMode
current IconBox view mode
Definition: TRootBrowserLite.h:110
TRootBrowserLite::fFileMenu
TGPopupMenu * fFileMenu
Definition: TRootBrowserLite.h:96
TRootBrowserLite::ResizeBrowser
virtual void ResizeBrowser()
Definition: TRootBrowserLite.h:135
TRootBrowserLite::RemoveCheckBox
void RemoveCheckBox(TObject *obj) override
Remove checkbox from TGListTree and checkmark from TGListView.
Definition: TRootBrowserLite.cxx:1368
TRootBrowserLite::Chdir
void Chdir(TGListTreeItem *item)
Make object associated with item the current directory.
Definition: TRootBrowserLite.cxx:2232
TRootBrowserLite::DisplayTotal
void DisplayTotal(Int_t total, Int_t selected)
Display in statusbar total number of objects and number of selected objects in IconBox.
Definition: TRootBrowserLite.cxx:1584
TRootBrowserLite::GetMenuBar
TGMenuBar * GetMenuBar() const
Definition: TRootBrowserLite.h:146
TRootBrowserLite::BrowseObj
void BrowseObj(TObject *obj) override
Browse object.
Definition: TRootBrowserLite.cxx:1498
unsigned int
TRootBrowserLite::CloseWindow
void CloseWindow() override
In case window is closed via WM we get here.
Definition: TRootBrowserLite.cxx:1575
TGComboBox
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition: TGComboBox.h:47
TRootBrowserLite::InterruptMacro
void InterruptMacro()
interrupt browsed macro execution
Definition: TRootBrowserLite.cxx:3107
TRootBrowserLite::fV1
TGVerticalFrame * fV1
Definition: TRootBrowserLite.h:48
TGFSComboBox
This is a combo box that is used in the File Selection dialog box.
Definition: TGFSComboBox.h:67
TRootBrowserLite::BrowseTextFile
void BrowseTextFile(const char *file)
browse text file
Definition: TRootBrowserLite.cxx:3013
TRootBrowserLite::Checked
virtual void Checked(TObject *obj, Bool_t check)
Emits signal when double clicking on icon.
Definition: TRootBrowserLite.cxx:2559
TRootBrowserLite::fOptionMenu
TGPopupMenu * fOptionMenu
Definition: TRootBrowserLite.h:98
TRootBrowserLite::fListView
TGListView * fListView
Definition: TRootBrowserLite.h:101
TRootBrowserLite::fViewMenu
TGPopupMenu * fViewMenu
Definition: TRootBrowserLite.h:97
file
Definition: file.py:1
TRootBrowserLite::CheckObjectItem
void CheckObjectItem(TObject *obj, Bool_t check=kFALSE) override
Check / uncheck the TGListTreeItem corresponding to this object and add a checkmark on TGLVEntry if c...
Definition: TRootBrowserLite.cxx:1344
TRootBrowserLite::fToolBarSep
TGHorizontal3DLine * fToolBarSep
Definition: TRootBrowserLite.h:47
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
TRootBrowserLite::HideTextEdit
void HideTextEdit()
hide text edit
Definition: TRootBrowserLite.cxx:2990
TRootBrowserLite::fListHdr
TGCompositeFrame * fListHdr
Definition: TRootBrowserLite.h:54
TGPopupMenu
This class creates a popup menu object.
Definition: TGMenu.h:110
TRootBrowserLite::RecursiveRemove
void RecursiveRemove(TObject *obj) override
Recursively remove object from browser.
Definition: TRootBrowserLite.cxx:2734
Event_t
Event structure.
Definition: GuiTypes.h:174
name
char name[80]
Definition: TGX11.cxx:110
TRootBrowserLite::fTreeLock
Bool_t fTreeLock
true when we want to lock TGListTree
Definition: TRootBrowserLite.h:109
TRootIconBox
Definition: TRootBrowserLite.cxx:385
TRootBrowserLite::fLbl1
TGLabel * fLbl1
Definition: TRootBrowserLite.h:50
TRootBrowserLite::fWidgets
TList * fWidgets
Definition: TRootBrowserLite.h:66
TRootBrowserLite::HighlightListLevel
void HighlightListLevel()
helper method to track history
Definition: TRootBrowserLite.cxx:2265
TGMenuBar
The TGMenu.h header contains all different menu classes.
Definition: TGMenu.h:282
TRootBrowserLite::fDrawOption
TGComboBox * fDrawOption
drawing option entry
Definition: TRootBrowserLite.h:61
TGButton
A button abstract base class.
Definition: TGButton.h:68
TRootBrowserLite::AddCheckBox
void AddCheckBox(TObject *obj, Bool_t check=kFALSE) override
Add a checkbox in the TGListTreeItem corresponding to obj and a checkmark on TGLVEntry if check = kTR...
Definition: TRootBrowserLite.cxx:1320
TGCompositeFrame
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
TGCanvas
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition: TGCanvas.h:192
TRootBrowserLite::GetListTree
TGListTree * GetListTree() const
Definition: TRootBrowserLite.h:143
TGListTreeItem
Definition: TGListTree.h:27
TRootBrowserLite::SetDefaults
virtual void SetDefaults(const char *iconStyle=nullptr, const char *sortBy=nullptr)
Set defaults depending on settings in the user's .rootrc.
Definition: TRootBrowserLite.cxx:2832
TRootBrowserLite::fIconPic
const TGPicture * fIconPic
icon picture
Definition: TRootBrowserLite.h:69
TList
A doubly linked list.
Definition: TList.h:44
TRootBrowserLite::fMenuBarHelpLayout
TGLayoutHints * fMenuBarHelpLayout
Definition: TRootBrowserLite.h:58
int