Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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:
53  TGMenuBar *fMenuBar;
54  TGToolBar *fToolBar;
55  TGHorizontal3DLine *fToolBarSep;
56  TGVerticalFrame *fV1;
57  TGVerticalFrame *fV2;
58  TGLabel *fLbl1;
59  TGLabel *fLbl2;
60  TGHorizontalFrame *fHf;
61  TGCompositeFrame *fTreeHdr;
62  TGCompositeFrame *fListHdr;
63 
64  TGLayoutHints *fMenuBarLayout;
65  TGLayoutHints *fMenuBarItemLayout;
66  TGLayoutHints *fMenuBarHelpLayout;
67  TGLayoutHints *fComboLayout;
68  TGLayoutHints *fBarLayout;
69  TGComboBox *fDrawOption; // drawing option entry
70  TGLayoutHints *fExpandLayout; //
71  Bool_t fBrowseTextFile; //
72  TString fTextFileName;
73 
74  TList *fWidgets;
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);
80  void ListTreeHighlight(TGListTreeItem *item);
81  void DeleteListTreeItem(TGListTreeItem *item);
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 
96  Bool_t HistoryBackward();
97  Bool_t HistoryForward();
98  void ClearHistory();
99 
100 protected:
101  TGPopupMenu *fFileMenu;
102  TGPopupMenu *fViewMenu;
103  TGPopupMenu *fOptionMenu;
104  TGPopupMenu *fHelpMenu;
105  TGPopupMenu *fSortMenu;
106  TGListView *fListView;
107  TRootIconBox *fIconBox;
108  TGCanvas *fTreeView;
109  TGListTree *fLt;
110  TGButton *fToolBarButton[7]; // same size as gToolBarData[]
111  TGFSComboBox *fFSComboBox;
112  TGStatusBar *fStatusBar;
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