Logo ROOT   6.10/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 #include "TBrowserImp.h"
26 #include "TGFrame.h"
27 
28 class TGMenuBar;
29 class TGPopupMenu;
30 class TGLayoutHints;
31 class TGStatusBar;
32 class TGHorizontal3DLine;
33 class TGToolBar;
34 class TGButton;
35 class TGFSComboBox;
36 class TGLabel;
37 class TGListView;
38 class TRootIconBox;
39 class TGCanvas;
40 class TGListTree;
41 class TGListTreeItem;
42 class TGFileItem;
43 class TList;
44 class TGFileContainer;
45 class TGComboBox;
46 class TGTextEdit;
47 
48 class TRootBrowserLite : public TGMainFrame, public TBrowserImp {
49 
50 friend class TRootIconBox;
51 
52 private:
63 
69  TGComboBox *fDrawOption; // drawing option entry
73 
75  TList *fHistory; // history of browsing
76  TObject *fHistoryCursor; // current hsitory position
77  const TGPicture *fIconPic; // icon picture
78 
79  void CreateBrowser(const char *name);
82  void HighlightListLevel();
83  void AddToHistory(TGListTreeItem *item);
84  void IconBoxAction(TObject *obj);
85  void Chdir(TGListTreeItem *item);
86  void DisplayDirectory();
87  void DisplayTotal(Int_t total, Int_t selected);
88  void SetViewMode(Int_t new_mode, Bool_t force = kFALSE);
89  void ToSystemDirectory(const char *dirname);
90  void UpdateDrawOption();
91  void Search();
92  void BrowseTextFile(const char *file);
93  void HideTextEdit();
94  void ShowMacroButtons(Bool_t show = kTRUE);
95 
98  void ClearHistory();
99 
100 protected:
110  TGButton *fToolBarButton[7]; // same size as gToolBarData[]
113  TGListTreeItem *fListLevel; // current TGListTree level
114  Bool_t fTreeLock; // true when we want to lock TGListTree
115  Int_t fViewMode; // current IconBox view mode
116  Int_t fSortMode; // current IconBox sort mode
117  TGTextEdit *fTextEdit; // contents of browsed text file
118 
119 public:
120  TRootBrowserLite(TBrowser *b = 0, const char *title = "ROOT Browser", UInt_t width = 800, UInt_t height = 500);
121  TRootBrowserLite(TBrowser *b, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height);
122  virtual ~TRootBrowserLite();
123 
124  virtual void Add(TObject *obj, const char *name = 0, Int_t check = -1);
125  virtual void AddToBox(TObject *obj, const char *name);
126  virtual void AddToTree(TObject *obj, const char *name, Int_t check = -1);
127 
128  virtual void AddCheckBox(TObject *obj, Bool_t check = kFALSE);
129  virtual void CheckObjectItem(TObject *obj, Bool_t check = kFALSE);
130  virtual void RemoveCheckBox(TObject *obj);
131 
132  virtual void BrowseObj(TObject *obj); //*SIGNAL*
133  virtual void ExecuteDefaultAction(TObject *obj); //*SIGNAL*
134  virtual void DoubleClicked(TObject *obj); //*SIGNAL*
135  virtual void Checked(TObject *obj, Bool_t check); //*SIGNAL*
136  virtual void CloseTabs() { }
137  virtual void Iconify() { }
138  virtual void RecursiveRemove(TObject *obj);
139  virtual void Refresh(Bool_t force = kFALSE);
140  virtual void ResizeBrowser() { }
141  virtual void ShowToolBar(Bool_t show = kTRUE);
142  virtual void ShowStatusBar(Bool_t show = kTRUE);
143  virtual void Show() { MapRaised(); }
144  virtual void SetDefaults(const char *iconStyle = 0, const char *sortBy = 0);
145  virtual Bool_t HandleKey(Event_t *event);
146  virtual void SetStatusText(const char *txt, Int_t col);
147 
148  TGListTree *GetListTree() const { return fLt; }
149  TGFileContainer *GetIconBox() const;
150  TGStatusBar *GetStatusBar() const { return fStatusBar; }
151  TGMenuBar *GetMenuBar() const { return fMenuBar; }
152  TGToolBar *GetToolBar() const { return fToolBar; }
153  void SetDrawOption(Option_t *option="");
154  Option_t *GetDrawOption() const;
155  void SetSortMode(Int_t new_mode);
156  TGMainFrame *GetMainFrame() const { return (TGMainFrame *)this; }
157 
158  // overridden from TGMainFrame
159  void CloseWindow();
160  Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
161  void ReallyDelete();
162 
163  // auxilary (a la privae) methods
164  void ExecMacro();
165  void InterruptMacro();
166 
167  static TBrowserImp *NewBrowser(TBrowser *b = 0, const char *title = "ROOT Browser", UInt_t width = 800, UInt_t height = 500, Option_t *opt="");
168  static TBrowserImp *NewBrowser(TBrowser *b, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height, Option_t *opt="");
169 
170  ClassDef(TRootBrowserLite,0) //ROOT native GUI version of browser
171 };
172 
173 #endif
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.
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.
TGFileContainer * GetIconBox() const
returns pointer to fIconBox object
TGStatusBar * GetStatusBar() const
TGToolBar * fToolBar
Basic string class.
Definition: TString.h:129
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.
TGMainFrame * GetMainFrame() const
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
TGMenuBar * GetMenuBar() const
void AddToHistory(TGListTreeItem *item)
helper method to track history
virtual void MapRaised()
Definition: TGFrame.h:252
Option_t * GetDrawOption() const
returns drawing option
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
void ShowMacroButtons(Bool_t show=kTRUE)
show/hide macro buttons
#define ClassDef(name, id)
Definition: Rtypes.h:297
TGPopupMenu * fSortMenu
TGCompositeFrame * fTreeHdr
TGToolBar * GetToolBar() const
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"
virtual void CloseTabs()
A doubly linked list.
Definition: TList.h:43
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:37
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
const Bool_t kFALSE
Definition: RtypesCore.h:92
TGListTree * GetListTree() const
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)
Create browser with a specified width and height.
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
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.
virtual void Iconify()
Mother of all ROOT objects.
Definition: TObject.h:37
TGLayoutHints * fMenuBarHelpLayout
virtual ~TRootBrowserLite()
Browser destructor.
Definition: file.py:1
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
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
friend class TRootIconBox
void DisplayDirectory()
Display current directory in second label, fLbl2.
const Bool_t kTRUE
Definition: RtypesCore.h:91
void ToSystemDirectory(const char *dirname)
display directory
TGPopupMenu * fOptionMenu
ABC describing GUI independent browser implementation protocol.
Definition: TBrowserImp.h:29
const TGPicture * fIconPic