54 ClassImp(TEveCompositeFrame);
56 TEveContextMenu* TEveCompositeFrame::fgCtxMenu = 0;
58 const TString TEveCompositeFrame::fgkEmptyFrameName(
"<relinquished>");
59 TList* TEveCompositeFrame::fgFrameList =
new THashList;
61 TEveCompositeFrame::IconBarCreator_foo TEveCompositeFrame::fgIconBarCreator = 0;
63 UInt_t TEveCompositeFrame::fgTopFrameHeight = 14;
64 UInt_t TEveCompositeFrame::fgMiniBarHeight = 4;
65 Bool_t TEveCompositeFrame::fgAllowTopFrameCollapse = kTRUE;
71 void TEveCompositeFrame::SetupFrameMarkup(IconBarCreator_foo creator,
72 UInt_t top_frame_height,
73 UInt_t mini_bar_height,
74 Bool_t allow_top_collapse)
76 fgIconBarCreator = creator;
77 fgTopFrameHeight = top_frame_height;
78 fgMiniBarHeight = mini_bar_height;
79 fgAllowTopFrameCollapse = allow_top_collapse;
85 TEveCompositeFrame::TEveCompositeFrame(TGCompositeFrame* parent,
86 TEveWindow* eve_parent) :
87 TGCompositeFrame (parent, 0, 0, kVerticalFrame),
97 fEveParent (eve_parent),
102 fTopFrame =
new TGHorizontalFrame(
this, 20, fgTopFrameHeight);
104 if (fgAllowTopFrameCollapse)
106 fToggleBar =
new TGTextButton(fTopFrame,
"Hide");
107 fToggleBar->ChangeOptions(kRaisedFrame);
108 fToggleBar->Resize(40, fgTopFrameHeight);
109 fToggleBar->Connect(
"Clicked()",
"TEveCompositeFrame",
this,
"FlipTitleBarState()");
110 fTopFrame->AddFrame(fToggleBar,
new TGLayoutHints(kLHintsNormal));
113 fTitleBar =
new TGTextButton(fTopFrame,
"Title Bar");
114 fTitleBar->ChangeOptions(kRaisedFrame);
115 fTitleBar->Resize(40, fgTopFrameHeight);
116 fTitleBar->Connect(
"Clicked()",
"TEveCompositeFrame",
this,
"TitleBarClicked()");
117 fTopFrame->AddFrame(fTitleBar,
new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
119 if (fgIconBarCreator)
121 fIconBar = (fgIconBarCreator)(
this, fTopFrame, fgTopFrameHeight);
125 TGButton* b =
new TGTextButton(fTopFrame,
"Actions");
126 b->ChangeOptions(kRaisedFrame);
127 b->Resize(40, fgTopFrameHeight);
128 b->Connect(
"Pressed()",
"TEveCompositeFrame",
this,
"ActionPressed()");
131 fTopFrame->AddFrame(fIconBar,
new TGLayoutHints(kLHintsNormal));
133 AddFrame(fTopFrame,
new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
136 if (fgAllowTopFrameCollapse)
138 fMiniBar =
new TGButton(
this);
139 fMiniBar->ChangeOptions(kRaisedFrame | kFixedHeight);
140 fMiniBar->Resize(20, fgMiniBarHeight);
141 fMiniBar->SetBackgroundColor(TEveWindow::GetMiniBarBackgroundColor());
142 fMiniBar->Connect(
"Clicked()",
"TEveCompositeFrame",
this,
"FlipTitleBarState()");
143 AddFrame(fMiniBar,
new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
148 fTopFrame->SetCleanup(kLocalCleanup);
149 SetCleanup(kLocalCleanup);
153 SetMapSubwindows(kFALSE);
156 fEveWindowLH =
new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY);
162 fEveParent = gEve->GetWindowManager();
164 fgFrameList->Add(
this);
171 TEveCompositeFrame::~TEveCompositeFrame()
173 fgFrameList->Remove(
this);
178 Info(
"TEveCompositeFrame::~TEveCompositeFrame",
179 "EveWindow not null '%s', relinquishing it now.",
180 fEveWindow->GetElementName());
182 fEveWindow->ClearEveFrame();
183 RelinquishEveWindow();
192 void TEveCompositeFrame::WindowNameChanged(
const TString& name)
194 fTitleBar->SetText(name);
205 void TEveCompositeFrame::AcquireEveWindow(TEveWindow* ew)
211 static const TEveException eh(
"TEveCompositeFrame::AcquireEveWindow ");
214 throw eh +
"Window already set.";
217 throw eh +
"Called with 0 argument.";
221 fEveWindow->IncDenyDestroy();
222 TGFrame* gui_frame = fEveWindow->GetGUIFrame();
223 gui_frame->ReparentWindow(
this);
224 AddFrame(gui_frame, fEveWindowLH);
225 fEveWindow->PostDock();
226 gui_frame->MapWindow();
228 SetCurrent(fEveWindow->IsCurrent());
229 SetShowTitleBar(fEveWindow->GetShowTitleBar());
230 WindowNameChanged(fEveWindow->GetElementName());
238 TEveWindow* TEveCompositeFrame::RelinquishEveWindow(Bool_t reparent)
240 TEveWindow* ex_ew = fEveWindow;
244 TGFrame* gui_frame = fEveWindow->GetGUIFrame();
245 gui_frame->UnmapWindow();
246 fEveWindow->PreUndock();
247 RemoveFrame(gui_frame);
249 gui_frame->ReparentWindow(fClient->GetDefaultRoot());
250 fEveWindow->DecDenyDestroy();
253 WindowNameChanged(fgkEmptyFrameName);
262 TEveWindow* TEveCompositeFrame::GetEveParentAsWindow()
const
264 return dynamic_cast<TEveWindow*
>(fEveParent);
271 void TEveCompositeFrame::SetCurrent(Bool_t curr)
274 fTitleBar->SetBackgroundColor(TEveWindow::GetCurrentBackgroundColor());
276 fTitleBar->SetBackgroundColor(GetDefaultFrameBackground());
278 fClient->NeedRedraw(fTitleBar);
285 void TEveCompositeFrame::SetShowTitleBar(Bool_t show)
289 ShowFrame(fTopFrame);
291 HideFrame(fTopFrame);
295 fShowInSync = show == fEveWindow->GetShowTitleBar();
301 void TEveCompositeFrame::HideAllDecorations()
303 HideFrame(fTopFrame);
306 fShowInSync = kFALSE;
312 void TEveCompositeFrame::ShowNormalDecorations()
314 SetShowTitleBar(fEveWindow->GetShowTitleBar());
321 void TEveCompositeFrame::ActionPressed()
323 if (fgCtxMenu == 0) {
324 fgCtxMenu =
new TEveContextMenu(
"",
"");
327 fgCtxMenu->SetupAndPopup(fIconBar, fEveWindow);
334 void TEveCompositeFrame::FlipTitleBarState()
337 fEveWindow->FlipShowTitleBar();
339 SetShowTitleBar(fEveWindow->GetShowTitleBar());
346 void TEveCompositeFrame::TitleBarClicked()
348 fEveWindow->TitleBarClicked();
356 ClassImp(TEveCompositeFrameInMainFrame);
361 TEveCompositeFrameInMainFrame::TEveCompositeFrameInMainFrame(TGCompositeFrame* parent,
362 TEveWindow* eve_parent,
364 TEveCompositeFrame(parent, eve_parent),
367 fOriginalContainer (0)
369 fMainFrame->Connect(
"CloseWindow()",
"TEveCompositeFrameInMainFrame",
this,
"MainFrameClosed()");
370 gEve->GetWindowManager()->Connect(
"WindowDeleted(TEveWindow*)",
"TEveCompositeFrameInMainFrame",
this,
"SomeWindowClosed(TEveWindow*)");
376 TEveCompositeFrameInMainFrame::~TEveCompositeFrameInMainFrame()
379 Info(
"~TEveCompositeFrameInMainFrame",
"Destructor.");
383 if (gEve && gEve->GetWindowManager())
385 gEve->GetWindowManager()->Disconnect(
"WindowDeleted(TEveWindow*)",
this,
"SomeWindowClosed(TEveWindow*)");
389 Info(
"~TEveCompositeFrameInMainFrame",
"gEve null - OK if it was terminated.");
396 void TEveCompositeFrameInMainFrame::WindowNameChanged(
const TString& name)
398 fMainFrame->SetWindowName(name);
400 TEveCompositeFrame::WindowNameChanged(name);
411 void TEveCompositeFrameInMainFrame::Destroy()
414 Info(
"TEveCompositeFrameInMainFrame::Destroy()",
415 "Propagating call to main-frame.");
417 assert (fEveWindow == 0);
419 fMainFrame->CloseWindow();
425 void TEveCompositeFrameInMainFrame::SetOriginalSlotAndContainer(TEveWindow* slot,
426 TEveWindow* container)
428 static const TEveException kEH(
"TEveCompositeFrameInMainFrame::SetOriginalSlotAndContainer ");
430 if (container && ! container->CanMakeNewSlots())
431 throw kEH +
"Given window can not make new slots.";
433 fOriginalSlot = slot;
434 fOriginalContainer = container;
441 void TEveCompositeFrameInMainFrame::SomeWindowClosed(TEveWindow* w)
443 if (w == fOriginalSlot)
446 if (w == fOriginalContainer)
447 fOriginalContainer = 0;
456 void TEveCompositeFrameInMainFrame::MainFrameClosed()
460 TEveWindow* swapCandidate = 0;
464 TEveCompositeFrameInPack* packFrame =
dynamic_cast<TEveCompositeFrameInPack*
>(fOriginalSlot->GetEveFrame());
466 TGPack* pack = (TGPack*)(packFrame->GetParent());
467 pack->ShowFrame(packFrame);
469 swapCandidate = fOriginalSlot;
471 else if (fOriginalContainer)
473 swapCandidate = fOriginalContainer->NewSlot();
475 else if (gEve->GetWindowManager()->HasDefaultContainer())
477 swapCandidate = gEve->GetWindowManager()->GetDefaultContainer()->NewSlot();
482 TEveWindow::SwapWindows(fEveWindow, swapCandidate);
483 gEve->GetWindowManager()->WindowDocked(fEveWindow );
487 fMainFrame->DontCallClose();
490 fEveWindow->DestroyWindowAndSlot();
493 Info(
"TEveCompositeFrameInMainFrame::MainFrameClosed()",
494 "Expecting destructor call soon.");
502 ClassImp(TEveCompositeFrameInPack);
507 TEveCompositeFrameInPack::TEveCompositeFrameInPack(TGCompositeFrame* parent,
508 TEveWindow* eve_parent,
510 TEveCompositeFrame(parent, eve_parent),
518 TEveCompositeFrameInPack::~TEveCompositeFrameInPack()
528 void TEveCompositeFrameInPack::Destroy()
531 Info(
"TEveCompositeFrameInPack::Destroy()",
"Removing from pack and deleting.");
533 assert(fEveWindow == 0);
535 fPack->RemoveFrame(
this);
544 ClassImp(TEveCompositeFrameInTab);
549 TEveCompositeFrameInTab::TEveCompositeFrameInTab(TGCompositeFrame* parent,
550 TEveWindow* eve_parent,
552 TEveCompositeFrame(parent, eve_parent),
554 fParentInTab (parent)
561 TEveCompositeFrameInTab::~TEveCompositeFrameInTab()
568 void TEveCompositeFrameInTab::WindowNameChanged(
const TString& name)
570 Int_t t = FindTabIndex();
571 fTab->GetTabTab(t)->SetText(
new TGString(name));
574 TEveCompositeFrame::WindowNameChanged(name);
581 Int_t TEveCompositeFrameInTab::FindTabIndex()
583 static const TEveException eh(
"TEveCompositeFrameInTab::FindTabIndex ");
585 Int_t nt = fTab->GetNumberOfTabs();
586 for (Int_t t = 0; t < nt; ++t)
588 if (fTab->GetTabContainer(t) == fParentInTab)
594 throw eh +
"parent frame not found in tab.";
603 void TEveCompositeFrameInTab::Destroy()
606 Info(
"TEveCompositeFrameInTab::Destroy()",
"Removing from tab and deleting.");
608 assert (fEveWindow == 0);
610 Int_t t = FindTabIndex();
613 fTab->RemoveTab(t, kFALSE);
614 fParentInTab->DestroyWindow();
615 fParentInTab->SetCleanup(kNoCleanup);
624 void TEveCompositeFrameInTab::SetCurrent(Bool_t curr)
626 TEveCompositeFrame::SetCurrent(curr);
628 Int_t t = FindTabIndex();
629 TGTabElement* te = fTab->GetTabTab(t);
631 te->SetBackgroundColor(TEveWindow::GetCurrentBackgroundColor());
633 te->SetBackgroundColor(GetDefaultFrameBackground());
635 fClient->NeedRedraw(te);
644 ClassImp(TEveWindow);
646 UInt_t TEveWindow::fgMainFrameDefWidth = 640;
647 UInt_t TEveWindow::fgMainFrameDefHeight = 480;
648 Pixel_t TEveWindow::fgCurrentBackgroundColor = 0x80A0C0;
649 Pixel_t TEveWindow::fgMiniBarBackgroundColor = 0x80C0A0;
653 TEveWindow::TEveWindow(
const char* n,
const char* t) :
654 TEveElementList(n, t),
657 fShowTitleBar (kTRUE)
662 fChildClass = TEveWindow::Class();
668 TEveWindow::~TEveWindow()
671 Info(
"~TEveWindow",
"name='%s', deny-destroy=%d.",
672 GetElementName(), fDenyDestroy);
681 void TEveWindow::PreDeleteElement()
683 gEve->GetWindowManager()->DeleteWindow(
this);
684 TEveElementList::PreDeleteElement();
690 void TEveWindow::PreUndock()
692 for (List_ci i=fChildren.begin(); i!=fChildren.end(); ++i)
694 TEveWindow* w =
dynamic_cast<TEveWindow*
>(*i);
703 void TEveWindow::PostDock()
705 for (List_ci i=fChildren.begin(); i!=fChildren.end(); ++i)
707 TEveWindow* w =
dynamic_cast<TEveWindow*
>(*i);
717 void TEveWindow::NameTitleChanged()
719 fEveFrame->WindowNameChanged(GetElementName());
727 void TEveWindow::PopulateEmptyFrame(TEveCompositeFrame* ef)
729 ef->fEveParent->AddElement(
this);
730 ef->AcquireEveWindow(
this);
737 void TEveWindow::SwapWindow(TEveWindow* w)
739 static const TEveException eh(
"TEveWindow::SwapWindow ");
742 throw eh +
"Called with null argument.";
744 SwapWindows(
this, w);
750 void TEveWindow::SwapWindowWithCurrent()
752 static const TEveException eh(
"TEveWindow::SwapWindowWithCurrent ");
754 TEveWindow* current = gEve->GetWindowManager()->GetCurrentWindow();
757 throw eh +
"Current eve-window is not set.";
760 throw eh +
"This is the current window ... nothing changed.";
762 SwapWindows(
this, current);
768 void TEveWindow::UndockWindow()
770 TEveWindow* return_cont = fEveFrame->GetEveParentAsWindow();
771 if (return_cont && ! return_cont->CanMakeNewSlots())
775 TEveCompositeFrameInPack* packFrame =
dynamic_cast<TEveCompositeFrameInPack*
>(fEveFrame);
777 TGPack* pack = (TGPack*)(packFrame->GetParent());
778 pack->HideFrame(fEveFrame);
781 TEveWindowSlot* ew_slot = TEveWindow::CreateWindowMainFrame(0);
783 TEveWindow::SwapWindows(ew_slot,
this);
785 ((TEveCompositeFrameInMainFrame*) fEveFrame)->
786 SetOriginalSlotAndContainer(ew_slot, return_cont);
788 gEve->GetWindowManager()->WindowUndocked(
this );
795 void TEveWindow::UndockWindowDestroySlot()
797 TEveWindow* return_cont = fEveFrame->GetEveParentAsWindow();
798 if (return_cont && ! return_cont->CanMakeNewSlots())
801 TEveWindowSlot* ew_slot = TEveWindow::CreateWindowMainFrame(0);
803 TEveWindow::SwapWindows(ew_slot,
this);
805 ((TEveCompositeFrameInMainFrame*) fEveFrame)->
806 SetOriginalSlotAndContainer(0, return_cont);
808 ew_slot->DestroyWindowAndSlot();
810 gEve->GetWindowManager()->WindowUndocked(
this);
819 void TEveWindow::ReplaceWindow(TEveWindow* w)
821 fEveFrame->RelinquishEveWindow();
823 fEveFrame->fEveParent->AddElement(w);
824 fEveFrame->AcquireEveWindow(w);
825 w->fEveFrame = fEveFrame;
827 fEveFrame->fEveParent->RemoveElement(
this);
829 w->fEveFrame->Layout();
835 void TEveWindow::DestroyWindow()
838 Info(
"TEveWindow::DestroyWindow()",
"name='%s', class='%s', deny-destroy=%d.",
839 GetElementName(), ClassName(), fDenyDestroy);
841 if (fEveFrame != 0 && fDenyDestroy == 1)
843 TEveWindowSlot* ew_slot = TEveWindow::CreateDefaultWindowSlot();
845 fEveFrame->UnmapWindow();
847 Bool_t dozrc = fDestroyOnZeroRefCnt;
848 fDestroyOnZeroRefCnt = kFALSE;
850 fEveFrame->RelinquishEveWindow();
851 ew_slot->PopulateEmptyFrame(fEveFrame);
852 fEveFrame->fEveParent->RemoveElement(
this);
854 fDestroyOnZeroRefCnt = dozrc;
857 fEveFrame->MapWindow();
861 TEveElementList::Destroy();
867 void TEveWindow::DestroyWindowAndSlot()
870 Info(
"TEveWindow::DestroyWindowAndSlot()",
"'name=%s', class= '%s', deny-destroy=%d.",
871 GetElementName(), ClassName(), fDenyDestroy);
873 if (fEveFrame != 0 && fDenyDestroy == 1)
875 fEveFrame->RelinquishEveWindow();
876 fEveFrame->Destroy();
880 TEveElementList::Destroy();
889 void TEveWindow::ClearEveFrame()
898 void TEveWindow::SetShowTitleBar(Bool_t x)
900 if (fShowTitleBar == x)
904 fEveFrame->SetShowTitleBar(fShowTitleBar);
911 Bool_t TEveWindow::IsCurrent()
const
913 return gEve->GetWindowManager()->IsCurrentWindow(
this);
919 void TEveWindow::MakeCurrent()
921 if ( ! gEve->GetWindowManager()->IsCurrentWindow(
this))
922 gEve->GetWindowManager()->SelectWindow(
this);
929 void TEveWindow::SetCurrent(Bool_t curr)
931 fEveFrame->SetCurrent(curr);
937 Bool_t TEveWindow::IsAncestorOf(TEveWindow* win)
939 TEveWindow* parent =
dynamic_cast<TEveWindow*
>(win->fEveFrame->fEveParent);
945 return IsAncestorOf(parent);
958 void TEveWindow::TitleBarClicked()
960 gEve->GetWindowManager()->SelectWindow(
this);
967 TEveWindowSlot* TEveWindow::CreateDefaultWindowSlot()
969 return new TEveWindowSlot(
"Free Window Slot",
"A free window slot, can become a container or swallow a window.");
977 TEveWindowSlot* TEveWindow::CreateWindowMainFrame(TEveWindow* eve_parent)
979 TGMainFrame* mf =
new TGMainFrame(gClient->GetRoot(), fgMainFrameDefWidth, fgMainFrameDefHeight);
980 mf->SetCleanup(kLocalCleanup);
982 TEveCompositeFrameInMainFrame *slot =
new TEveCompositeFrameInMainFrame
983 (mf, eve_parent, mf);
985 TEveWindowSlot* ew_slot = TEveWindow::CreateDefaultWindowSlot();
986 ew_slot->PopulateEmptyFrame(slot);
988 mf->AddFrame(slot,
new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY));
1002 TEveWindowSlot* TEveWindow::CreateWindowInTab(TGTab* tab, TEveWindow* eve_parent)
1004 TGCompositeFrame *parent = tab->AddTab(
"<unused>");
1005 parent->SetCleanup(kLocalCleanup);
1007 TEveCompositeFrameInTab *slot =
new TEveCompositeFrameInTab(parent, eve_parent, tab);
1009 TEveWindowSlot* ew_slot = TEveWindow::CreateDefaultWindowSlot();
1011 ew_slot->PopulateEmptyFrame(slot);
1013 parent->AddFrame(slot,
new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY));
1027 void TEveWindow::SwapWindows(TEveWindow* w1, TEveWindow* w2)
1029 static const TEveException eh(
"TEveWindow::SwapWindows ");
1031 if (w1 == 0 || w2 == 0)
1032 throw eh +
"Called with null window.";
1035 throw eh +
"Windows are equal ... nothing to change.";
1037 if (w1->IsAncestorOf(w2) || w2->IsAncestorOf(w1))
1038 throw eh +
"Windows are in direct ancestry.";
1040 TEveCompositeFrame *f1 = w1->fEveFrame, *f2 = w2->fEveFrame;
1041 TEveElement *p1 = f1->fEveParent, *p2 = f2->fEveParent;
1049 f1->RelinquishEveWindow(kFALSE);
1050 f2->RelinquishEveWindow(kFALSE);
1051 f1->AcquireEveWindow(w2); w2->fEveFrame = f1;
1052 f2->AcquireEveWindow(w1); w1->fEveFrame = f2;
1056 p1->RemoveElement(w1);
1057 p2->RemoveElement(w2);
1060 f1->Layout(); f2->Layout();
1066 UInt_t TEveWindow::GetMainFrameDefWidth()
1068 return fgMainFrameDefWidth;
1074 UInt_t TEveWindow::GetMainFrameDefHeight()
1076 return fgMainFrameDefHeight;
1082 void TEveWindow::SetMainFrameDefWidth (UInt_t x)
1084 fgMainFrameDefWidth = x;
1090 void TEveWindow::SetMainFrameDefHeight(UInt_t x)
1092 fgMainFrameDefHeight = x;
1098 Pixel_t TEveWindow::GetCurrentBackgroundColor()
1100 return fgCurrentBackgroundColor;
1106 Pixel_t TEveWindow::GetMiniBarBackgroundColor()
1108 return fgMiniBarBackgroundColor;
1114 void TEveWindow::SetCurrentBackgroundColor(Pixel_t p)
1116 fgCurrentBackgroundColor = p;
1122 void TEveWindow::SetMiniBarBackgroundColor(Pixel_t p)
1124 fgMiniBarBackgroundColor = p;
1132 ClassImp(TEveWindowSlot);
1137 TEveWindowSlot::TEveWindowSlot(
const char* n,
const char* t) :
1142 fEmptyButt =
new TGTextButton(0,
" <empty>\nclick to select");
1143 fEmptyButt->ChangeOptions(kRaisedFrame);
1144 fEmptyButt->SetTextJustify(kTextCenterX | kTextCenterY);
1146 fEmptyButt->Connect(
"Clicked()",
"TEveWindow",
this,
"TitleBarClicked()");
1152 TEveWindowSlot::~TEveWindowSlot()
1154 fEmptyButt->DeleteWindow();
1160 TGFrame* TEveWindowSlot::GetGUIFrame()
1169 void TEveWindowSlot::SetCurrent(Bool_t curr)
1171 TEveWindow::SetCurrent(curr);
1174 fEmptyButt->SetBackgroundColor(fgCurrentBackgroundColor);
1176 fEmptyButt->SetBackgroundColor(fEmptyButt->GetDefaultFrameBackground());
1177 gClient->NeedRedraw(fEmptyButt);
1184 TEveWindowPack* TEveWindowSlot::MakePack()
1186 TEveWindowPack* eve_pack =
new TEveWindowPack
1187 (0,
"Pack",
"Window container for horizontal and vertical stacking.");
1189 ReplaceWindow(eve_pack);
1198 TEveWindowTab* TEveWindowSlot::MakeTab()
1200 TEveWindowTab* eve_tab =
new TEveWindowTab
1201 (0,
"Tab",
"Window container for horizontal and vertical stacking.");
1203 ReplaceWindow(eve_tab);
1214 TEveWindowFrame* TEveWindowSlot::MakeFrame(TGFrame* frame)
1216 TEveWindowFrame* eve_frame =
new TEveWindowFrame
1217 (frame,
"External frame",
"");
1219 ReplaceWindow(eve_frame);
1229 TGCompositeFrame* TEveWindowSlot::StartEmbedding()
1231 static const TEveException eh(
"TEveWindowSlot::StartEmbedding ");
1233 if (fEmbedBuffer != 0)
1234 throw eh +
"Already embedding.";
1236 fEmbedBuffer =
new TGCompositeFrame(gClient->GetDefaultRoot());
1237 fEmbedBuffer->SetEditable(kTRUE);
1239 return fEmbedBuffer;
1246 TEveWindowFrame* TEveWindowSlot::StopEmbedding(
const char* name)
1248 static const TEveException eh(
"TEveWindowSlot::StopEmbedding ");
1250 if (fEmbedBuffer == 0) {
1251 Warning(eh,
"Embedding not in progress.");
1255 fEmbedBuffer->SetEditable(kFALSE);
1257 Int_t size = fEmbedBuffer->GetList()->GetSize();
1260 Warning(eh,
"Frame has not been registered.");
1261 delete fEmbedBuffer;
1267 Warning(eh,
"Several frames have been registered (%d). Only the first one will be taken.", size);
1270 TGFrame *f = ((TGFrameElement*)fEmbedBuffer->GetList()->First())->fFrame;
1271 fEmbedBuffer->RemoveFrame(f);
1273 f->ReparentWindow(gClient->GetDefaultRoot());
1274 delete fEmbedBuffer;
1277 TGMainFrame *mf =
dynamic_cast<TGMainFrame*
>(f);
1281 mf->SetWindowName(name);
1284 TEveWindowFrame* eve_frame =
new TEveWindowFrame
1285 (f, mf->GetWindowName(), mf->ClassName());
1287 ReplaceWindow(eve_frame);
1298 ClassImp(TEveWindowFrame);
1305 TEveWindowFrame::TEveWindowFrame(TGFrame* frame,
const char* n,
const char* t) :
1311 fGUIFrame =
new TGCompositeFrame();
1312 fGUIFrame->SetCleanup(kLocalCleanup);
1319 TEveWindowFrame::~TEveWindowFrame()
1321 fGUIFrame->DeleteWindow();
1329 TGCompositeFrame* TEveWindowFrame::GetGUICompositeFrame()
1331 static const TEveException kEH(
"TEveWindowFrame::GetGUICompositeFrame ");
1333 TGCompositeFrame *cf =
dynamic_cast<TGCompositeFrame*
>(fGUIFrame);
1335 throw kEH +
"The registered frame is not a composite-frame.";
1346 ClassImp(TEveWindowPack);
1352 TEveWindowPack::TEveWindowPack(TGPack* p,
const char* n,
const char* t) :
1354 fPack (p ? p : new TGPack())
1361 TEveWindowPack::~TEveWindowPack()
1363 fPack->DeleteWindow();
1369 TGFrame* TEveWindowPack::GetGUIFrame()
1377 TEveWindowSlot* TEveWindowPack::NewSlot()
1379 return NewSlotWithWeight(1.f);
1385 TEveWindowSlot* TEveWindowPack::NewSlotWithWeight(Float_t w)
1387 TEveCompositeFrame* slot =
new TEveCompositeFrameInPack(fPack,
this, fPack);
1389 TEveWindowSlot* ew_slot = TEveWindow::CreateDefaultWindowSlot();
1390 ew_slot->PopulateEmptyFrame(slot);
1392 fPack->AddFrameWithWeight(slot, 0, w);
1403 void TEveWindowPack::FlipOrientation()
1405 fPack->SetVertical( ! fPack->GetVertical());
1411 void TEveWindowPack::SetVertical(Bool_t x)
1413 fPack->SetVertical(x);
1419 void TEveWindowPack::EqualizeFrames()
1421 fPack->EqualizeFrames();
1431 ClassImp(TEveWindowTab);
1437 TEveWindowTab::TEveWindowTab(TGTab* tab,
const char* n,
const char* t) :
1439 fTab (tab ? tab : new TGTab())
1446 TEveWindowTab::~TEveWindowTab()
1448 fTab->DeleteWindow();
1454 TGFrame* TEveWindowTab::GetGUIFrame()
1462 TEveWindowSlot* TEveWindowTab::NewSlot()
1464 return TEveWindow::CreateWindowInTab(fTab,
this);
1473 ClassImp(TEveContextMenu);
1478 TEveContextMenu::TEveContextMenu(
const char *name,
const char *title) :
1479 TContextMenu(name, title)
1486 void TEveContextMenu::SetupAndPopup(TGWindow* button, TObject* obj)
1491 gVirtualX->GetWindowSize(button->GetId(), x, y, w, h);
1492 gVirtualX->TranslateCoordinates(button->GetId(),
1493 gClient->GetDefaultRoot()->GetId(),
1494 0, 0, x, y, childdum);
1496 TRootContextMenu *rcm =
dynamic_cast<TRootContextMenu*
>(fContextMenuImp);
1499 gVirtualX->SetWMTransientHint (rcm->GetId(), button->GetId());
1502 Popup(x - 2, y + h - 2, obj);