#include #include #include #include #include #include #include class TNLW : public TGVerticalFrame { private: TObjArray fWidgets; public: TNLW(const TGWindow *p, const Text_t *name); ~TNLW() {fWidgets.Delete();} }; class TNodeListTest : public TGTransientFrame { protected: TObjArray fWidgets; public: TNodeListTest(const TGWindow *parent); ~TNodeListTest() {fWidgets.Delete();} Bool_t ProcessMessage(Long_t msg, Long_t p1, Long_t p2) {CloseWindow();} void CloseWindow() {delete this;} }; class TMain : public TGMainFrame { protected: TObjArray fWidgets; public: TMain(const TGWindow *parent); ~TMain() {fWidgets.Delete();} Bool_t ProcessMessage(Long_t msg, Long_t p1, Long_t p2) {new TNodeListTest(this);} void CloseWindow() {gApplication->Terminate(0);} }; TNodeListTest::TNodeListTest(const TGWindow *parent) : TGTransientFrame(gClient->GetRoot(),parent,200, 200) { TGLayoutHints *layout = new TGLayoutHints(kLHintsLeft | kLHintsTop, 10, 10, 10, 10); fWidgets.Add(layout); TNLW *NodeList = new TNLW(this,"NodeList"); fWidgets.Add(NodeList); this->AddFrame(NodeList, layout); TGTextButton *close = new TGTextButton(this,"Close"); fWidgets.Add(close); this->AddFrame(close, layout); close->Associate(this); MapSubwindows(); Resize(GetDefaultSize()); MapWindow(); } TNLW::TNLW(const TGWindow *p, const Text_t *name) : TGVerticalFrame(p,10,10) { // Layout hints TGLayoutHints *ExpandXY = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 0); fWidgets.Add(ExpandXY); TGLayoutHints *ExpandXY1 = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 0, 0); fWidgets.Add(ExpandXY1); // Draw Node list TGCanvas *ListTreeCanvas = new TGCanvas(this, 300, 200, kSunkenFrame); fWidgets.Add(ListTreeCanvas); AddFrame(ListTreeCanvas, ExpandXY1); TGListTree *ListTree = new TGListTree(ListTreeCanvas->GetViewPort(), 10, 10, kHorizontalFrame, TGFrame::GetWhitePixel()); fWidgets.Add(ListTree); ListTreeCanvas->SetContainer(ListTree); ListTree->SetCanvas(ListTreeCanvas); ListTree->AddItem(ListTree->GetFirstItem(),"Item"); } TMain::TMain(const TGWindow *parent) : TGMainFrame(parent,200,200) { TGLayoutHints *layout = new TGLayoutHints(kLHintsLeft | kLHintsTop, 10, 10, 10, 10); fWidgets.Add(layout); TGTextButton *popup = new TGTextButton(this,"Click Here"); fWidgets.Add(popup); this->AddFrame(popup, layout); popup->Associate(this); MapSubwindows(); Resize(GetDefaultSize()); MapWindow(); } int main(int argc, char **argv) { TApplication theApp("Tester",&argc, argv); TMain mainwindow(gClient->GetRoot()); theApp.Run(); return(0); }