ROOT logo
// @(#)root/gui:$Id$
// Author: Fons Rademakers   27/02/98

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/


#ifndef ROOT_TRootBrowserLite
#define ROOT_TRootBrowserLite

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TRootBrowserLite                                                     //
//                                                                      //
// This class creates a ROOT object browser (looking like Windows       //
// Explorer). The widgets used are the new native ROOT GUI widgets.     //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TBrowserImp
#include "TBrowserImp.h"
#endif
#ifndef ROOT_TGFrame
#include "TGFrame.h"
#endif

class TGMenuBar;
class TGPopupMenu;
class TGLayoutHints;
class TGStatusBar;
class TGHorizontal3DLine;
class TGToolBar;
class TGButton;
class TGFSComboBox;
class TGLabel;
class TGListView;
class TRootIconBox;
class TGCanvas;
class TGListTree;
class TGListTreeItem;
class TGFileItem;
class TList;
class TGFileContainer;
class TGComboBox;
class TGTextEdit;

class TRootBrowserLite : public TGMainFrame, public TBrowserImp {

friend class TRootIconBox;

private:
   TGMenuBar           *fMenuBar;
   TGToolBar           *fToolBar;
   TGHorizontal3DLine  *fToolBarSep;
   TGVerticalFrame     *fV1;
   TGVerticalFrame     *fV2;
   TGLabel             *fLbl1;
   TGLabel             *fLbl2;
   TGHorizontalFrame   *fHf;
   TGCompositeFrame    *fTreeHdr;
   TGCompositeFrame    *fListHdr;

   TGLayoutHints       *fMenuBarLayout;
   TGLayoutHints       *fMenuBarItemLayout;
   TGLayoutHints       *fMenuBarHelpLayout;
   TGLayoutHints       *fComboLayout;
   TGLayoutHints       *fBarLayout;
   TGComboBox          *fDrawOption;         // drawing option entry
   TGLayoutHints       *fExpandLayout;       //
   Bool_t               fBrowseTextFile;     //
   TString              fTextFileName;

   TList               *fWidgets;
   TList               *fHistory;            // history of browsing
   TObject             *fHistoryCursor;      // current hsitory position
   const TGPicture     *fIconPic;            // icon picture

   void  CreateBrowser(const char *name);
   void  ListTreeHighlight(TGListTreeItem *item);
   void  DeleteListTreeItem(TGListTreeItem *item);
   void  HighlightListLevel();
   void  AddToHistory(TGListTreeItem *item);
   void  IconBoxAction(TObject *obj);
   void  Chdir(TGListTreeItem *item);
   void  DisplayDirectory();
   void  DisplayTotal(Int_t total, Int_t selected);
   void  SetViewMode(Int_t new_mode, Bool_t force = kFALSE);
   void  ToSystemDirectory(const char *dirname);
   void  UpdateDrawOption();
   void  Search();
   void  BrowseTextFile(const char *file);
   void  HideTextEdit();
   void  ShowMacroButtons(Bool_t show = kTRUE);

   Bool_t  HistoryBackward();
   Bool_t  HistoryForward();
   void    ClearHistory();

protected:
   TGPopupMenu         *fFileMenu;
   TGPopupMenu         *fViewMenu;
   TGPopupMenu         *fOptionMenu;
   TGPopupMenu         *fHelpMenu;
   TGPopupMenu         *fSortMenu;
   TGListView          *fListView;
   TRootIconBox        *fIconBox;
   TGCanvas            *fTreeView;
   TGListTree          *fLt;
   TGButton            *fToolBarButton[7];  // same size as gToolBarData[]
   TGFSComboBox        *fFSComboBox;
   TGStatusBar         *fStatusBar;
   TGListTreeItem      *fListLevel;         // current TGListTree level
   Bool_t               fTreeLock;          // true when we want to lock TGListTree
   Int_t                fViewMode;          // current IconBox view mode
   Int_t                fSortMode;          // current IconBox sort mode
   TGTextEdit          *fTextEdit;          // contents of browsed text file

public:
   TRootBrowserLite(TBrowser *b = 0, const char *title = "ROOT Browser", UInt_t width = 800, UInt_t height = 500);
   TRootBrowserLite(TBrowser *b, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height);
   virtual ~TRootBrowserLite();

   virtual void Add(TObject *obj, const char *name = 0, Int_t check = -1);
   virtual void AddToBox(TObject *obj, const char *name);
   virtual void AddToTree(TObject *obj, const char *name, Int_t check = -1);

   virtual void AddCheckBox(TObject *obj, Bool_t check = kFALSE);
   virtual void CheckObjectItem(TObject *obj, Bool_t check = kFALSE);
   virtual void RemoveCheckBox(TObject *obj);

   virtual void BrowseObj(TObject *obj);             //*SIGNAL*
   virtual void ExecuteDefaultAction(TObject *obj);  //*SIGNAL*
   virtual void DoubleClicked(TObject *obj);         //*SIGNAL*
   virtual void Checked(TObject *obj, Bool_t check); //*SIGNAL*
   virtual void CloseTabs() { }
   virtual void Iconify() { }
   virtual void RecursiveRemove(TObject *obj);
   virtual void Refresh(Bool_t force = kFALSE);
   virtual void ResizeBrowser() { }
   virtual void ShowToolBar(Bool_t show = kTRUE);
   virtual void ShowStatusBar(Bool_t show = kTRUE);
   virtual void Show() { MapRaised(); }
   virtual void SetDefaults(const char *iconStyle = 0, const char *sortBy = 0);
   virtual Bool_t HandleKey(Event_t *event);
   virtual void SetStatusText(const char *txt, Int_t col);

   TGListTree      *GetListTree()  const { return fLt; }
   TGFileContainer *GetIconBox()   const;
   TGStatusBar     *GetStatusBar() const { return fStatusBar; }
   TGMenuBar       *GetMenuBar()   const { return  fMenuBar; }
   TGToolBar       *GetToolBar()   const { return fToolBar; }
   void             SetDrawOption(Option_t *option="");
   Option_t        *GetDrawOption() const;
   void             SetSortMode(Int_t new_mode);
   TGMainFrame     *GetMainFrame() const { return (TGMainFrame *)this; }

   // overridden from TGMainFrame
   void     CloseWindow();
   Bool_t   ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
   void     ReallyDelete();

   // auxilary (a la privae) methods
   void     ExecMacro();
   void     InterruptMacro();

   static TBrowserImp *NewBrowser(TBrowser *b = 0, const char *title = "ROOT Browser", UInt_t width = 800, UInt_t height = 500, Option_t *opt="");
   static TBrowserImp *NewBrowser(TBrowser *b, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height, Option_t *opt="");

   ClassDef(TRootBrowserLite,0)  //ROOT native GUI version of browser
};

#endif
 TRootBrowserLite.h:1
 TRootBrowserLite.h:2
 TRootBrowserLite.h:3
 TRootBrowserLite.h:4
 TRootBrowserLite.h:5
 TRootBrowserLite.h:6
 TRootBrowserLite.h:7
 TRootBrowserLite.h:8
 TRootBrowserLite.h:9
 TRootBrowserLite.h:10
 TRootBrowserLite.h:11
 TRootBrowserLite.h:12
 TRootBrowserLite.h:13
 TRootBrowserLite.h:14
 TRootBrowserLite.h:15
 TRootBrowserLite.h:16
 TRootBrowserLite.h:17
 TRootBrowserLite.h:18
 TRootBrowserLite.h:19
 TRootBrowserLite.h:20
 TRootBrowserLite.h:21
 TRootBrowserLite.h:22
 TRootBrowserLite.h:23
 TRootBrowserLite.h:24
 TRootBrowserLite.h:25
 TRootBrowserLite.h:26
 TRootBrowserLite.h:27
 TRootBrowserLite.h:28
 TRootBrowserLite.h:29
 TRootBrowserLite.h:30
 TRootBrowserLite.h:31
 TRootBrowserLite.h:32
 TRootBrowserLite.h:33
 TRootBrowserLite.h:34
 TRootBrowserLite.h:35
 TRootBrowserLite.h:36
 TRootBrowserLite.h:37
 TRootBrowserLite.h:38
 TRootBrowserLite.h:39
 TRootBrowserLite.h:40
 TRootBrowserLite.h:41
 TRootBrowserLite.h:42
 TRootBrowserLite.h:43
 TRootBrowserLite.h:44
 TRootBrowserLite.h:45
 TRootBrowserLite.h:46
 TRootBrowserLite.h:47
 TRootBrowserLite.h:48
 TRootBrowserLite.h:49
 TRootBrowserLite.h:50
 TRootBrowserLite.h:51
 TRootBrowserLite.h:52
 TRootBrowserLite.h:53
 TRootBrowserLite.h:54
 TRootBrowserLite.h:55
 TRootBrowserLite.h:56
 TRootBrowserLite.h:57
 TRootBrowserLite.h:58
 TRootBrowserLite.h:59
 TRootBrowserLite.h:60
 TRootBrowserLite.h:61
 TRootBrowserLite.h:62
 TRootBrowserLite.h:63
 TRootBrowserLite.h:64
 TRootBrowserLite.h:65
 TRootBrowserLite.h:66
 TRootBrowserLite.h:67
 TRootBrowserLite.h:68
 TRootBrowserLite.h:69
 TRootBrowserLite.h:70
 TRootBrowserLite.h:71
 TRootBrowserLite.h:72
 TRootBrowserLite.h:73
 TRootBrowserLite.h:74
 TRootBrowserLite.h:75
 TRootBrowserLite.h:76
 TRootBrowserLite.h:77
 TRootBrowserLite.h:78
 TRootBrowserLite.h:79
 TRootBrowserLite.h:80
 TRootBrowserLite.h:81
 TRootBrowserLite.h:82
 TRootBrowserLite.h:83
 TRootBrowserLite.h:84
 TRootBrowserLite.h:85
 TRootBrowserLite.h:86
 TRootBrowserLite.h:87
 TRootBrowserLite.h:88
 TRootBrowserLite.h:89
 TRootBrowserLite.h:90
 TRootBrowserLite.h:91
 TRootBrowserLite.h:92
 TRootBrowserLite.h:93
 TRootBrowserLite.h:94
 TRootBrowserLite.h:95
 TRootBrowserLite.h:96
 TRootBrowserLite.h:97
 TRootBrowserLite.h:98
 TRootBrowserLite.h:99
 TRootBrowserLite.h:100
 TRootBrowserLite.h:101
 TRootBrowserLite.h:102
 TRootBrowserLite.h:103
 TRootBrowserLite.h:104
 TRootBrowserLite.h:105
 TRootBrowserLite.h:106
 TRootBrowserLite.h:107
 TRootBrowserLite.h:108
 TRootBrowserLite.h:109
 TRootBrowserLite.h:110
 TRootBrowserLite.h:111
 TRootBrowserLite.h:112
 TRootBrowserLite.h:113
 TRootBrowserLite.h:114
 TRootBrowserLite.h:115
 TRootBrowserLite.h:116
 TRootBrowserLite.h:117
 TRootBrowserLite.h:118
 TRootBrowserLite.h:119
 TRootBrowserLite.h:120
 TRootBrowserLite.h:121
 TRootBrowserLite.h:122
 TRootBrowserLite.h:123
 TRootBrowserLite.h:124
 TRootBrowserLite.h:125
 TRootBrowserLite.h:126
 TRootBrowserLite.h:127
 TRootBrowserLite.h:128
 TRootBrowserLite.h:129
 TRootBrowserLite.h:130
 TRootBrowserLite.h:131
 TRootBrowserLite.h:132
 TRootBrowserLite.h:133
 TRootBrowserLite.h:134
 TRootBrowserLite.h:135
 TRootBrowserLite.h:136
 TRootBrowserLite.h:137
 TRootBrowserLite.h:138
 TRootBrowserLite.h:139
 TRootBrowserLite.h:140
 TRootBrowserLite.h:141
 TRootBrowserLite.h:142
 TRootBrowserLite.h:143
 TRootBrowserLite.h:144
 TRootBrowserLite.h:145
 TRootBrowserLite.h:146
 TRootBrowserLite.h:147
 TRootBrowserLite.h:148
 TRootBrowserLite.h:149
 TRootBrowserLite.h:150
 TRootBrowserLite.h:151
 TRootBrowserLite.h:152
 TRootBrowserLite.h:153
 TRootBrowserLite.h:154
 TRootBrowserLite.h:155
 TRootBrowserLite.h:156
 TRootBrowserLite.h:157
 TRootBrowserLite.h:158
 TRootBrowserLite.h:159
 TRootBrowserLite.h:160
 TRootBrowserLite.h:161
 TRootBrowserLite.h:162
 TRootBrowserLite.h:163
 TRootBrowserLite.h:164
 TRootBrowserLite.h:165
 TRootBrowserLite.h:166
 TRootBrowserLite.h:167
 TRootBrowserLite.h:168
 TRootBrowserLite.h:169
 TRootBrowserLite.h:170
 TRootBrowserLite.h:171
 TRootBrowserLite.h:172
 TRootBrowserLite.h:173
 TRootBrowserLite.h:174
 TRootBrowserLite.h:175
 TRootBrowserLite.h:176
 TRootBrowserLite.h:177