Logo ROOT  
Reference Guide
TGeoTabManager.cxx
Go to the documentation of this file.
1// @(#):$Id$
2// Author: M.Gheata
3
4/*************************************************************************
5 * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12/** \class TGeoTabManager
13\ingroup Geometry_builder
14
15Manager for all editor tabs.
16
17TGeoTreeDialog - Base class for dialog frames for selecting objects
18with a tree hierarchy. Specific implementations are:
19
20 - TGeoVolumeDialog - Special tree dialog class for selecting volumes.
21 - TGeoShapeDialog - Special tree dialog class for selecting shapes.
22 - TGeoMediumDialog - Special tree dialog class for selecting media.
23 - TGeoMaterialDialog - Special tree dialog class for selecting materials.
24 - TGeoMatrixDialog - Special tree dialog class for selecting matrices.
25 - TGeoTransientPanel - Special transient tab holding TGeo editors.
26*/
27
28#include "TROOT.h"
29#include "TClass.h"
30#include "TVirtualPad.h"
31#include "TGeoGedFrame.h"
32#include "TGTab.h"
33#include "TGLabel.h"
34#include "TGComboBox.h"
35#include "TGListBox.h"
36#include "TGListTree.h"
37#include "TGTextEntry.h"
38#include "TGCanvas.h"
39#include "TGMimeTypes.h"
40
41#include "TGeoManager.h"
42#include "TGeoShape.h"
43#include "TGeoVolume.h"
44#include "TGeoMedium.h"
45#include "TGeoMaterial.h"
46#include "TGeoMatrix.h"
47
48#include "TGedEditor.h"
49#include "TGeoTabManager.h"
50#include "TVirtualX.h"
51
53
55
56////////////////////////////////////////////////////////////////////////////////
57/// Ctor.
58
60{
61 fGedEditor = ged;
62 fPad = ged->GetPad();
63 fTab = ged->GetTab();
64 fVolume = 0;
65 fShapePanel = 0;
66 fMediumPanel = 0;
68 fMatrixPanel = 0;
69 fVolumeTab = 0;
70 fgEditorToMgrMap.Add(ged, this);
71}
72
73////////////////////////////////////////////////////////////////////////////////
74/// Dtor.
75
77{
79 if (fShapePanel) delete fShapePanel;
81 if (fMatrixPanel) delete fMatrixPanel;
82 if (fMediumPanel) delete fMediumPanel;
83}
84
85////////////////////////////////////////////////////////////////////////////////
86/// Static method to cleanup hierarchically all daughters of a composite frame.
87/// Does not remove the frame itself.
88
90{
92 TList *list = frame->GetList();
93 Int_t nframes = list->GetSize();
94 TClass *cl;
95 for (Int_t i=0; i<nframes; i++) {
96 el = (TGFrameElement *)list->At(i);
97 cl = el->fFrame->IsA();
100 }
101 frame->Cleanup();
102}
103
104////////////////////////////////////////////////////////////////////////////////
105/// Get editor for a shape.
106
108{
109 if (!shape) return;
110 if (!fShapePanel) fShapePanel = new TGeoTransientPanel(fGedEditor, "Shape", shape);
111 else {
112 fShapePanel->SetModel(shape);
113 fShapePanel->Show();
114 }
115}
116
117////////////////////////////////////////////////////////////////////////////////
118/// Get editor for a volume.
119
121{
122 if (!volume || !fVolumeTab) return;
127 SetModel(volume);
128}
129
130////////////////////////////////////////////////////////////////////////////////
131/// Get editor for a matrix.
132
134{
135 if (!matrix) return;
136 if (!fMatrixPanel) fMatrixPanel = new TGeoTransientPanel(fGedEditor, "Matrix", matrix);
137 else {
138 fMatrixPanel->SetModel(matrix);
140 }
141}
142
143////////////////////////////////////////////////////////////////////////////////
144/// Get editor for a medium.
145
147{
148 if (!medium) return;
149 if (!fMediumPanel) fMediumPanel = new TGeoTransientPanel(fGedEditor, "Medium", medium);
150 else {
151 fMediumPanel->SetModel(medium);
154 }
155}
156
157////////////////////////////////////////////////////////////////////////////////
158/// Get editor for a material.
159
161{
162 if (!material) return;
163 TString name = "Material";
164 if (material->IsMixture()) name = "Mixture";
165 if (!fMaterialPanel) fMaterialPanel = new TGeoTransientPanel(fGedEditor, name.Data(), material);
166 else {
167 fMaterialPanel->SetModel(material);
170 }
171}
172
173////////////////////////////////////////////////////////////////////////////////
174/// Get editor for a class.
175/// Look in fVolumeTab for any object deriving from TGedFrame,
176
178{
179 TClass *class2 = TClass::GetClass(TString::Format("%sEditor",cl->GetName()));
180 if (class2 && class2->InheritsFrom(TGedFrame::Class())) {
181 TGFrameElement *fr;
182 TIter next(fVolumeTab->GetList());
183 while ((fr = (TGFrameElement *) next())) if (fr->fFrame->IsA() == class2) return;
184 TGClient *client = fGedEditor->GetClient();
185 TGWindow *exroot = (TGWindow*) client->GetRoot();
186 client->SetRoot(fVolumeTab);
188 TGedFrame* gfr = reinterpret_cast<TGedFrame*>(class2->New());
189 gfr->SetModelClass(cl);
191 client->SetRoot(exroot);
193 gfr->MapSubwindows();
194 }
195}
196
197////////////////////////////////////////////////////////////////////////////////
198/// Static method to return the tab manager currently appended to the pad or create one
199/// if not existing.
200
202{
203 if (!ged) return NULL;
204 TPair *pair = (TPair*) fgEditorToMgrMap.FindObject(ged);
205 if (pair) {
206 return (TGeoTabManager*) pair->Value();
207 } else {
208 TGeoTabManager *tabmgr = new TGeoTabManager(ged); // added to fgEditorToMgrMap in ctor
209 return tabmgr;
210 }
211}
212
213////////////////////////////////////////////////////////////////////////////////
214/// Get index for a given tab element.
215
217{
218 Int_t ntabs = fTab->GetNumberOfTabs();
219 TString tabname = "Volume";
220
221 TGTabElement *tel;
222 for (Int_t i=0; i<ntabs; i++) {
223 tel = fTab->GetTabTab(i);
224 if (tel && !strcmp(tel->GetString(),tabname.Data())) return i;
225 }
226 return 0;
227}
228
229////////////////////////////////////////////////////////////////////////////////
230/// Move frame fr at the end of the list of parent p.
231
233{
234 TList *list = p->GetList();
235 TIter next(list);
236 TGFrameElement *el = 0;
237 while ((el=(TGFrameElement*)next())) {
238 if (el->fFrame == fr) break;
239 }
240 if (el) {
241 list->Remove(el);
242 list->Add(el);
243 }
244}
245
246////////////////////////////////////////////////////////////////////////////////
247/// Enable/disable tabs
248
250{
251 fTab->SetEnabled(GetTabIndex(), flag);
252}
253
254////////////////////////////////////////////////////////////////////////////////
255/// Send the SetModel signal to all editors in the tab TYPE.
256
258{
260 fVolume = (TGeoVolume*)model;
261 TGFrameElement *el;
262 TIter next(tab->GetList());
263 while ((el = (TGFrameElement *) next())) {
264 if ((el->fFrame)->InheritsFrom(TGedFrame::Class())) {
265 ((TGedFrame *)(el->fFrame))->SetModel(model);
266 }
267 }
268}
269
270////////////////////////////////////////////////////////////////////////////////
271/// Set a given tab element as active one.
272
274{
276}
277
279
281
282////////////////////////////////////////////////////////////////////////////////
283///static; return selected object
284
286{
287 return fgSelectedObj;
288}
289
290////////////////////////////////////////////////////////////////////////////////
291/// Constructor
292
295{
296 fgSelectedObj = 0;
297 fCanvas = new TGCanvas(this, 100, 200, kSunkenFrame | kDoubleBorder);
298 fLT = new TGListTree(fCanvas->GetViewPort(), 100, 200);
299 fLT->Associate(this);
302 f1 = new TGCompositeFrame(this, 100, 10, kHorizontalFrame | kLHintsExpandX);
303 fObjLabel = new TGLabel(f1, "Selected: -none-");
304 Pixel_t color;
305 gClient->GetColorByName("#0000ff", color);
306 fObjLabel->SetTextColor(color);
309 fClose = new TGTextButton(f1, "&Close");
310 fClose->Associate(this);
313
314 Int_t ww = caller->GetWidth();
315 Window_t wdum;
316 Int_t ax, ay;
317 gVirtualX->TranslateCoordinates(caller->GetId(), main->GetId(), 0,0,ax,ay,wdum);
318 Move(ax + ww, ay);
319 SetWMPosition(ax, ay);
320
321}
322
323////////////////////////////////////////////////////////////////////////////////
324/// Destructor
325
327{
328 delete fClose;
329 delete fObjLabel;
330 delete f1;
331 delete fLT;
332 delete fCanvas;
333}
334
335////////////////////////////////////////////////////////////////////////////////
336/// Update dialog to reflect current clicked object.
337
339{
340 static TString name;
341 if (!item || !item->GetUserData()) {
342 fgSelectedObj = 0;
343 name = "Selected: -none-";
345 return;
346 }
347 fgSelectedObj = (TObject *)item->GetUserData();
348 if (fgSelectedObj) {
349 name = TString::Format("Selected %s", fgSelectedObj->GetName());
351 }
352}
353
355
356////////////////////////////////////////////////////////////////////////////////
357/// Ctor.
358
360 :TGeoTreeDialog(caller, main, w, h)
361{
365 Layout();
366 SetWindowName("Volume dialog");
367 MapWindow();
368 gClient->WaitForUnmap(this);
369}
370
371////////////////////////////////////////////////////////////////////////////////
372/// Build volume specific list tree.
373
375{
376 const TGPicture *pic_fld = gClient->GetPicture("folder_t.xpm");
377 const TGPicture *pic_fldo = gClient->GetPicture("ofolder_t.xpm");
378 const TGPicture *pic_file = gClient->GetPicture("mdi_default.xpm");
379 const TGPicture *pic_fileo = gClient->GetPicture("fileopen.xpm");
380 TGListTreeItem *parent_item=0;
381 TGeoVolume *parent_vol = gGeoManager->GetMasterVolume();
382 TGeoVolume *vol;
383 // Existing volume hierarchy
384 parent_item = fLT->AddItem(parent_item, "Volume hierarchy", pic_fldo, pic_fld);
385 parent_item->SetTipText("Select a volume from the existing hierarchy");
386 fLT->OpenItem(parent_item);
387 if (parent_vol) {
388 if (!parent_vol->GetNdaughters()) {
389 parent_item = fLT->AddItem(parent_item, parent_vol->GetName(), parent_vol, pic_fileo, pic_file);
390 parent_item->SetTipText("Master volume");
391 fLT->SetSelected(parent_item);
392 } else {
393 parent_item = fLT->AddItem(parent_item, parent_vol->GetName(), parent_vol, pic_fldo, pic_fld);
394 parent_item->SetTipText("Master volume");
395 fLT->SetSelected(parent_item);
396 }
397 }
398 parent_item = fLT->AddItem(NULL, "Other volumes", pic_fldo, pic_fld);
399 parent_item->SetTipText("Select a volume from the list of unconnected volumes");
401 Bool_t found = kFALSE;
402 while ((vol=(TGeoVolume*)next1())) {
403 if (vol->IsAdded()) continue;
404 fLT->AddItem(parent_item, vol->GetName(), vol, pic_fileo, pic_file);
405 found = kTRUE;
406 }
407 if (found) {
408// fLT->OpenItem(parent_item);
409 if (!parent_vol) fLT->SetSelected(parent_item->GetFirstChild());
410 }
411}
412
413////////////////////////////////////////////////////////////////////////////////
414/// Handle close button.
415
417{
418 DeleteWindow();
419}
420
421////////////////////////////////////////////////////////////////////////////////
422/// Handle item click.
423/// Iterate daughters
424
426{
427 if (btn!=kButton1) return;
428 DoSelect(item);
429 if (!item || !item->GetUserData()) return;
430 const TGPicture *pic_fld = gClient->GetPicture("folder_t.xpm");
431 const TGPicture *pic_fldo = gClient->GetPicture("ofolder_t.xpm");
432 const TGPicture *pic_file = gClient->GetPicture("mdi_default.xpm");
433 const TGPicture *pic_fileo = gClient->GetPicture("fileopen.xpm");
434 TGeoVolume *parent_vol = (TGeoVolume*)item->GetUserData();
435 TGeoVolume *vol;
436 TGeoNode *crtnode;
437 TGListTreeItem *daughter_item;
438 Int_t i,j,ind,icopy;
439 Int_t nd = parent_vol->GetNdaughters();
440 for (i=0; i<nd; i++) {
441 icopy = 0;
442 crtnode = parent_vol->GetNode(i);
443 vol = crtnode->GetVolume();
444 // check if the volume is replicated in the parent
445 ind = parent_vol->GetIndex(crtnode);
446 for (j=0; j<ind; j++) if (parent_vol->GetNode(j)->GetVolume() == vol) break;
447 if (i<ind) continue;
448 icopy++;
449 for (j=ind+1; j<nd; j++) if (parent_vol->GetNode(j)->GetVolume() == vol) icopy++;
450 daughter_item = fLT->AddItem(item, ((icopy>1)?(TString::Format("%s (%i)",vol->GetName(),icopy)).Data():vol->GetName()),
451 vol,((vol->GetNdaughters())?pic_fldo:pic_fileo), ((vol->GetNdaughters())?pic_fld:pic_file));
452 if (strlen(vol->GetTitle())) daughter_item->SetTipText(vol->GetTitle());
453 }
454 if (nd) gClient->NeedRedraw(fLT);
455}
456
457////////////////////////////////////////////////////////////////////////////////
458/// Connect signals to slots.
459
461{
462 fClose->Connect("Clicked()", "TGeoVolumeDialog", this, "DoClose()");
463 fLT->Connect("Clicked(TGListTreeItem *, Int_t)", "TGeoVolumeDialog", this,
464 "DoItemClick(TGListTreeItem *, Int_t)");
465}
466
468
469////////////////////////////////////////////////////////////////////////////////
470/// Ctor.
471
473 :TGeoTreeDialog(caller, main, w, h)
474{
478 Layout();
479 SetWindowName("Shape dialog");
480 MapWindow();
481 gClient->WaitForUnmap(this);
482}
483
484////////////////////////////////////////////////////////////////////////////////
485/// Build shape specific list tree.
486
488{
489 const TGPicture *pic_fld = gClient->GetPicture("folder_t.xpm");
490 const TGPicture *pic_fldo = gClient->GetPicture("ofolder_t.xpm");
491 const TGPicture *pic_shape;
492 TGListTreeItem *parent_item=0;
493 TGeoShape *shape;
494 const char *shapename;
495 TString fld_name;
497 if (!nshapes) return;
498 // Existing shapes
499 for (Int_t i=0; i<nshapes; i++) {
500 shape = (TGeoShape*)gGeoManager->GetListOfShapes()->At(i);
501 if (!shape) continue;
502 shapename = shape->IsA()->GetName();
503 pic_shape = fClient->GetMimeTypeList()->GetIcon(shapename, kTRUE);
504 fld_name = shapename; // e.g. "TGeoBBox"
505 fld_name.Remove(0,4); // remove "TGeo" part -> "BBox"
506 fld_name += " Shapes";
507 parent_item = fLT->FindChildByName(NULL, fld_name.Data());
508 if (!parent_item) {
509 parent_item = fLT->AddItem(NULL, fld_name.Data(), pic_fldo, pic_fld);
510 parent_item->SetTipText(TString::Format("List of %s shapes",fld_name.Data()));
511 }
512 fLT->AddItem(parent_item, shape->GetName(), shape, pic_shape, pic_shape);
513 }
514}
515
516////////////////////////////////////////////////////////////////////////////////
517/// Handle close button.
518
520{
521 DeleteWindow();
522}
523
524////////////////////////////////////////////////////////////////////////////////
525/// Handle item click.
526/// Iterate daughters
527
529{
530 if (btn!=kButton1) return;
531 DoSelect(item);
532 if (!item || !item->GetUserData()) return;
533}
534
535////////////////////////////////////////////////////////////////////////////////
536/// Connect signals to slots.
537
539{
540 fClose->Connect("Clicked()", "TGeoShapeDialog", this, "DoClose()");
541 fLT->Connect("Clicked(TGListTreeItem *, Int_t)", "TGeoShapeDialog", this,
542 "DoItemClick(TGListTreeItem *, Int_t)");
543}
544
546
547////////////////////////////////////////////////////////////////////////////////
548/// Ctor.
549
551 :TGeoTreeDialog(caller, main, w, h)
552{
556 Layout();
557 SetWindowName("Medium dialog");
558 MapWindow();
559 gClient->WaitForUnmap(this);
560}
561
562////////////////////////////////////////////////////////////////////////////////
563/// Build volume specific list tree.
564
566{
567 const TGPicture *pic_med = gClient->GetPicture("geomedium_t.xpm");;
568 TGeoMedium *med;
570 if (!nmed) return;
571 // Existing media
572 for (Int_t i=0; i<nmed; i++) {
574 fLT->AddItem(NULL, med->GetName(), med, pic_med, pic_med);
575 }
576}
577
578////////////////////////////////////////////////////////////////////////////////
579/// Handle close button.
580
582{
583 DeleteWindow();
584}
585
586////////////////////////////////////////////////////////////////////////////////
587/// Handle item click.
588/// Iterate daughters
589
591{
592 if (btn!=kButton1) return;
593 DoSelect(item);
594 if (!item || !item->GetUserData()) return;
595 //gClient->NeedRedraw(fLT);
596}
597
598////////////////////////////////////////////////////////////////////////////////
599/// Connect signals to slots.
600
602{
603 fClose->Connect("Clicked()", "TGeoMediumDialog", this, "DoClose()");
604 fLT->Connect("Clicked(TGListTreeItem *, Int_t)", "TGeoMediumDialog", this,
605 "DoItemClick(TGListTreeItem *, Int_t)");
606}
607
609
610////////////////////////////////////////////////////////////////////////////////
611/// Ctor.
612
614 :TGeoTreeDialog(caller, main, w, h)
615{
619 Layout();
620 SetWindowName("Material dialog");
621 MapWindow();
622 gClient->WaitForUnmap(this);
623}
624
625////////////////////////////////////////////////////////////////////////////////
626/// Build volume specific list tree.
627
629{
630 const TGPicture *pic_mat = gClient->GetPicture("geomaterial_t.xpm");;
631 TGeoMaterial *mat;
633 if (!nmat) return;
634 // Existing materials
635 for (Int_t i=0; i<nmat; i++) {
637 fLT->AddItem(NULL, mat->GetName(), mat, pic_mat, pic_mat);
638 }
639}
640
641////////////////////////////////////////////////////////////////////////////////
642/// Handle close button.
643
645{
646 DeleteWindow();
647}
648
649////////////////////////////////////////////////////////////////////////////////
650/// Handle item click.
651/// Iterate daughters
652
654{
655 if (btn!=kButton1) return;
656 DoSelect(item);
657 if (!item || !item->GetUserData()) return;
658 //gClient->NeedRedraw(fLT);
659}
660
661////////////////////////////////////////////////////////////////////////////////
662/// Connect signals to slots.
663
665{
666 fClose->Connect("Clicked()", "TGeoMaterialDialog", this, "DoClose()");
667 fLT->Connect("Clicked(TGListTreeItem *, Int_t)", "TGeoMaterialDialog", this,
668 "DoItemClick(TGListTreeItem *, Int_t)");
669}
670
672
673////////////////////////////////////////////////////////////////////////////////
674/// Ctor.
675
677 :TGeoTreeDialog(caller, main, w, h)
678{
682 Layout();
683 SetWindowName("Matrix dialog");
684 MapWindow();
685 gClient->WaitForUnmap(this);
686}
687
688////////////////////////////////////////////////////////////////////////////////
689/// Build matrix specific list tree.
690
692{
693 const TGPicture *pic_tr = gClient->GetPicture("geotranslation_t.xpm");
694 const TGPicture *pic_rot = gClient->GetPicture("georotation_t.xpm");
695 const TGPicture *pic_combi = gClient->GetPicture("geocombi_t.xpm");
696 const TGPicture *pic;
697 TGListTreeItem *parent_item=0;
698 TGeoMatrix *matrix;
700 if (!nmat) return;
701 // Existing matrices
702 for (Int_t i=0; i<nmat; i++) {
703 matrix = (TGeoMatrix*)gGeoManager->GetListOfMatrices()->At(i);
704 if (matrix->IsIdentity()) continue;
705 if (!strcmp(matrix->IsA()->GetName(),"TGeoTranslation")) {
706 pic = pic_tr;
707 parent_item = fLT->FindChildByName(NULL, "Translations");
708 if (!parent_item) {
709 parent_item = fLT->AddItem(NULL, "Translations", pic, pic);
710 parent_item->SetTipText("List of translations");
711 }
712 } else if (!strcmp(matrix->IsA()->GetName(),"TGeoRotation")) {
713 pic = pic_rot;
714 parent_item = fLT->FindChildByName(NULL, "Rotations");
715 if (!parent_item) {
716 parent_item = fLT->AddItem(NULL, "Rotations", pic, pic);
717 parent_item->SetTipText("List of rotations");
718 }
719 } else if (!strcmp(matrix->IsA()->GetName(),"TGeoCombiTrans") ||
720 !strcmp(matrix->IsA()->GetName(),"TGeoHMatrix")) {
721 pic = pic_combi;
722 parent_item = fLT->FindChildByName(NULL, "Combined");
723 if (!parent_item) {
724 parent_item = fLT->AddItem(NULL, "Combined", pic, pic);
725 parent_item->SetTipText("List of combined transformations");
726 }
727 } else continue;
728 fLT->AddItem(parent_item, matrix->GetName(), matrix, pic, pic);
729 }
730}
731
732////////////////////////////////////////////////////////////////////////////////
733/// Handle close button.
734
736{
737 DeleteWindow();
738}
739
740////////////////////////////////////////////////////////////////////////////////
741/// Handle item click.
742/// Iterate daughters
743
745{
746 if (btn!=kButton1) return;
747 DoSelect(item);
748 if (!item || !item->GetUserData()) return;
749 //gClient->NeedRedraw(fLT);
750}
751
752////////////////////////////////////////////////////////////////////////////////
753/// Connect signals to slots.
754
756{
757 fClose->Connect("Clicked()", "TGeoMatrixDialog", this, "DoClose()");
758 fLT->Connect("Clicked(TGListTreeItem *, Int_t)", "TGeoMatrixDialog", this,
759 "DoItemClick(TGListTreeItem *, Int_t)");
760}
761
763
764////////////////////////////////////////////////////////////////////////////////
765/// Transient panel ctor.
766
768 :TGMainFrame(gClient->GetRoot(),175,20)
769{
770 fGedEditor = ged;
771 fModel = obj;
772 fCan = new TGCanvas(this, 170, 100);
773 fTab = new TGTab(fCan->GetViewPort(), 10, 10);
780 5, 0, 2, 2));
781 TString wname = name;
782 wname += " Editor";
783 SetWindowName(wname.Data());
785 fClose = new TGTextButton(this, "Close");
788 Layout();
790 MapWindow();
791 gROOT->GetListOfCleanups()->Add(this);
792 fClose->Connect("Clicked()", "TGeoTransientPanel", this, "Hide()");
793}
794
795////////////////////////////////////////////////////////////////////////////////
796/// Destructor.
797
799{
801 delete fTab;
802 delete fCan;
803 gROOT->GetListOfCleanups()->Remove(this);
804}
805
806////////////////////////////////////////////////////////////////////////////////
807/// When closed via WM close button, just unmap (i.e. hide) editor
808/// for later use.
809
811{
812 UnmapWindow();
813 gROOT->GetListOfCleanups()->Remove(this);
814}
815
816////////////////////////////////////////////////////////////////////////////////
817/// Get editor for a class.
818/// Look in fStyle for any object deriving from TGedFrame,
819
821{
822 TClass *class2 = TClass::GetClass(TString::Format("%sEditor",cl->GetName()));
823 if (class2 && class2->InheritsFrom(TGedFrame::Class())) {
824 TGFrameElement *fr;
825 TIter next(fStyle->GetList());
826 while ((fr = (TGFrameElement *) next()))
827 if (fr->fFrame->IsA() == class2) return;
828 TGClient *client = fGedEditor->GetClient();
829 TGWindow *exroot = (TGWindow*) client->GetRoot();
830 client->SetRoot(fStyle);
832 TGedFrame* gfr = reinterpret_cast<TGedFrame*>(class2->New());
833 gfr->SetModelClass(cl);
835 client->SetRoot(exroot);
836 fStyle->AddFrame(gfr, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 2, 2));
837 gfr->MapSubwindows();
838 }
839}
840
841////////////////////////////////////////////////////////////////////////////////
842/// Update the editors in the main tab to reflect the selected object.
843
845{
846 if (!model) return;
847 fModel = model;
848 GetEditors(model->IsA());
849 TGFrameElement *el;
850 TIter next(fStyle->GetList());
851 while ((el = (TGFrameElement *) next())) {
852 if ((el->fFrame)->InheritsFrom(TGedFrame::Class())) {
853 ((TGedFrame *)(el->fFrame))->SetModel(model);
854 }
855 }
857}
858
859////////////////////////////////////////////////////////////////////////////////
860/// Hide the transient frame
861
863{
864 UnmapWindow();
865}
866
867////////////////////////////////////////////////////////////////////////////////
868/// Hide the transient frame
869
871{
872 MapWindow();
873}
874
875////////////////////////////////////////////////////////////////////////////////
876/// Delete editors.
877
879{
880 fStyle->Cleanup();
881}
882
883
void Class()
Definition: Class.C:29
@ kSunkenFrame
Definition: GuiTypes.h:383
@ kVerticalFrame
Definition: GuiTypes.h:381
@ kDoubleBorder
Definition: GuiTypes.h:385
@ kHorizontalFrame
Definition: GuiTypes.h:382
ULong_t Pixel_t
Definition: GuiTypes.h:39
@ kButton1
Definition: GuiTypes.h:213
Handle_t Window_t
Definition: GuiTypes.h:28
#define h(i)
Definition: RSha256.hxx:106
const Bool_t kFALSE
Definition: RtypesCore.h:90
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassImp(name)
Definition: Rtypes.h:361
#define gClient
Definition: TGClient.h:166
@ kLHintsRight
Definition: TGLayout.h:33
@ kLHintsExpandY
Definition: TGLayout.h:38
@ kLHintsLeft
Definition: TGLayout.h:31
@ kLHintsBottom
Definition: TGLayout.h:36
@ kLHintsTop
Definition: TGLayout.h:34
@ kLHintsExpandX
Definition: TGLayout.h:37
char name[80]
Definition: TGX11.cxx:109
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:600
#define gROOT
Definition: TROOT.h:406
#define gVirtualX
Definition: TVirtualX.h:338
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Definition: TClass.cxx:4941
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
Definition: TClass.cxx:4837
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition: TClass.cxx:2948
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
virtual void SetContainer(TGFrame *f)
Definition: TGCanvas.h:232
TGViewPort * GetViewPort() const
Definition: TGCanvas.h:227
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition: TGClient.cxx:224
void SetRoot(TGWindow *root=0)
Sets the current root (i.e.
Definition: TGClient.cxx:244
TGMimeTypes * GetMimeTypeList() const
Definition: TGClient.h:155
virtual TList * GetList() const
Definition: TGFrame.h:347
TGCompositeFrame(const TGCompositeFrame &)
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1101
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:349
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:951
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1241
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1148
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:351
virtual void Associate(const TGWindow *w)
Definition: TGCanvas.h:99
TGFrame * fFrame
Definition: TGLayout.h:119
virtual void ChangeOptions(UInt_t options)
Change frame options. Options is an OR of the EFrameTypes.
Definition: TGFrame.cxx:305
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:260
virtual void Move(Int_t x, Int_t y)
Move frame.
Definition: TGFrame.cxx:577
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:589
virtual void MapWindow()
map window
Definition: TGFrame.h:229
UInt_t GetWidth() const
Definition: TGFrame.h:249
virtual void UnmapWindow()
unmap window
Definition: TGFrame.h:231
virtual void SetTextColor(Pixel_t color, Bool_t global=kFALSE)
Changes text color.
Definition: TGLabel.cxx:360
virtual void SetText(TGString *newText)
Set new text in label.
Definition: TGLabel.cxx:178
TGListTreeItem * GetFirstChild() const
Definition: TGListTree.h:74
virtual void SetTipText(const char *)
Definition: TGListTree.h:92
virtual void * GetUserData() const =0
void AddItem(TGListTreeItem *parent, TGListTreeItem *item)
Add given item to list tree.
void OpenItem(TGListTreeItem *item)
Open item in list tree (i.e. show child items).
void SetSelected(TGListTreeItem *item)
Definition: TGListTree.h:368
TGListTreeItem * FindChildByName(TGListTreeItem *item, const char *name)
Find child of item by name.
void SetWMPosition(Int_t x, Int_t y)
Give the window manager a window position hint.
Definition: TGFrame.cxx:1839
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1748
const TGPicture * GetIcon(const char *filename, Bool_t small_icon)
Return icon belonging to mime type of filename.
TGClient * fClient
Definition: TGObject.h:37
Handle_t GetId() const
Definition: TGObject.h:47
TGClient * GetClient() const
Definition: TGObject.h:48
const char * GetString() const
Definition: TGTab.h:159
Definition: TGTab.h:62
virtual void SetEnabled(Int_t tabIndex, Bool_t on=kTRUE)
Enable or disable tab.
Definition: TGTab.cxx:436
TGTabElement * GetTabTab(Int_t tabIndex) const
Return the tab element of tab with index tabIndex.
Definition: TGTab.cxx:613
Int_t GetNumberOfTabs() const
Return number of tabs.
Definition: TGTab.cxx:659
virtual Bool_t SetTab(Int_t tabIndex, Bool_t emit=kTRUE)
Brings the composite frame with the index tabIndex to the front and generate the following event if t...
Definition: TGTab.cxx:508
virtual TGCompositeFrame * AddTab(TGString *text)
Add a tab to the tab widget.
Definition: TGTab.cxx:342
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:84
virtual void RaiseWindow()
raise window
Definition: TGWindow.cxx:198
TGTab * GetTab() const
Definition: TGedEditor.h:84
virtual TVirtualPad * GetPad() const
Definition: TGedEditor.h:89
static void SetFrameCreator(TGedEditor *e)
Set the TGedEditor that currently creates TGedFrames.
Definition: TGedEditor.cxx:95
void SetModelClass(TClass *mcl)
Definition: TGedFrame.h:84
TList * GetListOfMedia() const
Definition: TGeoManager.h:490
TObjArray * GetListOfVolumes() const
Definition: TGeoManager.h:491
TObjArray * GetListOfMatrices() const
Definition: TGeoManager.h:488
TGeoVolume * GetMasterVolume() const
Definition: TGeoManager.h:529
TList * GetListOfMaterials() const
Definition: TGeoManager.h:489
TObjArray * GetListOfShapes() const
Definition: TGeoManager.h:493
virtual void DoItemClick(TGListTreeItem *item, Int_t btn)
Handle item click.
virtual void BuildListTree()
Build volume specific list tree.
TGeoMaterialDialog(TGFrame *caller, const TGWindow *main, UInt_t w=1, UInt_t h=1)
Ctor.
virtual void DoClose()
Handle close button.
virtual void ConnectSignalsToSlots()
Connect signals to slots.
Base class describing materials.
Definition: TGeoMaterial.h:31
virtual Bool_t IsMixture() const
Definition: TGeoMaterial.h:125
virtual void DoItemClick(TGListTreeItem *item, Int_t btn)
Handle item click.
TGeoMatrixDialog(TGFrame *caller, const TGWindow *main, UInt_t w=1, UInt_t h=1)
Ctor.
virtual void DoClose()
Handle close button.
virtual void BuildListTree()
Build matrix specific list tree.
virtual void ConnectSignalsToSlots()
Connect signals to slots.
Geometrical transformation package.
Definition: TGeoMatrix.h:41
Bool_t IsIdentity() const
Definition: TGeoMatrix.h:66
virtual void BuildListTree()
Build volume specific list tree.
virtual void DoClose()
Handle close button.
virtual void DoItemClick(TGListTreeItem *item, Int_t btn)
Handle item click.
virtual void ConnectSignalsToSlots()
Connect signals to slots.
TGeoMediumDialog(TGFrame *caller, const TGWindow *main, UInt_t w=1, UInt_t h=1)
Ctor.
Media are used to store properties related to tracking and which are useful only when using geometry ...
Definition: TGeoMedium.h:24
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition: TGeoNode.h:41
TGeoVolume * GetVolume() const
Definition: TGeoNode.h:97
TGeoShapeDialog(TGFrame *caller, const TGWindow *main, UInt_t w=1, UInt_t h=1)
Ctor.
virtual void ConnectSignalsToSlots()
Connect signals to slots.
virtual void BuildListTree()
Build shape specific list tree.
virtual void DoClose()
Handle close button.
virtual void DoItemClick(TGListTreeItem *item, Int_t btn)
Handle item click.
Base abstract class for all shapes.
Definition: TGeoShape.h:26
virtual const char * GetName() const
Get the shape name.
Definition: TGeoShape.cxx:248
Manager for all editor tabs.
TVirtualPad * fPad
void GetVolumeEditor(TGeoVolume *vol)
Get editor for a volume.
TGedEditor * fGedEditor
TGeoTransientPanel * fMaterialPanel
virtual ~TGeoTabManager()
Dtor.
TGeoVolume * fVolume
TGCompositeFrame * fVolumeTab
static void MoveFrame(TGCompositeFrame *fr, TGCompositeFrame *p)
Move frame fr at the end of the list of parent p.
static TMap fgEditorToMgrMap
void GetMaterialEditor(TGeoMaterial *material)
Get editor for a material.
void GetEditors(TClass *cl)
Get editor for a class.
static TGeoTabManager * GetMakeTabManager(TGedEditor *ged)
Static method to return the tab manager currently appended to the pad or create one if not existing.
void SetModel(TObject *model)
Send the SetModel signal to all editors in the tab TYPE.
Int_t GetTabIndex() const
Get index for a given tab element.
TGeoTransientPanel * fShapePanel
void GetMediumEditor(TGeoMedium *medium)
Get editor for a medium.
static void Cleanup(TGCompositeFrame *frame)
Static method to cleanup hierarchically all daughters of a composite frame.
void GetShapeEditor(TGeoShape *shape)
Get editor for a shape.
TGeoTransientPanel * fMediumPanel
TGeoTabManager(TGedEditor *ged)
Ctor.
void SetTab()
Set a given tab element as active one.
void SetVolTabEnabled(Bool_t flag=kTRUE)
Enable/disable tabs.
void GetMatrixEditor(TGeoMatrix *matrix)
Get editor for a matrix.
TGeoTransientPanel * fMatrixPanel
TGedEditor * fGedEditor
virtual void Hide()
Hide the transient frame.
TGTextButton * fClose
TGeoTransientPanel(TGedEditor *ged, const char *name, TObject *obj)
Transient panel ctor.
virtual void CloseWindow()
When closed via WM close button, just unmap (i.e.
void GetEditors(TClass *cl)
Get editor for a class.
virtual void Show()
Hide the transient frame.
virtual void DeleteEditors()
Delete editors.
TGCompositeFrame * fTabContainer
TGCompositeFrame * fStyle
void SetModel(TObject *model)
Update the editors in the main tab to reflect the selected object.
virtual ~TGeoTransientPanel()
Destructor.
static TObject * fgSelectedObj
virtual ~TGeoTreeDialog()
Destructor.
TGLabel * fObjLabel
static TObject * GetSelected()
static; return selected object
TGCompositeFrame * f1
TGTextButton * fClose
void DoSelect(TGListTreeItem *item)
Update dialog to reflect current clicked object.
TGListTree * fLT
TGeoTreeDialog(TGFrame *caller, const TGWindow *main, UInt_t w=1, UInt_t h=1)
Constructor.
TGCanvas * fCanvas
virtual void DoItemClick(TGListTreeItem *item, Int_t btn)
Handle item click.
virtual void BuildListTree()
Build volume specific list tree.
virtual void ConnectSignalsToSlots()
Connect signals to slots.
TGeoVolumeDialog(TGFrame *caller, const TGWindow *main, UInt_t w=1, UInt_t h=1)
Ctor.
virtual void DoClose()
Handle close button.
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:47
Int_t GetNdaughters() const
Definition: TGeoVolume.h:347
TGeoNode * GetNode(const char *name) const
get the pointer to a daughter node
Int_t GetIndex(const TGeoNode *node) const
get index number for a given daughter
Bool_t IsAdded() const
Definition: TGeoVolume.h:143
A doubly linked list.
Definition: TList.h:44
virtual void Add(TObject *obj)
Definition: TList.h:87
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:821
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition: TList.cxx:356
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:40
void Add(TObject *obj)
This function may not be used (but we need to provide it since it is a pure virtual in TCollection).
Definition: TMap.cxx:54
TObject * FindObject(const char *keyname) const
Check if a (key,value) pair exists with keyname as name of the key.
Definition: TMap.cxx:215
TObject * Remove(TObject *key)
Remove the (key,value) pair with key from the map.
Definition: TMap.cxx:296
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Int_t GetEntriesFast() const
Definition: TObjArray.h:64
TObject * At(Int_t idx) const
Definition: TObjArray.h:166
Mother of all ROOT objects.
Definition: TObject.h:37
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:357
Class used by TMap to store (key,value) pairs.
Definition: TMap.h:102
TObject * Value() const
Definition: TMap.h:121
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition: TQObject.cxx:866
Basic string class.
Definition: TString.h:131
const char * Data() const
Definition: TString.h:364
TString & Remove(Ssiz_t pos)
Definition: TString.h:668
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2311
int main(int argc, char **argv)