ROOT  6.06/09
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-2000, 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 // //
18 // TRootBrowserLite //
19 // //
20 // This class creates a ROOT object browser (looking like Windows //
21 // Explorer). The widgets used are the new native ROOT GUI widgets. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #ifndef ROOT_TBrowserImp
26 #include "TBrowserImp.h"
27 #endif
28 #ifndef ROOT_TGFrame
29 #include "TGFrame.h"
30 #endif
31 
32 class TGMenuBar;
33 class TGPopupMenu;
34 class TGLayoutHints;
35 class TGStatusBar;
36 class TGHorizontal3DLine;
37 class TGToolBar;
38 class TGButton;
39 class TGFSComboBox;
40 class TGLabel;
41 class TGListView;
42 class TRootIconBox;
43 class TGCanvas;
44 class TGListTree;
45 class TGListTreeItem;
46 class TGFileItem;
47 class TList;
48 class TGFileContainer;
49 class TGComboBox;
50 class TGTextEdit;
51 
52 class TRootBrowserLite : public TGMainFrame, public TBrowserImp {
53 
54 friend class TRootIconBox;
55 
56 private:
67 
73  TGComboBox *fDrawOption; // drawing option entry
77 
79  TList *fHistory; // history of browsing
80  TObject *fHistoryCursor; // current hsitory position
81  const TGPicture *fIconPic; // icon picture
82 
83  void CreateBrowser(const char *name);
86  void HighlightListLevel();
87  void AddToHistory(TGListTreeItem *item);
88  void IconBoxAction(TObject *obj);
89  void Chdir(TGListTreeItem *item);
90  void DisplayDirectory();
91  void DisplayTotal(Int_t total, Int_t selected);
92  void SetViewMode(Int_t new_mode, Bool_t force = kFALSE);
93  void ToSystemDirectory(const char *dirname);
94  void UpdateDrawOption();
95  void Search();
96  void BrowseTextFile(const char *file);
97  void HideTextEdit();
98  void ShowMacroButtons(Bool_t show = kTRUE);
99 
102  void ClearHistory();
103 
104 protected:
114  TGButton *fToolBarButton[7]; // same size as gToolBarData[]
117  TGListTreeItem *fListLevel; // current TGListTree level
118  Bool_t fTreeLock; // true when we want to lock TGListTree
119  Int_t fViewMode; // current IconBox view mode
120  Int_t fSortMode; // current IconBox sort mode
121  TGTextEdit *fTextEdit; // contents of browsed text file
122 
123 public:
124  TRootBrowserLite(TBrowser *b = 0, const char *title = "ROOT Browser", UInt_t width = 800, UInt_t height = 500);
125  TRootBrowserLite(TBrowser *b, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height);
126  virtual ~TRootBrowserLite();
127 
128  virtual void Add(TObject *obj, const char *name = 0, Int_t check = -1);
129  virtual void AddToBox(TObject *obj, const char *name);
130  virtual void AddToTree(TObject *obj, const char *name, Int_t check = -1);
131 
132  virtual void AddCheckBox(TObject *obj, Bool_t check = kFALSE);
133  virtual void CheckObjectItem(TObject *obj, Bool_t check = kFALSE);
134  virtual void RemoveCheckBox(TObject *obj);
135 
136  virtual void BrowseObj(TObject *obj); //*SIGNAL*
137  virtual void ExecuteDefaultAction(TObject *obj); //*SIGNAL*
138  virtual void DoubleClicked(TObject *obj); //*SIGNAL*
139  virtual void Checked(TObject *obj, Bool_t check); //*SIGNAL*
140  virtual void CloseTabs() { }
141  virtual void Iconify() { }
142  virtual void RecursiveRemove(TObject *obj);
143  virtual void Refresh(Bool_t force = kFALSE);
144  virtual void ResizeBrowser() { }
145  virtual void ShowToolBar(Bool_t show = kTRUE);
146  virtual void ShowStatusBar(Bool_t show = kTRUE);
147  virtual void Show() { MapRaised(); }
148  virtual void SetDefaults(const char *iconStyle = 0, const char *sortBy = 0);
149  virtual Bool_t HandleKey(Event_t *event);
150  virtual void SetStatusText(const char *txt, Int_t col);
151 
152  TGListTree *GetListTree() const { return fLt; }
153  TGFileContainer *GetIconBox() const;
154  TGStatusBar *GetStatusBar() const { return fStatusBar; }
155  TGMenuBar *GetMenuBar() const { return fMenuBar; }
156  TGToolBar *GetToolBar() const { return fToolBar; }
157  void SetDrawOption(Option_t *option="");
158  Option_t *GetDrawOption() const;
159  void SetSortMode(Int_t new_mode);
160  TGMainFrame *GetMainFrame() const { return (TGMainFrame *)this; }
161 
162  // overridden from TGMainFrame
163  void CloseWindow();
164  Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
165  void ReallyDelete();
166 
167  // auxilary (a la privae) methods
168  void ExecMacro();
169  void InterruptMacro();
170 
171  static TBrowserImp *NewBrowser(TBrowser *b = 0, const char *title = "ROOT Browser", UInt_t width = 800, UInt_t height = 500, Option_t *opt="");
172  static TBrowserImp *NewBrowser(TBrowser *b, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height, Option_t *opt="");
173 
174  ClassDef(TRootBrowserLite,0) //ROOT native GUI version of browser
175 };
176 
177 #endif
TGToolBar * GetToolBar() const
virtual void AddToTree(TObject *obj, const char *name, Int_t check=-1)
Add items to the current TGListTree of the browser.
TGFSComboBox * fFSComboBox
TGLayoutHints * fMenuBarItemLayout
TGCompositeFrame * fListHdr
TGVerticalFrame * fV1
TGTextEdit * fTextEdit
void SetViewMode(Int_t new_mode, Bool_t force=kFALSE)
Set iconbox's view mode and update menu and toolbar buttons accordingly.
Option_t * GetDrawOption() const
returns drawing option
TGMenuBar * GetMenuBar() const
TGLayoutHints * fComboLayout
void SetDrawOption(Option_t *option="")
sets drawing option
TRootIconBox * fIconBox
TGPopupMenu * fViewMenu
const char Option_t
Definition: RtypesCore.h:62
virtual void SetStatusText(const char *txt, Int_t col)
Set text in column col in status bar.
Bool_t HistoryForward()
go to the future
void Search()
starts serach dialog
virtual void DoubleClicked(TObject *obj)
Emits signal when double clicking on icon.
TGToolBar * fToolBar
Basic string class.
Definition: TString.h:137
virtual void ShowStatusBar(Bool_t show=kTRUE)
Show or hide statusbar.
Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Handle menu and other command generated by the user.
virtual void CheckObjectItem(TObject *obj, Bool_t check=kFALSE)
Check / uncheck the TGListTreeItem corresponding to this object and add a checkmark on TGLVEntry if c...
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
void AddToHistory(TGListTreeItem *item)
helper method to track history
virtual void MapRaised()
Definition: TGFrame.h:268
TGLayoutHints * fMenuBarLayout
TGListView * fListView
static TBrowserImp * NewBrowser(TBrowser *b=0, const char *title="ROOT Browser", UInt_t width=800, UInt_t height=500, Option_t *opt="")
Interface method to the old browser.
TGLayoutHints * fExpandLayout
Double_t x[n]
Definition: legend1.C:17
TGMainFrame * GetMainFrame() const
void ShowMacroButtons(Bool_t show=kTRUE)
show/hide macro buttons
#define ClassDef(name, id)
Definition: Rtypes.h:254
TGPopupMenu * fSortMenu
TGCompositeFrame * fTreeHdr
TGButton * fToolBarButton[7]
TGListTreeItem * fListLevel
TGPopupMenu * fHelpMenu
virtual void AddToBox(TObject *obj, const char *name)
Add items to the iconbox of the browser.
void SetSortMode(Int_t new_mode)
Set iconbox's sort mode and update menu radio buttons accordingly.
virtual void BrowseObj(TObject *obj)
Browse object.
TGPopupMenu * fFileMenu
virtual void ShowToolBar(Bool_t show=kTRUE)
Show or hide toolbar.
virtual void Add(TObject *obj, const char *name=0, Int_t check=-1)
Add items to the browser.
TGMenuBar * fMenuBar
void IconBoxAction(TObject *obj)
Default action when double clicking on icon.
void UpdateDrawOption()
add new draw option to the "history"
TGStatusBar * GetStatusBar() const
virtual void CloseTabs()
A doubly linked list.
Definition: TList.h:47
TGListTree * GetListTree() const
void CloseWindow()
In case window is closed via WM we get here.
void CreateBrowser(const char *name)
Create the actual browser.
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:41
TGLayoutHints * fBarLayout
virtual void Show()
void DisplayTotal(Int_t total, Int_t selected)
Display in statusbar total number of objects and number of selected objects in IconBox.
virtual void ResizeBrowser()
TGHorizontal3DLine * fToolBarSep
virtual void RecursiveRemove(TObject *obj)
Recursively remove object from browser.
unsigned int UInt_t
Definition: RtypesCore.h:42
void ExecMacro()
executed browsed text macro
TGHorizontalFrame * fHf
Bool_t HistoryBackward()
go to the past
virtual void ExecuteDefaultAction(TObject *obj)
Execute default action for selected object (action is specified in the $HOME/.root.mimes or $ROOTSYS/etc/root.mimes file.
void Chdir(TGListTreeItem *item)
Make object associated with item the current directory.
TGComboBox * fDrawOption
TGVerticalFrame * fV2
void ClearHistory()
clear navigation history
static unsigned int total
long Long_t
Definition: RtypesCore.h:50
void ReallyDelete()
Really delete the browser and the this GUI.
virtual void SetDefaults(const char *iconStyle=0, const char *sortBy=0)
Set defaults depending on settings in the user's .rootrc.
virtual void RemoveCheckBox(TObject *obj)
Remove checkbox from TGListTree and checkmark from TGListView.
TObject * fHistoryCursor
TRootBrowserLite(TBrowser *b=0, const char *title="ROOT Browser", UInt_t width=800, UInt_t height=500)
virtual void AddCheckBox(TObject *obj, Bool_t check=kFALSE)
Add a checkbox in the TGListTreeItem corresponding to obj and a checkmark on TGLVEntry if check = kTR...
Double_t y[n]
Definition: legend1.C:17
TGFileContainer * GetIconBox() const
returns pointer to fIconBox object
void HideTextEdit()
hide text edit
void InterruptMacro()
interrupt browsed macro execution
void BrowseTextFile(const char *file)
browse text file
void HighlightListLevel()
helper method to track history
void DeleteListTreeItem(TGListTreeItem *item)
delete list tree item, remove it from history
void ListTreeHighlight(TGListTreeItem *item)
Open tree item and list in iconbox its contents.
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual void Iconify()
Mother of all ROOT objects.
Definition: TObject.h:58
TGLayoutHints * fMenuBarHelpLayout
virtual ~TRootBrowserLite()
Browser destructor.
virtual void Refresh(Bool_t force=kFALSE)
Refresh the browser contents.
virtual void Checked(TObject *obj, Bool_t check)
Emits signal when double clicking on icon.
TGStatusBar * fStatusBar
virtual Bool_t HandleKey(Event_t *event)
handle keys
const Bool_t kTRUE
Definition: Rtypes.h:91
friend class TRootIconBox
TObject * obj
void DisplayDirectory()
Display current directory in second label, fLbl2.
void ToSystemDirectory(const char *dirname)
display directory
TGPopupMenu * fOptionMenu
ABC describing GUI independent browser implementation protocol.
Definition: TBrowserImp.h:31
const TGPicture * fIconPic