/****************************************************************************** * Macro for testing TGListTree for Tab Select in XFrame * * When creating a new file with "File->New" a new root file will be created * * in the selected directory, TGListTree will be expanded and the newly * * created file will be highlighted and the trees displayed in TGLVContainer. * * Furthermore, when opening a root file by pressing button "Browse", the * * TGListTree will be expanded and the trees of the file will be displayed in * * TGLVContainer. * * * * Author: Dr. Christian Stratowa, Vienna, Austria. * * Created: 21 Jun 2003 Last modified: 13 Aug 2005 * ******************************************************************************/ //#ifndef __CINT__ #include "TEnv.h" #include "TFile.h" #include "TKey.h" #include "TList.h" #include "TRandom.h" #include "TString.h" #include "TSystem.h" #include "TSystemDirectory.h" #include "TSystemFile.h" #include "TTree.h" #include "RQ_OBJECT.h" #include "TGFrame.h" #include "TGMenu.h" #include "TG3DLine.h" #include "TGLayout.h" #include "TGButton.h" #include "TGCanvas.h" #include "TGClient.h" #include "TGTab.h" #include "TGLabel.h" #include "TGComboBox.h" #include "TGListBox.h" #include "TGListTree.h" #include "TGListView.h" #include "TGMsgBox.h" #include "TGPicture.h" #include "TGSplitter.h" #include "TGTableLayout.h" #include "TGTextEntry.h" #include "TGTextBuffer.h" #include "TGFileDialog.h" //#endif #include // Menu commands enum EMenuCommands { M_FILE, M_FILE_NEW, M_FILE_EXIT, }; // Button Ids enum EButtonIds { B_BROWSE_OPENFILE, }; class XFrame { RQ_OBJECT("XFrame") private: TGMainFrame *fMain; // MenuBar Frame TGPopupMenu *fMenuFile; TGMenuBar *fMenuBar; TGHorizontal3DLine *fLineH1; TGCompositeFrame *fSubFrame; TGVerticalFrame *fTreeFrame; TGCanvas *fTreeView; TGListTree *fListTree; // Frame Select TGCompositeFrame *fFSelect; TGCanvas *fCanvas3; TGTab *fTab3; TGCompositeFrame *fFTSel; TGGroupFrame *fFGSel; TGLabel *fLabO; TGTextEntry *fTxtO; TGTextBuffer *fBufO; TGButton *fBrowseOBtn; TGGroupFrame *fFGTree; TGCompositeFrame *fCFSel1; TGListView *fBrowseView; TGLVContainer *fBContainer; // Layout hints TGLayoutHints *fMenuBarLayout; TGLayoutHints *fMenuBarItemLayout; TGLayoutHints *fMenuBarHelpLayout; TGLayoutHints *fLineLayout; TGLayoutHints *fHintTL; TGLayoutHints *fHintTX; TGLayoutHints *fHintTXY; TGLayoutHints *fHintRXY; TGLayoutHints *fHintLY; TGLayoutHints *fHintXY; TList *fTrash; TList *fSelections; //list of selected trees TFile *fFile; const TGPicture *fRootIcon; TGListTreeItem *fListLevel; //current TGListTree level public: XFrame(const TGWindow *window, UInt_t w, UInt_t h); virtual ~XFrame(); void InitListTree(); void DisplayTrees(const char *filename); // Slots void DoMenu(Int_t id); void DoNewFile(); void DoCloseWindow(); void DoSelectOpenFile(); void DoTreeClicked(TGListTreeItem *item, Int_t btn); void DoTreeDoubleClicked(TGListTreeItem *item, Int_t btn); private: TString DirName(TGListTreeItem* item); Int_t NewFile(const char *filename); TGListTreeItem *ExpandPath(const char *path); private: void CreateMenuBar(); void DeleteMenuBar(); void CreateToolBar(); void DeleteToolBar(); void CreateFrameSelect(TGCompositeFrame *parent); void DeleteFrameSelect(); void CreateTabSelect(TGTab *tab); void DeleteTabSelect(); #if !defined (__CINT__) || defined (__MAKECINT__) ClassDef(XFrame,0) //MainFrame #endif }; //______________________________________________________________________________ //______________________________________________________________________________ static const char *kOpenTypes[] = { "All files", "*", "ROOT files", "*.root", "ROOT macros", "*.C", 0, 0 }; //debug: print function names const Bool_t kCS = 0; #if !defined (__CINT__) || defined (__MAKECINT__) ClassImp(XFrame); #endif //______________________________________________________________________________ TString Path2Name(const char *name, const char *sep, const char *exten) { // Extract name from full path // sep is path separator and exten is name extension TString outname = TString(name); char *tmpname = new char[strlen(name) + 1]; char *delname = tmpname; tmpname = strtok(strcpy(tmpname,name),sep); while(tmpname) { outname = tmpname; tmpname = strtok(NULL,sep); }//while if (strcmp(exten,"") != 0) { Int_t i = outname.Index(exten); if (i > 0) {outname = outname.Remove(i);} }//if delete [] delname; return outname; }//Path2Name //______________________________________________________________________________ TString Name2Path(const char *fullname, char sep) { // Extract path from fullname; sep is path separator TString outname(fullname); Int_t pos = outname.Last(sep); if (pos > 0) { outname.Resize(pos); } else { outname = ""; }//if return outname; }//Name2Path //______________________________________________________________________________ //______________________________________________________________________________ XFrame::XFrame(const TGWindow *window, UInt_t w, UInt_t h) { if(kCS) cout << "------XFrame::XFrame------" << endl; fFile = 0; fSelections = new TList(); fTrash = new TList(); fHintTL = new TGLayoutHints(kLHintsTop | kLHintsLeft); fHintTX = new TGLayoutHints(kLHintsTop | kLHintsExpandX); fHintTXY = new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY); fHintRXY = new TGLayoutHints(kLHintsRight | kLHintsExpandX | kLHintsExpandY); fHintLY = new TGLayoutHints(kLHintsLeft | kLHintsExpandY); fHintXY = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY); fMain = new TGMainFrame(window, w, h); fMain->Connect("CloseWindow()", "XFrame", this, "DoCloseWindow()"); // Create menus CreateMenuBar(); // Subframe for frame containing different frames fSubFrame = new TGCompositeFrame(fMain,0,0, kHorizontalFrame); // Create tree view fTreeFrame = new TGVerticalFrame(fSubFrame, 10, 10, kFixedWidth); fTreeView = new TGCanvas(fTreeFrame, 10, 10, kSunkenFrame | kDoubleBorder); fListTree = new TGListTree(fTreeView->GetViewPort(), 10, 10, kHorizontalFrame, fMain->GetWhitePixel()); fListTree->Connect("Clicked(TGListTreeItem*, Int_t)", "XFrame", this, "DoTreeClicked(TGListTreeItem*, Int_t)"); fListTree->Connect("DoubleClicked(TGListTreeItem*, Int_t)", "XFrame", this, "DoTreeDoubleClicked(TGListTreeItem*, Int_t)"); fListTree->Associate(fMain); fTreeView->SetContainer(fListTree); fListTree->SetCanvas(fTreeView); fTreeFrame->AddFrame(fTreeView, fHintXY); fSubFrame->AddFrame(fTreeFrame, fHintLY); // Create splitter TGVSplitter *splitter = new TGVSplitter(fSubFrame); splitter->SetFrame(fTreeFrame, kTRUE); fTrash->Add(splitter); fSubFrame->AddFrame(splitter, fHintLY); // Create subframes CreateFrameSelect(fSubFrame); fMain->AddFrame(fSubFrame, fHintRXY); // Initialize file tree InitListTree(); // Main settings fMain->SetWindowName("GuiSelectFile"); fMain->MapSubwindows(); fMain->Resize(640, 620); fMain->MapWindow(); fMain->Move(20, 20); }//Constructor //______________________________________________________________________________ XFrame::~XFrame() { if(kCS) cout << "------XFrame::~XFrame------" << endl; DeleteFrameSelect(); DeleteMenuBar(); delete fHintTL; delete fHintTX; delete fHintTXY; delete fHintRXY; delete fHintLY; delete fHintXY; delete fListTree; delete fTreeView; delete fTreeFrame; delete fSubFrame; if(fSelections) { if (fSelections->GetSize() > 0) fSelections->Delete(); delete fSelections; fSelections = 0; }//if fTrash->Delete(); delete fTrash; delete fMain; }//Destructor //______________________________________________________________________________ void XFrame::InitListTree() { if(kCS) cout << "------XFrame::InitListTree------" << endl; fListLevel = 0; fRootIcon = gClient->GetPicture("rootdb_t.xpm"); #ifdef G__WIN32 TString dir("c:\\"); #else // TString dir(gSystem->HomeDirectory()); TString dir("/"); //root directory "/" #endif fListLevel = fListTree->AddItem(fListLevel, dir.Data()); }//InitListTree //______________________________________________________________________________ void XFrame::DisplayTrees(const char *filename) { // Display trees for file filename in BrowseBox if(kCS) cout << "------XFrame::DisplayTrees------" << endl; TString fname = Path2Name(filename,"",".") + ".root"; TString rname = 0; if (strstr(filename,".root/") != 0) rname = Path2Name(filename,"/",""); if (fFile) { fBContainer->RemoveAll(); delete fFile; }//if fFile = TFile::Open(fname, "READ"); fFile->cd(rname); TGLVEntry *entry = 0; TKey *key = 0; TIter next(gDirectory->GetListOfKeys()); while ((key = (TKey*)next())) { if (strcmp(key->GetClassName(), "TTree") != 0) continue; TString cname = key->GetClassName(); TString kname = key->GetName(); entry = new TGLVEntry(fBContainer,kname,cname); entry->SetSubnames(key->GetTitle()); fBContainer->AddItem(entry); }//while fBrowseView->MapSubwindows(); fBrowseView->Layout(); }//DisplayTrees //______________________________________________________________________________ TString XFrame::DirName(TGListTreeItem* item) { // Returns an absolute path if(kCS) cout << "------XFrame::DirName------" << endl; TGListTreeItem* parent; TString dirname = item->GetText(); while ((parent=item->GetParent())) { dirname = gSystem->ConcatFileName(parent->GetText(),dirname.Data()); item = parent; }//while return dirname; }//DirName //______________________________________________________________________________ TGListTreeItem *XFrame::ExpandPath(const char *path) { // Expand listtree by pathname and return last item. Pathname is in the form // of /xx/yy/zz. If zz in path /xx/yy is found it returns item, 0 otherwise. // Adapted from root method TGListTree::FindItemByPathname() if(kCS) cout << "------XFrame::ExpandPath------" << endl; if (!path || !*path) return 0; const char *p = path, *s; char dirname[1024]; TGListTreeItem *item = 0; item = fListTree->FindChildByName(item, "/"); TGListTreeItem *diritem = 0; TString fulldir; start: while (1) { while (*p && *p == '/') p++; if (!*p) break; s = strchr(p, '/'); if (!s) { strcpy(dirname, p); } else { strncpy(dirname, p, s-p); dirname[s-p] = 0; }//if item = fListTree->FindChildByName(item, dirname); fListTree->OpenItem(item); fListTree->DoubleClicked(item, kButton1); gClient->NeedRedraw(fListTree); fMain->Layout(); fListTree->HighlightItem(item); if (!diritem && dirname) { fulldir += "/"; fulldir += dirname; if ((diritem = fListTree->FindChildByName(0, fulldir.Data()))) { if (!s || !strlen(s)) return diritem; p = ++s; item = diritem; goto start; }//if }//if if (!s || !strlen(s)) return item; p = ++s; }//while return 0; }//ExpandPath /* //////////////////////////////////////////////////////////// // Suggestion to add TGListTree::ExpandPath() to TGListTree //////////////////////////////////////////////////////////// //______________________________________________________________________________ TGListTreeItem *TGListTree::ExpandPath(const char *path) { // Expand listtree by pathname and return last item. Pathname is in the form // of /xx/yy/zz. If zz in path /xx/yy is found it returns item, 0 otherwise. if (!path || !*path) return 0; const char *p = path, *s; char dirname[1024]; TGListTreeItem *item = 0; item = FindChildByName(item, "/"); TGListTreeItem *diritem = 0; TString fulldir; start: while (1) { while (*p && *p == '/') p++; if (!*p) break; s = strchr(p, '/'); if (!s) { strcpy(dirname, p); } else { strncpy(dirname, p, s-p); dirname[s-p] = 0; }//if item = FindChildByName(item, dirname); OpenItem(item); DoubleClicked(item, kButton1); NeedRedraw(this); fMain->Layout(); HighlightItem(item); if (!diritem && dirname) { fulldir += "/"; fulldir += dirname; if ((diritem = FindChildByName(0, fulldir.Data()))) { if (!s || !strlen(s)) return diritem; p = ++s; item = diritem; goto start; }//if }//if if (!s || !strlen(s)) return item; p = ++s; }//while return 0; }//ExpandPath */ //______________________________________________________________________________ void XFrame::DoMenu(Int_t id) { // Handle menu items if(kCS) cout << "------XFrame::DoMenu------" << endl; switch (id) { // File menu case M_FILE_NEW: DoNewFile(); break; case M_FILE_EXIT: DoCloseWindow(); break; default: printf("Error: Unknown ID %d selected\n", id); break; }//switch }//DoMenu //______________________________________________________________________________ void XFrame::DoNewFile() { if(kCS) cout << "------XFrame::DoNewFile------" << endl; char filename[1024]; static TString sDir("."); TGFileInfo fi; fi.fFileTypes = kOpenTypes; fi.fIniDir = StrDup(sDir.Data()); new TGFileDialog(gClient->GetRoot(), fMain, kFDOpen, &fi); // Cancel if (!fi.fFilename) return; // OK sDir = fi.fIniDir; sprintf(filename,"%s",fi.fFilename); TString fname = Path2Name(filename, "", ".") + ".root"; TString path = Name2Path(filename, '/'); if (NewFile(fname) == 0) { fTxtO->SetText(fname); // open current fListTree item fListTree->HighlightItem(fListLevel); // fListTree->DoubleClicked(fListLevel, kButton1); fListTree->OpenItem(fListLevel); fListTree->DoubleClicked(fListLevel, kButton1); gClient->NeedRedraw(fListTree); fMain->Layout(); fListTree->HighlightItem(fListLevel); // expand fListTree to path and add new item, i.e. root file TGListTreeItem *ditem, *fitem; ditem = ExpandPath(path); fitem = fListTree->AddItem(ditem, gSystem->BaseName(fname), fRootIcon, fRootIcon); fListTree->AdjustPosition(fitem); gClient->NeedRedraw(fListTree); fMain->Layout(); fListTree->ClearHighlighted(); fListTree->HighlightItem(fitem); DisplayTrees(fname); }//if }//DoNewFile //______________________________________________________________________________ void XFrame::DoCloseWindow() { if(kCS) cout << "------XFrame::DoCloseWindow------" << endl; delete this; //does not exit root // gApplication->Terminate(0); //exit root, needed for standalone App }//DoCloseWindow //______________________________________________________________________________ void XFrame::DoSelectOpenFile() { if(kCS) cout << "------XFrame::DoSelectOpenFile------" << endl; char filename[1024]; static TString sDir("."); TGFileInfo fi; fi.fFileTypes = kOpenTypes; fi.fIniDir = StrDup(sDir.Data()); new TGFileDialog(gClient->GetRoot(), fMain, kFDOpen, &fi); // Cancel if (!fi.fFilename) return; // OK sDir = fi.fIniDir; sprintf(filename,"%s",fi.fFilename); TString fname = Path2Name(filename, "/", ""); TString path = Name2Path(filename, '/'); TString str = Path2Name(filename, ".", ""); if(strcmp(str.Data(),"root") == 0) { fTxtO->SetText(filename); // open current fListTree item fListTree->HighlightItem(fListLevel); // fListTree->DoubleClicked(fListLevel, kButton1); fListTree->OpenItem(fListLevel); fListTree->DoubleClicked(fListLevel, kButton1); gClient->NeedRedraw(fListTree); fMain->Layout(); fListTree->HighlightItem(fListLevel); // expand fListTree to path and highlight selected root file TGListTreeItem *ditem, *fitem; ditem = ExpandPath(path); fitem = fListTree->FindChildByName(ditem, fname); fListTree->AdjustPosition(fitem); gClient->NeedRedraw(fListTree); fMain->Layout(); fListTree->ClearHighlighted(); fListTree->HighlightItem(fitem); DisplayTrees(filename); } else { Int_t retcode; new TGMsgBox(gClient->GetRoot(), fMain, "Error Message", "Selected file is not a root file!", kMBIconExclamation, kMBOk, &retcode); fTxtO->SetText(""); }//if }//DoSelectOpenFile //______________________________________________________________________________ void XFrame::DoTreeClicked(TGListTreeItem *item, Int_t btn) { // Handle mouse click in TGListTree if(kCS) cout << "------XFrame::DoTreeClicked------" << endl; if ((btn!=kButton1) || !item) return; TString fullname = DirName(item); if (fullname.EndsWith(".root")) { fTxtO->SetText(fullname.Data()); DisplayTrees(fullname.Data()); }//if if (fullname.Contains(".root/")) { TString filename = Path2Name(fullname,"",".") + ".root"; fTxtO->SetText(filename.Data()); DisplayTrees(fullname.Data()); }//if }//DoTreeClicked //______________________________________________________________________________ void XFrame::DoTreeDoubleClicked(TGListTreeItem *item, Int_t btn) { // Handle mouse double-click in TGListTree if(kCS) cout << "------XFrame::DoTreeDoubleClicked------" << endl; if ((btn!=kButton1) || !item || (Bool_t)item->GetUserData()) return; // current listtree item fListLevel = item; // use UserData to indicate that item was already browsed item->SetUserData((void*)1); TSystemDirectory dir(item->GetText(),DirName(item).Data()); TList *files = dir.GetListOfFiles(); if (files) { TIter next(files); TSystemFile *file; TString fname; while ((file=(TSystemFile*)next())) { fname = file->GetName(); if (file->IsDirectory()) { if ((fname!="..") && (fname!=".")) { // skip it fListTree->AddItem(item,fname.Data()); }//if } else if (fname.EndsWith(".root")) { // add root files fListTree->AddItem(item,fname.Data(), fRootIcon, fRootIcon); }//if }//while delete files; } else { TString filename = DirName(item); if (filename.EndsWith(".root")) { TKey *key = 0; TIter next(fFile->GetListOfKeys()); while ((key = (TKey*)next())) { if (strcmp(key->GetClassName(), "TDirectory") != 0) continue; fListTree->AddItem(item,key->GetName()); }//while }//if }//if }//DoTreeDoubleClicked //______________________________________________________________________________ Int_t XFrame::NewFile(const char *filename) { if(kCS) cout << "------XFrame::NewFile------" << endl; // TFile *file = new TFile(filename,"RECREATE"); TFile *file = new TFile(filename,"NEW"); if (!file) return 1; // Number of tree entries Int_t nentries = 100; Double_t x; TTree *tree = 0; TString str = "Tree"; // Create trees for group1 gRandom->SetSeed(); for (Int_t i=0; i<4; i++) { str = "TreeX"; str += i; tree = new TTree(str, "tree X for test"); tree->Branch("BrX", &x, "x/D"); for (Int_t j=0; jRndm(1); tree->Fill(); }//for_j tree->Write(); }//for_i // Create trees for group2 for (Int_t i=0; i<4; i++) { str = "TreeY"; str += i; tree = new TTree(str, "tree Y for test"); tree->Branch("BrX", &x, "x/D"); for (Int_t j=0; j<100; j++) { x = gRandom->Rndm(1) + gRandom->Rndm(1); tree->Fill(); }//for_j tree->Write(); }//for_i delete file; return 0; }//NewFile //______________________________________________________________________________ void XFrame::CreateMenuBar() { if(kCS) cout << "------XFrame::CreateMenuBar------" << endl; // File menu fMenuFile = new TGPopupMenu(gClient->GetRoot()); fMenuFile->AddEntry("&New", M_FILE_NEW); fMenuFile->AddEntry("&Exit", M_FILE_EXIT); fMenuFile->Connect("Activated(Int_t)","XFrame",this,"DoMenu(Int_t)"); // Create menubar layout hints fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 0, 0, 1, 1); fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0); fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight); // Add menus to MenuBar fMenuBar = new TGMenuBar(fMain, 1, 1, kHorizontalFrame); fMenuBar->AddPopup("&File", fMenuFile, fMenuBarItemLayout); fMain->AddFrame(fMenuBar, fMenuBarLayout); // Line to separate menubar fLineH1 = new TGHorizontal3DLine(fMain); fLineLayout = new TGLayoutHints(kLHintsTop | kLHintsExpandX); fMain->AddFrame(fLineH1, fLineLayout); fLineH1->DrawBorder(); }//CreateMenuBar //______________________________________________________________________________ void XFrame::DeleteMenuBar() { if(kCS) cout << "------XFrame::DeleteMenuBar------" << endl; delete fLineH1; delete fMenuBar; delete fMenuFile; delete fMenuBarLayout; delete fMenuBarItemLayout; delete fMenuBarHelpLayout; delete fLineLayout; }//DeleteMenuBar //______________________________________________________________________________ void XFrame::CreateFrameSelect(TGCompositeFrame *parent) { if(kCS) cout << "------XFrame::CreateFrameSelect------" << endl; // Create tabs in canvas fFSelect = new TGVerticalFrame(parent, 0, 0); fCanvas3 = new TGCanvas(fFSelect, 10, 10, 0); fTab3 = new TGTab(fCanvas3->GetViewPort(), 200, 20); fTab3->Associate(parent); //? fCanvas3->SetContainer(fTab3); // Create tabs CreateTabSelect(fTab3); fFSelect->AddFrame(fCanvas3, fHintXY); fFSelect->Resize(200, 260); parent->AddFrame(fFSelect, fHintRXY); }//CreateFrameSelect //______________________________________________________________________________ void XFrame::DeleteFrameSelect() { if(kCS) cout << "------XFrame::DeleteFrameSelect------" << endl; DeleteTabSelect(); delete fTab3; delete fCanvas3; delete fFSelect; }//DeleteFrameSelect //______________________________________________________________________________ void XFrame::CreateTabSelect(TGTab *tab) { // Create Select tab frames if(kCS) cout << "------XFrame::CreateTabSelect------" << endl; TGLayoutHints *hint = 0; // Tab Select TGCompositeFrame *tabframe = 0; tabframe = tab->AddTab("Select"); fFTSel = new TGCompositeFrame(tabframe, 60, 20, kVerticalFrame); tabframe->AddFrame(fFTSel, fHintXY); // Select XPS Data File fFGSel = new TGGroupFrame(fFTSel, "Select File", kHorizontalFrame | kFixedSize); hint = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,5,5); fFTSel->AddFrame(fFGSel, hint); fFGSel->Resize(500,60); fTrash->Add(hint); fLabO = new TGLabel(fFGSel, new TGString("File:")); hint = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,7,5); fFGSel->AddFrame(fLabO,hint); fTrash->Add(hint); fTxtO = new TGTextEntry(fFGSel, fBufO = new TGTextBuffer(255), -1); hint = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 5,5,7,5); fFGSel->AddFrame(fTxtO,hint); fTrash->Add(hint); fBrowseOBtn = new TGTextButton(fFGSel, "Br&owse...", B_BROWSE_OPENFILE); fBrowseOBtn->Connect("Clicked()", "XFrame", this, "DoSelectOpenFile()"); fBrowseOBtn->SetToolTipText("Open file <*.root> to select data"); hint = new TGLayoutHints(kLHintsTop | kLHintsRight, 5,5,7,5); fFGSel->AddFrame(fBrowseOBtn,hint); fTrash->Add(hint); // Select Trees fFGTree = new TGGroupFrame(fFTSel, "Select Trees", kHorizontalFrame | kFixedSize); hint = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,5,5); fFTSel->AddFrame(fFGTree, hint); fFGTree->Resize(500,360); fTrash->Add(hint); fCFSel1 = new TGCompositeFrame(fFGTree,10,10, kVerticalFrame); hint = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5,5,5,5); fFGTree->AddFrame(fCFSel1, hint); fTrash->Add(hint); // BrowseView fBrowseView = new TGListView(fCFSel1, 300, 280); fBContainer = new TGLVContainer(fBrowseView->GetViewPort(), 10, 10, kHorizontalFrame, fCFSel1->GetWhitePixel()); fBContainer->Associate(fCFSel1); fBrowseView->SetHeaders(2); fBrowseView->SetHeader("Tree Name", kTextLeft, kTextLeft, 0); fBrowseView->SetHeader("Tree Title", kTextLeft, kTextLeft, 1); fBrowseView->SetContainer(fBContainer); fBrowseView->SetViewMode(kLVDetails); hint = new TGLayoutHints(kLHintsTop | kLHintsLeft, 2,3,5,5); fCFSel1->AddFrame(fBrowseView, hint); fTrash->Add(hint); }//CreateTabSelect //______________________________________________________________________________ void XFrame::DeleteTabSelect() { // Delete Select tab frames if(kCS) cout << "------XFrame::DeleteTabSelect------" << endl; delete fBContainer; delete fBrowseView; delete fCFSel1; delete fFGTree; delete fBrowseOBtn; delete fTxtO; delete fLabO; delete fFGSel; delete fFTSel; }//DeleteTabSelect //______________________________________________________________________________ void guiSelectFile() { new XFrame(gClient->GetRoot(), 400, 220); } //______________________________________________________________________________ //______________________________________________________________________________ #ifdef STANDALONE int main(int argc, char **argv) { TApplication theApp("App", &argc, argv); if (gROOT->IsBatch()) { fprintf(stderr, "%s: cannot run in batch mode\n", argv[0]); return 1; } guiSelectFile(); theApp.Run(); return 0; } #endif