#include #include #include #include #include class MyMainFrame : public TGMainFrame { // RQ_OBJECT("MyMainFrame"); public: MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h); virtual ~MyMainFrame(); void myClosing(); void dontcloseme(); }; MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h) : TGMainFrame(p, w, h) { SetCleanup(kDeepCleanup); DontCallClose(); Connect("CloseWindow()","MyMainFrame",this,"dontcloseme()"); TGCompositeFrame *cframe2 = new TGCompositeFrame(this, 50, 20, kVerticalFrame); TGTextButton *exit = new TGTextButton(cframe2, "&Exit ","gApplication->Terminate(0)"); cframe2->AddFrame(exit, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,2,2,2,2)); AddFrame(cframe2, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX, 2, 2, 2, 2)); SetWindowName("mygui"); MapSubwindows(); Resize(GetDefaultSize()); MapWindow(); } MyMainFrame::myClosing() { printf(" closing... \n"); Cleanup(); CloseWindow(); } MyMainFrame::dontcloseme() { printf(" please don't kill me! \n"); } MyMainFrame::~MyMainFrame() { Cleanup(); delete this; } void mygui() { MyMainFrame *thegui = new MyMainFrame(gClient->GetRoot(), 350, 80); #if 0 Int_t i = 0; while( i<5000000 ) { i++; gSystem->ProcessEvents(); }; thegui->myClosing(); #endif }