#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //Global Variables vector myFiles; int i0=0; int i1=0; int i2=0; //_____________________________________________________________________________ class MyMainFrame : public TGMainFrame { private: TGListBox *fListBox; TGCheckButton *fCheckMulti; TList *fSelected; TGTextViewostream *fTRun, *fTgas, *fTdaq, *fTG4, *fTrd, *fTproc; TGTextEntry *fCommand; TGLayoutHints *fL; TGCompositeFrame *fF, *fFproc, *fFG4, *fFrun; TGTab *fTab; TGCompositeFrame *tf; TGCompositeFrame *fFleft; TGCompositeFrame *fFright; public: MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h); virtual ~MyMainFrame(); void DoSave(); void CloseWindow(); void PrintSelected(); void CreateTabs(); void DoTab(Int_t id); void DoProcesses(); void DeleteTabs(); ClassDef(MyMainFrame, 0) }; //_____________________________________________________________________________ MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h) : TGMainFrame(p, w, h), fTab(0) { // Create vertical splitter TGHorizontalFrame *fHf = new TGHorizontalFrame(this, 50, 50); TGVerticalFrame *fV1 = new TGVerticalFrame(fHf, 10, 10, kFixedWidth); TGVerticalFrame *fV2 = new TGVerticalFrame(fHf, 10, 10); fFleft = new TGCompositeFrame(fV1, 10, 10, kSunkenFrame); fFright = new TGCompositeFrame(fV2, 10, 10, kSunkenFrame); //Add listBox on the left side fListBox = new TGListBox(fFleft, 89); fSelected = new TList; char tmp[5]; for (int i = 0; i < 5; ++i) { sprintf(tmp, "Entry %i", i+1); fListBox->AddEntry(tmp, i+1); } fFleft->AddFrame(fListBox, new TGLayoutHints(kLHintsExpandX |kLHintsExpandY, 0, 0, 5, 10)); //Select with a Single Click fListBox->Connect("Selected(Int_t)","MyMainFrame",this,"CreateTabs()"); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fV1->AddFrame(fFleft, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 5, 10)); fV2->AddFrame(fFright, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 5, 10)); fV1->Resize(fFleft->GetDefaultWidth()+20, fV1->GetDefaultHeight()); fV2->Resize(fFright->GetDefaultWidth(), fV1->GetDefaultHeight()); fHf->AddFrame(fV1, new TGLayoutHints(kLHintsLeft | kLHintsExpandY)); TGVSplitter *splitter = new TGVSplitter(fHf,2,2); splitter->SetFrame(fV1, kTRUE); fHf->AddFrame(splitter, new TGLayoutHints(kLHintsLeft | kLHintsExpandY)); fHf->AddFrame(fV2, new TGLayoutHints(kLHintsRight | kLHintsExpandX | kLHintsExpandY)); AddFrame(fHf, new TGLayoutHints(kLHintsRight | kLHintsExpandX | kLHintsExpandY)); // button frame TGVerticalFrame *vframe = new TGVerticalFrame(this, 10, 10); TGCompositeFrame *cframe2 = new TGCompositeFrame(vframe, 170, 20, kHorizontalFrame | kFixedWidth); TGTextButton *exit = new TGTextButton(cframe2, "&Exit ","gApplication->Terminate(0)"); cframe2->AddFrame(exit, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 2, 0, 2, 2)); vframe->AddFrame(cframe2, new TGLayoutHints(kLHintsExpandX, 2, 2, 5, 1)); AddFrame(vframe, new TGLayoutHints(kLHintsExpandX, 2, 2, 5, 1)); // What to clean up in destructor SetCleanup(kDeepCleanup); // Set a name to the main frame SetWindowName("RunBrowser"); SetWMSizeHints(350, 200, 600, 400, 0, 0); MapSubwindows(); Resize(GetDefaultSize()); MapWindow(); } //_____________________________________________________________________________ MyMainFrame::~MyMainFrame() { // Clean up all widgets, frames and layouthints that were used Cleanup(); } //_____________________________________________________________________________ void MyMainFrame::CloseWindow() { // Called when window is closed via the window manager. delete this; } //_____________________________________________________________________________ void MyMainFrame::CreateTabs() { //Create tabs on the right side if (fTab == 0) { fTab = new TGTab (fFright, 500, 300); fL= new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5); fFright->AddFrame(fTab, fL); //insert tab } DeleteTabs(); //Tab_Run tf= fTab->AddTab("Run"); fFrun= new TGCompositeFrame(tf, 200, 200, kVerticalFrame); tf->AddFrame (fFrun, fL); //Add TextBox fTRun = new TGTextViewostream (fFrun, 500, 300); fFrun->AddFrame(fTRun, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0)); //Tabs of Metadata-daq,gas and HistoricMetadata-restG4,readout tf= fTab->AddTab("daq"); fF= new TGCompositeFrame(tf, 200, 200, kVerticalFrame); tf->AddFrame (fF, fL); //Add TextBox fTdaq = new TGTextViewostream (fF, 500, 300); fF->AddFrame(fTdaq, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0)); tf= fTab->AddTab("gas"); fF= new TGCompositeFrame(tf, 200, 200, kVerticalFrame); tf->AddFrame (fF, fL); //Add TextBox fTgas = new TGTextViewostream (fF, 500, 300); fF->AddFrame(fTgas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0)); tf= fTab->AddTab("restG4"); fFG4= new TGCompositeFrame(tf, 200, 200, kVerticalFrame); tf->AddFrame (fFG4, fL); //Add TextBox fTG4 = new TGTextViewostream (fFG4, 500, 300); fFG4->AddFrame(fTG4, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0)); tf= fTab->AddTab("readout"); fF= new TGCompositeFrame(tf, 200, 200, kVerticalFrame); tf->AddFrame (fF, fL); //Add TextBox fTrd = new TGTextViewostream (fF, 500, 300); fF->AddFrame(fTrd, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0)); //Tab of Processes tf= fTab->AddTab("Processes"); fFproc= new TGCompositeFrame(tf, 200, 200, kVerticalFrame); tf->AddFrame (fFproc, fL); //Update Window fTab->Layout(); fFright->MapSubwindows(); fFright->Resize(GetDefaultSize()); //Select a tab fTab->Connect("Selected(Int_t)", "MyMainFrame", this, "DoTab(Int_t)"); } //_____________________________________________________________________________ void MyMainFrame::DeleteTabs() { // remove all the tabs int nt = fTab->GetNumberOfTabs(); for (int i = 0 ; i < nt; i++) { fTab->RemoveTab(0, kFALSE); } fTab->Layout(); } void test_remove_tabs() { // Popup the GUI... MyMainFrame *mainFrame = new MyMainFrame(gClient->GetRoot(), 350, 200); }