#include #include #include #include #include #include #include #include void test_editor_canvas() { TGMainFrame* mf = new TGMainFrame(gClient->GetRoot(), 400, 400); mf->SetWindowName("Foo"); TGHorizontalFrame* hMain = new TGHorizontalFrame(mf, 400, 400); mf->AddFrame(hMain, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); TGVerticalFrame* vf1 = new TGVerticalFrame(hMain, 200, 400, kFixedWidth); TGCompositeFrame* vfc1 = new TGCompositeFrame(vf1); TGVerticalFrame* vf2 = new TGVerticalFrame(hMain, 200, 400); TGCompositeFrame* vfc2 = new TGCompositeFrame(vf2); vf1->AddFrame(vfc1, new TGLayoutHints(kLHintsLeft | kLHintsExpandY | kLHintsExpandX)); vf2->AddFrame(vfc2, new TGLayoutHints(kLHintsLeft | kLHintsExpandY | kLHintsExpandX)); TGTab* tab1 = new TGTab(vfc1, 150, 400); TGTab* tab2 = new TGTab(vfc2, 400, 400); TGCompositeFrame* frame1 = tab1->AddTab("Editor"); TGCompositeFrame* frame2 = tab2->AddTab("Canvas"); vfc1->AddFrame(tab1, new TGLayoutHints(kLHintsLeft | kLHintsExpandY | kLHintsExpandX)); vfc2->AddFrame(tab2, new TGLayoutHints(kLHintsLeft | kLHintsExpandY | kLHintsExpandX)); TGVSplitter *splitter = new TGVSplitter(hMain,2,30); splitter->SetFrame(vf1, kTRUE); hMain->AddFrame(vf1, new TGLayoutHints(kLHintsLeft | kLHintsExpandY)); hMain->AddFrame(splitter, new TGLayoutHints(kLHintsLeft | kLHintsExpandY, 10, 10, 0, 0)); //TGVerticalFrame *editor = new TGVerticalFrame(frame1, 100, 400)); //frame1->AddFrame(editor, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); TGHorizontalFrame *evf = new TGHorizontalFrame(frame2, 400, 400); frame2->AddFrame(evf, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 20, 20, 20, 20)); hMain->AddFrame(vf2, new TGLayoutHints(kLHintsLeft | kLHintsExpandY | kLHintsExpandX)); mf->MapSubwindows(); mf->Layout(); // this is where embedding is done: evf->SetEditable(); TCanvas* c = new TCanvas("Foo", "Bar", 400, 400); evf->SetEditable(kFALSE); mf->Layout(); mf->MapWindow(); }