#include #include #include #include #include #include #include #include #include #include enum { TB_START_BROWS, }; //------------------------------------------------------------------------------ class TestMainFrame { RQ_OBJECT("TestMainFrame") private: TGMainFrame *fMain; TGTextButton *fstBrowser; TRootEmbeddedCanvas *fEc; bool ProcessMessage(Long_t,Long_t,Long_t); TBrowser *fBrowser; public: TestMainFrame(const TGWindow *p, UInt_t w, UInt_t h); virtual ~TestMainFrame(); void StartBrowser(); }; //------------------------------------------------------------------------------ TestMainFrame::TestMainFrame(const TGWindow *p, UInt_t w, UInt_t h) { fBrowser=0; fMain = new TGMainFrame(p, w, h); fMain->SetCleanup(kDeepCleanup); fstBrowser = new TGTextButton(fMain,"Start Browser",TB_START_BROWS); fstBrowser->Connect("Clicked()", "TestMainFrame", this, "StartBrowser()"); fMain->AddFrame(fstBrowser,new TGLayoutHints(kLHintsNormal)); fEc = new TRootEmbeddedCanvas("Event Display", fMain, 600, 600); fMain->AddFrame(fEc,new TGLayoutHints(kLHintsExpandX|kLHintsExpandY,1,1,1,1)); fMain->MapSubwindows(); fMain->Resize(); fMain->MapWindow(); } //------------------------------------------------------------------------------ TestMainFrame::~TestMainFrame() { delete fMain; } //----------------------------------------------------------------------------- void TestMainFrame::StartBrowser() { if(!fBrowser) { fBrowser = new TBrowser("BRO","Histogram browser"); fstBrowser->SetText("Stop Browser"); } else { delete fBrowser; fBrowser = 0; fstBrowser->SetText("Start Browser"); } } //------------------------------------------------------------------------------ void brtest() { new TestMainFrame(gClient->GetRoot(), 400, 220); } //---- Main program ------------------------------------------------------------ #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; } brtest(); theApp.Run(); return 0; } #endif