#ifndef ROOT_TTreeViewer
#define ROOT_TTreeViewer
#ifndef ROOT_TGFrame
#include "TGFrame.h"
#endif
class TTreeViewer;
class TTVLVContainer;
class TTVLVEntry;
class TTVSession;
class TGSelectBox;
class TTree;
class TBranch;
class TContextMenu;
class TList;
class TGPicture;
class TTimer;
class TGLayoutHints;
class TGMenuBar;
class TGPopupMenu;
class TGToolBar;
class TGLabel;
class TGCheckButton;
class TGComboBox;
class TGTextButton;
class TGTextEntry;
class TGDoubleVSlider;
class TGPictureButton;
class TGStatusBar;
class TGCanvas;
class TGListTree;
class TGListTreeItem;
class TGListView;
class TGHProgressBar;
class TGButton;
class TTreeViewer : public TGMainFrame {
friend class TGClient;
friend class TGButton;
public:
enum EListItemType {
kLTNoType = 0,
kLTPackType = BIT(0),
kLTTreeType = BIT(1),
kLTBranchType = BIT(2),
kLTLeafType = BIT(3),
kLTActionType = BIT(4),
kLTDragType = BIT(5),
kLTExpressionType = BIT(6),
kLTCutType = BIT(7)
};
private:
TTree *fTree;
TTVSession *fSession;
const char *fFilename;
const char *fSourceFile;
TString fLastOption;
TTree *fMappedTree;
TBranch *fMappedBranch;
Int_t fDimension;
Bool_t fVarDraw;
Bool_t fScanMode;
TContextMenu *fContextMenu;
TGSelectBox *fDialogBox;
TList *fTreeList;
Int_t fTreeIndex;
const TGPicture *fPicX, *fPicY, *fPicZ;
const TGPicture *fPicDraw, *fPicStop;
const TGPicture *fPicRefr;
Cursor_t fDefaultCursor;
Cursor_t fWatchCursor;
TTimer *fTimer;
Bool_t fCounting;
Bool_t fStopMapping;
Bool_t fEnableCut;
Int_t fNexpressions;
TGLayoutHints *fMenuBarLayout;
TGLayoutHints *fMenuBarItemLayout;
TGLayoutHints *fMenuBarHelpLayout;
TGMenuBar *fMenuBar;
TGPopupMenu *fFileMenu;
TGPopupMenu *fEditMenu;
TGPopupMenu *fRunMenu;
TGPopupMenu *fOptionsMenu;
TGPopupMenu *fOptionsGen;
TGPopupMenu *fOptions1D;
TGPopupMenu *fOptions2D;
TGPopupMenu *fHelpMenu;
TGToolBar *fToolBar;
TGLayoutHints *fBarLayout;
TGLabel *fBarLbl1;
TGLabel *fBarLbl2;
TGLabel *fBarLbl3;
TGCheckButton *fBarH;
TGCheckButton *fBarScan;
TGCheckButton *fBarRec;
TGTextEntry *fBarCommand;
TGTextEntry *fBarOption;
TGTextEntry *fBarHist;
TGHorizontalFrame *fHf;
TGDoubleVSlider *fSlider;
TGVerticalFrame *fV1;
TGVerticalFrame *fV2;
TGCompositeFrame *fTreeHdr;
TGCompositeFrame *fListHdr;
TGLabel *fLbl1;
TGLabel *fLbl2;
TGHorizontalFrame *fBFrame;
TGHorizontalFrame *fHpb;
TGHProgressBar *fProgressBar;
TGLabel *fBLbl4;
TGLabel *fBLbl5;
TGTextEntry *fBarListIn;
TGTextEntry *fBarListOut;
TGPictureButton *fDRAW;
TGTextButton *fSPIDER;
TGPictureButton *fSTOP;
TGPictureButton *fREFR;
TGStatusBar *fStatusBar;
TGComboBox *fCombo;
TGPictureButton *fBGFirst;
TGPictureButton *fBGPrevious;
TGPictureButton *fBGRecord;
TGPictureButton *fBGNext;
TGPictureButton *fBGLast;
TGTextButton *fReset;
TGCanvas *fTreeView;
TGListTree *fLt;
TGListView *fListView;
TTVLVContainer *fLVContainer;
TList *fWidgets;
private:
void BuildInterface();
const char *Cut();
Int_t Dimension();
const char *EmptyBrackets(const char* name);
const char *Ex();
const char *Ey();
const char *Ez();
const char *En(Int_t n);
void MapBranch(TBranch *branch, const char *prefix="", TGListTreeItem *parent = 0, Bool_t listIt = kTRUE);
void MapOptions(Long_t parm1);
void MapTree(TTree *tree, TGListTreeItem *parent = 0, Bool_t listIt = kTRUE);
void SetFile();
const char *ScanList();
void SetParentTree(TGListTreeItem *item);
void DoError(int level, const char *location, const char *fmt, va_list va) const;
public:
TTreeViewer(const char* treeName = 0);
TTreeViewer(const TTree *tree);
virtual ~TTreeViewer();
void AppendTree(TTree *tree);
void ActivateButtons(Bool_t first, Bool_t previous,
Bool_t next , Bool_t last);
virtual void CloseWindow();
virtual void Delete(Option_t *) { }
void DoRefresh();
void EditExpression();
void Empty();
void EmptyAll();
void ExecuteCommand(const char* command, Bool_t fast = kFALSE);
void ExecuteDraw();
void ExecuteSpider();
TTVLVEntry *ExpressionItem(Int_t index);
TList *ExpressionList();
const char *GetGrOpt();
TTree *GetTree() {return fTree;}
Bool_t HandleTimer(TTimer *timer);
Bool_t IsCutEnabled() {return fEnableCut;}
Bool_t IsScanRedirected();
Int_t MakeSelector(const char* selector = 0);
void Message(const char* msg);
void NewExpression();
void PrintEntries();
Long64_t Process(const char* filename, Option_t *option="", Long64_t nentries=1000000000, Long64_t firstentry=0);
Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
void RemoveItem();
void RemoveLastRecord();
void SaveSource(const char* filename="", Option_t *option="");
void SetHistogramTitle(const char *title);
void SetCutMode(Bool_t enabled = kTRUE) {fEnableCut = enabled;}
void SetCurrentRecord(Long64_t entry);
void SetGrOpt(const char *option);
void SetNexpressions(Int_t expr);
void SetRecordName(const char *name);
void SetScanFileName(const char *name="");
void SetScanMode(Bool_t mode=kTRUE) {fScanMode = mode;}
void SetScanRedirect(Bool_t mode);
void SetSession(TTVSession *session);
void SetUserCode(const char *code, Bool_t autoexec=kTRUE);
void SetTree(TTree* tree);
void SetTreeName(const char* treeName);
Bool_t SwitchTree(Int_t index);
void UpdateCombo();
void UpdateRecord(const char *name="new name");
ClassDef(TTreeViewer,0)
};
#endif