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
20class TGMenuBar;
21class TGPopupMenu;
22class TGLayoutHints;
23class TGStatusBar;
25class TGToolBar;
26class TGButton;
27class TGFSComboBox;
28class TGLabel;
29class TGListView;
30class TRootIconBox;
31class TGCanvas;
32class TGListTree;
33class TGListTreeItem;
34class TGFileItem;
35class TList;
36class TGFileContainer;
37class TGComboBox;
38class TGTextEdit;
39
41
42friend class TRootIconBox;
43
44private:
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
95protected:
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
114public:
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; }
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(Longptr_t msg, Longptr_t parm1, Longptr_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
bool Bool_t
Definition: RtypesCore.h:63
int Int_t
Definition: RtypesCore.h:45
long Longptr_t
Definition: RtypesCore.h:82
const Bool_t kFALSE
Definition: RtypesCore.h:101
unsigned int UInt_t
Definition: RtypesCore.h:46
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
static unsigned int total
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
char name[80]
Definition: TGX11.cxx:110
ABC describing GUI independent browser implementation protocol.
Definition: TBrowserImp.h:29
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
A button abstract base class.
Definition: TGButton.h:68
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition: TGCanvas.h:192
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
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
This is a combo box that is used in the File Selection dialog box.
Definition: TGFSComboBox.h:67
void MapRaised() override
map raised
Definition: TGFrame.h:205
A horizontal 3D line is a line that typically separates a toolbar from the menubar.
Definition: TG3DLine.h:18
A composite frame that layout their children in horizontal way.
Definition: TGFrame.h:385
This class handles GUI labels.
Definition: TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
A list tree is a widget that can contain a number of items arranged in a tree structure.
Definition: TGListTree.h:195
A list view is a widget that can contain a number of items arranged in a grid or list.
Definition: TGListView.h:115
Defines top level windows that interact with the system Window Manager.
Definition: TGFrame.h:397
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 TGTextEdit is a specialization of TGTextView.
Definition: TGTextEdit.h:22
A toolbar is a composite frame that contains TGPictureButtons.
Definition: TGToolBar.h:33
A composite frame that layout their children in vertical way.
Definition: TGFrame.h:374
A doubly linked list.
Definition: TList.h:38
Mother of all ROOT objects.
Definition: TObject.h:37
This class creates a ROOT object browser (looking like Windows Explorer).
TGMenuBar * GetMenuBar() const
TRootBrowserLite & operator=(const TRootBrowserLite &)=delete
TGCompositeFrame * fTreeHdr
TGPopupMenu * fOptionMenu
TGToolBar * fToolBar
Bool_t HistoryBackward()
go to the past
void SetStatusText(const char *txt, Int_t col) override
Set text in column col in status bar.
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Handle menu and other command generated by the user.
void SetViewMode(Int_t new_mode, Bool_t force=kFALSE)
Set iconbox's view mode and update menu and toolbar buttons accordingly.
void Refresh(Bool_t force=kFALSE) override
Refresh the browser contents.
TGLayoutHints * fMenuBarHelpLayout
void ListTreeHighlight(TGListTreeItem *item)
Open tree item and list in iconbox its contents.
virtual void ResizeBrowser()
TGFileContainer * GetIconBox() const
returns pointer to fIconBox object
TGMainFrame * GetMainFrame() const override
void SetSortMode(Int_t new_mode)
Set iconbox's sort mode and update menu radio buttons accordingly.
TGButton * fToolBarButton[7]
same size as gToolBarData[]
void ClearHistory()
clear navigation history
TGListTreeItem * fListLevel
current TGListTree level
TGLayoutHints * fExpandLayout
void RecursiveRemove(TObject *obj) override
Recursively remove object from browser.
TGPopupMenu * fFileMenu
TGPopupMenu * fSortMenu
void BrowseTextFile(const char *file)
browse text file
Option_t * GetDrawOption() const override
returns drawing option
void ReallyDelete() override
Really delete the browser and the this GUI.
virtual void DoubleClicked(TObject *obj)
Emits signal when double clicking on icon.
TGLayoutHints * fComboLayout
void Chdir(TGListTreeItem *item)
Make object associated with item the current directory.
void ExecMacro()
executed browsed text macro
TGComboBox * fDrawOption
drawing option entry
virtual void ShowToolBar(Bool_t show=kTRUE)
Show or hide toolbar.
void HighlightListLevel()
helper method to track history
void CloseTabs() override
Bool_t HistoryForward()
go to the future
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.
TGLayoutHints * fMenuBarLayout
virtual void AddToTree(TObject *obj, const char *name, Int_t check=-1)
Add items to the current TGListTree of the browser.
TRootIconBox * fIconBox
const TGPicture * fIconPic
icon picture
void AddToHistory(TGListTreeItem *item)
helper method to track history
TGLayoutHints * fBarLayout
TGListTree * GetListTree() const
TGHorizontalFrame * fHf
void BrowseObj(TObject *obj) override
Browse object.
Bool_t fTreeLock
true when we want to lock TGListTree
void Show() override
TGMenuBar * fMenuBar
virtual void Checked(TObject *obj, Bool_t check)
Emits signal when double clicking on icon.
void DisplayTotal(Int_t total, Int_t selected)
Display in statusbar total number of objects and number of selected objects in IconBox.
TGVerticalFrame * fV1
void CloseWindow() override
In case window is closed via WM we get here.
Int_t fSortMode
current IconBox sort mode
void IconBoxAction(TObject *obj)
Default action when double clicking on icon.
TGLayoutHints * fMenuBarItemLayout
void HideTextEdit()
hide text edit
TGStatusBar * GetStatusBar() const
TGVerticalFrame * fV2
void DisplayDirectory()
Display current directory in second label, fLbl2.
void ShowMacroButtons(Bool_t show=kTRUE)
show/hide macro buttons
virtual void AddToBox(TObject *obj, const char *name)
Add items to the iconbox of the browser.
virtual void ShowStatusBar(Bool_t show=kTRUE)
Show or hide statusbar.
TGToolBar * GetToolBar() const
TRootBrowserLite(const TRootBrowserLite &)=delete
void Search()
starts serach dialog
TGPopupMenu * fHelpMenu
TList * fHistory
history of browsing
TGListView * fListView
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...
Bool_t HandleKey(Event_t *event) override
handle keys
TObject * fHistoryCursor
current history position
Int_t fViewMode
current IconBox view mode
virtual void SetDefaults(const char *iconStyle=nullptr, const char *sortBy=nullptr)
Set defaults depending on settings in the user's .rootrc.
TGFSComboBox * fFSComboBox
void InterruptMacro()
interrupt browsed macro execution
void SetDrawOption(Option_t *option="") override
sets drawing option
virtual ~TRootBrowserLite()
Browser destructor.
TGCompositeFrame * fListHdr
void UpdateDrawOption()
add new draw option to the "history"
TGTextEdit * fTextEdit
contents of browsed text file
void Iconify() override
TGStatusBar * fStatusBar
void CreateBrowser(const char *name)
Create the actual browser.
void ToSystemDirectory(const char *dirname)
display directory
TGPopupMenu * fViewMenu
void ExecuteDefaultAction(TObject *obj) override
Execute default action for selected object (action is specified in the $HOME/.root....
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...
void Add(TObject *obj, const char *name=nullptr, Int_t check=-1) override
Add items to the browser.
void DeleteListTreeItem(TGListTreeItem *item)
delete list tree item, remove it from history
TGHorizontal3DLine * fToolBarSep
void RemoveCheckBox(TObject *obj) override
Remove checkbox from TGListTree and checkmark from TGListView.
Basic string class.
Definition: TString.h:136
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
Definition: file.py:1
Event structure.
Definition: GuiTypes.h:174