Logo ROOT   6.16/01
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
52
54
55////////////////////////////////////////////////////////////////////////////////
56/// Ctor.
57
59{
60 fGedEditor = ged;
61 fPad = ged->GetPad();
62 fTab = ged->GetTab();
63 fVolume = 0;
64 fShapePanel = 0;
65 fMediumPanel = 0;
67 fMatrixPanel = 0;
68 fVolumeTab = 0;
69 fgEditorToMgrMap.Add(ged, this);
70}
71
72////////////////////////////////////////////////////////////////////////////////
73/// Dtor.
74
76{
78 if (fShapePanel) delete fShapePanel;
80 if (fMatrixPanel) delete fMatrixPanel;
81 if (fMediumPanel) delete fMediumPanel;
82}
83
84////////////////////////////////////////////////////////////////////////////////
85/// Static method to cleanup hierarchically all daughters of a composite frame.
86/// Does not remove the frame itself.
87
89{
91 TList *list = frame->GetList();
92 Int_t nframes = list->GetSize();
93 TClass *cl;
94 for (Int_t i=0; i<nframes; i++) {
95 el = (TGFrameElement *)list->At(i);
96 cl = el->fFrame->IsA();
99 }
100 frame->Cleanup();
101}
102
103////////////////////////////////////////////////////////////////////////////////
104/// Get editor for a shape.
105
107{
108 if (!shape) return;
109 if (!fShapePanel) fShapePanel = new TGeoTransientPanel(fGedEditor, "Shape", shape);
110 else {
111 fShapePanel->SetModel(shape);
112 fShapePanel->Show();
113 }
114}
115
116////////////////////////////////////////////////////////////////////////////////
117/// Get editor for a volume.
118
120{
121 if (!volume || !fVolumeTab) return;
126 SetModel(volume);
127}
128
129////////////////////////////////////////////////////////////////////////////////
130/// Get editor for a matrix.
131
133{
134 if (!matrix) return;
135 if (!fMatrixPanel) fMatrixPanel = new TGeoTransientPanel(fGedEditor, "Matrix", matrix);
136 else {
137 fMatrixPanel->SetModel(matrix);
139 }
140}
141
142////////////////////////////////////////////////////////////////////////////////
143/// Get editor for a medium.
144
146{
147 if (!medium) return;
148 if (!fMediumPanel) fMediumPanel = new TGeoTransientPanel(fGedEditor, "Medium", medium);
149 else {
150 fMediumPanel->SetModel(medium);
153 }
154}
155
156////////////////////////////////////////////////////////////////////////////////
157/// Get editor for a material.
158
160{
161 if (!material) return;
162 TString name = "Material";
163 if (material->IsMixture()) name = "Mixture";
164 if (!fMaterialPanel) fMaterialPanel = new TGeoTransientPanel(fGedEditor, name.Data(), material);
165 else {
166 fMaterialPanel->SetModel(material);
169 }
170}
171
172////////////////////////////////////////////////////////////////////////////////
173/// Get editor for a class.
174/// Look in fVolumeTab for any object deriving from TGedFrame,
175
177{
178 TClass *class2 = TClass::GetClass(TString::Format("%sEditor",cl->GetName()));
179 if (class2 && class2->InheritsFrom(TGedFrame::Class())) {
180 TGFrameElement *fr;
181 TIter next(fVolumeTab->GetList());
182 while ((fr = (TGFrameElement *) next())) if (fr->fFrame->IsA() == class2) return;
183 TGClient *client = fGedEditor->GetClient();
184 TGWindow *exroot = (TGWindow*) client->GetRoot();
185 client->SetRoot(fVolumeTab);
187 TGedFrame* gfr = reinterpret_cast<TGedFrame*>(class2->New());
188 gfr->SetModelClass(cl);
190 client->SetRoot(exroot);
192 gfr->MapSubwindows();
193 }
194}
195
196////////////////////////////////////////////////////////////////////////////////
197/// Static method to return the tab manager currently appended to the pad or create one
198/// if not existing.
199
201{
202 if (!ged) return NULL;
203 TPair *pair = (TPair*) fgEditorToMgrMap.FindObject(ged);
204 if (pair) {
205 return (TGeoTabManager*) pair->Value();
206 } else {
207 TGeoTabManager *tabmgr = new TGeoTabManager(ged); // added to fgEditorToMgrMap in ctor
208 return tabmgr;
209 }
210}
211
212////////////////////////////////////////////////////////////////////////////////
213/// Get index for a given tab element.
214
216{
217 Int_t ntabs = fTab->GetNumberOfTabs();
218 TString tabname = "Volume";
219
220 TGTabElement *tel;
221 for (Int_t i=0; i<ntabs; i++) {
222 tel = fTab->GetTabTab(i);
223 if (tel && !strcmp(tel->GetString(),tabname.Data())) return i;
224 }
225 return 0;
226}
227
228////////////////////////////////////////////////////////////////////////////////
229/// Move frame fr at the end of the list of parent p.
230
232{
233 TList *list = p->GetList();
234 TIter next(list);
235 TGFrameElement *el = 0;
236 while ((el=(TGFrameElement*)next())) {
237 if (el->fFrame == fr) break;
238 }
239 if (el) {
240 list->Remove(el);
241 list->Add(el);
242 }
243}
244
245////////////////////////////////////////////////////////////////////////////////
246/// Enable/disable tabs
247
249{
250 fTab->SetEnabled(GetTabIndex(), flag);
251}
252
253////////////////////////////////////////////////////////////////////////////////
254/// Send the SetModel signal to all editors in the tab TYPE.
255
257{
260 TGFrameElement *el;
261 TIter next(tab->GetList());
262 while ((el = (TGFrameElement *) next())) {
263 if ((el->fFrame)->InheritsFrom(TGedFrame::Class())) {
264 ((TGedFrame *)(el->fFrame))->SetModel(model);
265 }
266 }
267}
268
269////////////////////////////////////////////////////////////////////////////////
270/// Set a given tab element as active one.
271
273{
275}
276
278
280
281////////////////////////////////////////////////////////////////////////////////
282///static; return selected object
283
285{
286 return fgSelectedObj;
287}
288
289////////////////////////////////////////////////////////////////////////////////
290/// Constructor
291
294{
295 fgSelectedObj = 0;
296 fCanvas = new TGCanvas(this, 100, 200, kSunkenFrame | kDoubleBorder);
297 fLT = new TGListTree(fCanvas->GetViewPort(), 100, 200);
298 fLT->Associate(this);
301 f1 = new TGCompositeFrame(this, 100, 10, kHorizontalFrame | kLHintsExpandX);
302 fObjLabel = new TGLabel(f1, "Selected: -none-");
303 Pixel_t color;
304 gClient->GetColorByName("#0000ff", color);
305 fObjLabel->SetTextColor(color);
308 fClose = new TGTextButton(f1, "&Close");
309 fClose->Associate(this);
312
313 Int_t ww = caller->GetWidth();
314 Window_t wdum;
315 Int_t ax, ay;
316 gVirtualX->TranslateCoordinates(caller->GetId(), main->GetId(), 0,0,ax,ay,wdum);
317 Move(ax + ww, ay);
318 SetWMPosition(ax, ay);
319
320}
321
322////////////////////////////////////////////////////////////////////////////////
323/// Destructor
324
326{
327 delete fClose;
328 delete fObjLabel;
329 delete f1;
330 delete fLT;
331 delete fCanvas;
332}
333
334////////////////////////////////////////////////////////////////////////////////
335/// Update dialog to reflect current clicked object.
336
338{
339 static TString name;
340 if (!item || !item->GetUserData()) {
341 fgSelectedObj = 0;
342 name = "Selected: -none-";
344 return;
345 }
346 fgSelectedObj = (TObject *)item->GetUserData();
347 if (fgSelectedObj) {
348 name = TString::Format("Selected %s", fgSelectedObj->GetName());
350 }
351}
352
354
355////////////////////////////////////////////////////////////////////////////////
356/// Ctor.
357
359 :TGeoTreeDialog(caller, main, w, h)
360{
364 Layout();
365 SetWindowName("Volume dialog");
366 MapWindow();
367 gClient->WaitForUnmap(this);
368}
369
370////////////////////////////////////////////////////////////////////////////////
371/// Build volume specific list tree.
372
374{
375 const TGPicture *pic_fld = gClient->GetPicture("folder_t.xpm");
376 const TGPicture *pic_fldo = gClient->GetPicture("ofolder_t.xpm");
377 const TGPicture *pic_file = gClient->GetPicture("mdi_default.xpm");
378 const TGPicture *pic_fileo = gClient->GetPicture("fileopen.xpm");
379 TGListTreeItem *parent_item=0;
380 TGeoVolume *parent_vol = gGeoManager->GetMasterVolume();
381 TGeoVolume *vol;
382 // Existing volume hierarchy
383 parent_item = fLT->AddItem(parent_item, "Volume hierarchy", pic_fldo, pic_fld);
384 parent_item->SetTipText("Select a volume from the existing hierarchy");
385 fLT->OpenItem(parent_item);
386 if (parent_vol) {
387 if (!parent_vol->GetNdaughters()) {
388 parent_item = fLT->AddItem(parent_item, parent_vol->GetName(), parent_vol, pic_fileo, pic_file);
389 parent_item->SetTipText("Master volume");
390 fLT->SetSelected(parent_item);
391 } else {
392 parent_item = fLT->AddItem(parent_item, parent_vol->GetName(), parent_vol, pic_fldo, pic_fld);
393 parent_item->SetTipText("Master volume");
394 fLT->SetSelected(parent_item);
395 }
396 }
397 parent_item = fLT->AddItem(NULL, "Other volumes", pic_fldo, pic_fld);
398 parent_item->SetTipText("Select a volume from the list of unconnected volumes");
400 Bool_t found = kFALSE;
401 while ((vol=(TGeoVolume*)next1())) {
402 if (vol->IsAdded()) continue;
403 fLT->AddItem(parent_item, vol->GetName(), vol, pic_fileo, pic_file);
404 found = kTRUE;
405 }
406 if (found) {
407// fLT->OpenItem(parent_item);
408 if (!parent_vol) fLT->SetSelected(parent_item->GetFirstChild());
409 }
410}
411
412////////////////////////////////////////////////////////////////////////////////
413/// Handle close button.
414
416{
417 DeleteWindow();
418}
419
420////////////////////////////////////////////////////////////////////////////////
421/// Handle item click.
422/// Iterate daughters
423
425{
426 if (btn!=kButton1) return;
427 DoSelect(item);
428 if (!item || !item->GetUserData()) return;
429 const TGPicture *pic_fld = gClient->GetPicture("folder_t.xpm");
430 const TGPicture *pic_fldo = gClient->GetPicture("ofolder_t.xpm");
431 const TGPicture *pic_file = gClient->GetPicture("mdi_default.xpm");
432 const TGPicture *pic_fileo = gClient->GetPicture("fileopen.xpm");
433 TGeoVolume *parent_vol = (TGeoVolume*)item->GetUserData();
434 TGeoVolume *vol;
435 TGeoNode *crtnode;
436 TGListTreeItem *daughter_item;
437 Int_t i,j,ind,icopy;
438 Int_t nd = parent_vol->GetNdaughters();
439 for (i=0; i<nd; i++) {
440 icopy = 0;
441 crtnode = parent_vol->GetNode(i);
442 vol = crtnode->GetVolume();
443 // check if the volume is replicated in the parent
444 ind = parent_vol->GetIndex(crtnode);
445 for (j=0; j<ind; j++) if (parent_vol->GetNode(j)->GetVolume() == vol) break;
446 if (i<ind) continue;
447 icopy++;
448 for (j=ind+1; j<nd; j++) if (parent_vol->GetNode(j)->GetVolume() == vol) icopy++;
449 daughter_item = fLT->AddItem(item, ((icopy>1)?(TString::Format("%s (%i)",vol->GetName(),icopy)).Data():vol->GetName()),
450 vol,((vol->GetNdaughters())?pic_fldo:pic_fileo), ((vol->GetNdaughters())?pic_fld:pic_file));
451 if (strlen(vol->GetTitle())) daughter_item->SetTipText(vol->GetTitle());
452 }
453 if (nd) gClient->NeedRedraw(fLT);
454}
455
456////////////////////////////////////////////////////////////////////////////////
457/// Connect signals to slots.
458
460{
461 fClose->Connect("Clicked()", "TGeoVolumeDialog", this, "DoClose()");
462 fLT->Connect("Clicked(TGListTreeItem *, Int_t)", "TGeoVolumeDialog", this,
463 "DoItemClick(TGListTreeItem *, Int_t)");
464}
465
467
468////////////////////////////////////////////////////////////////////////////////
469/// Ctor.
470
472 :TGeoTreeDialog(caller, main, w, h)
473{
477 Layout();
478 SetWindowName("Shape dialog");
479 MapWindow();
480 gClient->WaitForUnmap(this);
481}
482
483////////////////////////////////////////////////////////////////////////////////
484/// Build shape specific list tree.
485
487{
488 const TGPicture *pic_fld = gClient->GetPicture("folder_t.xpm");
489 const TGPicture *pic_fldo = gClient->GetPicture("ofolder_t.xpm");
490 const TGPicture *pic_shape;
491 TGListTreeItem *parent_item=0;
492 TGeoShape *shape;
493 const char *shapename;
494 TString fld_name;
496 if (!nshapes) return;
497 // Existing shapes
498 for (Int_t i=0; i<nshapes; i++) {
499 shape = (TGeoShape*)gGeoManager->GetListOfShapes()->At(i);
500 if (!shape) continue;
501 shapename = shape->IsA()->GetName();
502 pic_shape = fClient->GetMimeTypeList()->GetIcon(shapename, kTRUE);
503 fld_name = shapename; // e.g. "TGeoBBox"
504 fld_name.Remove(0,4); // remove "TGeo" part -> "BBox"
505 fld_name += " Shapes";
506 parent_item = fLT->FindChildByName(NULL, fld_name.Data());
507 if (!parent_item) {
508 parent_item = fLT->AddItem(NULL, fld_name.Data(), pic_fldo, pic_fld);
509 parent_item->SetTipText(TString::Format("List of %s shapes",fld_name.Data()));
510 }
511 fLT->AddItem(parent_item, shape->GetName(), shape, pic_shape, pic_shape);
512 }
513}
514
515////////////////////////////////////////////////////////////////////////////////
516/// Handle close button.
517
519{
520 DeleteWindow();
521}
522
523////////////////////////////////////////////////////////////////////////////////
524/// Handle item click.
525/// Iterate daughters
526
528{
529 if (btn!=kButton1) return;
530 DoSelect(item);
531 if (!item || !item->GetUserData()) return;
532}
533
534////////////////////////////////////////////////////////////////////////////////
535/// Connect signals to slots.
536
538{
539 fClose->Connect("Clicked()", "TGeoShapeDialog", this, "DoClose()");
540 fLT->Connect("Clicked(TGListTreeItem *, Int_t)", "TGeoShapeDialog", this,
541 "DoItemClick(TGListTreeItem *, Int_t)");
542}
543
545
546////////////////////////////////////////////////////////////////////////////////
547/// Ctor.
548
550 :TGeoTreeDialog(caller, main, w, h)
551{
555 Layout();
556 SetWindowName("Medium dialog");
557 MapWindow();
558 gClient->WaitForUnmap(this);
559}
560
561////////////////////////////////////////////////////////////////////////////////
562/// Build volume specific list tree.
563
565{
566 const TGPicture *pic_med = gClient->GetPicture("geomedium_t.xpm");;
567 TGeoMedium *med;
569 if (!nmed) return;
570 // Existing media
571 for (Int_t i=0; i<nmed; i++) {
573 fLT->AddItem(NULL, med->GetName(), med, pic_med, pic_med);
574 }
575}
576
577////////////////////////////////////////////////////////////////////////////////
578/// Handle close button.
579
581{
582 DeleteWindow();
583}
584
585////////////////////////////////////////////////////////////////////////////////
586/// Handle item click.
587/// Iterate daughters
588
590{
591 if (btn!=kButton1) return;
592 DoSelect(item);
593 if (!item || !item->GetUserData()) return;
594 //gClient->NeedRedraw(fLT);
595}
596
597////////////////////////////////////////////////////////////////////////////////
598/// Connect signals to slots.
599
601{
602 fClose->Connect("Clicked()", "TGeoMediumDialog", this, "DoClose()");
603 fLT->Connect("Clicked(TGListTreeItem *, Int_t)", "TGeoMediumDialog", this,
604 "DoItemClick(TGListTreeItem *, Int_t)");
605}
606
608
609////////////////////////////////////////////////////////////////////////////////
610/// Ctor.
611
613 :TGeoTreeDialog(caller, main, w, h)
614{
618 Layout();
619 SetWindowName("Material dialog");
620 MapWindow();
621 gClient->WaitForUnmap(this);
622}
623
624////////////////////////////////////////////////////////////////////////////////
625/// Build volume specific list tree.
626
628{
629 const TGPicture *pic_mat = gClient->GetPicture("geomaterial_t.xpm");;
630 TGeoMaterial *mat;
632 if (!nmat) return;
633 // Existing materials
634 for (Int_t i=0; i<nmat; i++) {
636 fLT->AddItem(NULL, mat->GetName(), mat, pic_mat, pic_mat);
637 }
638}
639
640////////////////////////////////////////////////////////////////////////////////
641/// Handle close button.
642
644{
645 DeleteWindow();
646}
647
648////////////////////////////////////////////////////////////////////////////////
649/// Handle item click.
650/// Iterate daughters
651
653{
654 if (btn!=kButton1) return;
655 DoSelect(item);
656 if (!item || !item->GetUserData()) return;
657 //gClient->NeedRedraw(fLT);
658}
659
660////////////////////////////////////////////////////////////////////////////////
661/// Connect signals to slots.
662
664{
665 fClose->Connect("Clicked()", "TGeoMaterialDialog", this, "DoClose()");
666 fLT->Connect("Clicked(TGListTreeItem *, Int_t)", "TGeoMaterialDialog", this,
667 "DoItemClick(TGListTreeItem *, Int_t)");
668}
669
671
672////////////////////////////////////////////////////////////////////////////////
673/// Ctor.
674
676 :TGeoTreeDialog(caller, main, w, h)
677{
681 Layout();
682 SetWindowName("Matrix dialog");
683 MapWindow();
684 gClient->WaitForUnmap(this);
685}
686
687////////////////////////////////////////////////////////////////////////////////
688/// Build matrix specific list tree.
689
691{
692 const TGPicture *pic_tr = gClient->GetPicture("geotranslation_t.xpm");
693 const TGPicture *pic_rot = gClient->GetPicture("georotation_t.xpm");
694 const TGPicture *pic_combi = gClient->GetPicture("geocombi_t.xpm");
695 const TGPicture *pic;
696 TGListTreeItem *parent_item=0;
697 TGeoMatrix *matrix;
699 if (!nmat) return;
700 // Existing matrices
701 for (Int_t i=0; i<nmat; i++) {
702 matrix = (TGeoMatrix*)gGeoManager->GetListOfMatrices()->At(i);
703 if (matrix->IsIdentity()) continue;
704 if (!strcmp(matrix->IsA()->GetName(),"TGeoTranslation")) {
705 pic = pic_tr;
706 parent_item = fLT->FindChildByName(NULL, "Translations");
707 if (!parent_item) {
708 parent_item = fLT->AddItem(NULL, "Translations", pic, pic);
709 parent_item->SetTipText("List of translations");
710 }
711 } else if (!strcmp(matrix->IsA()->GetName(),"TGeoRotation")) {
712 pic = pic_rot;
713 parent_item = fLT->FindChildByName(NULL, "Rotations");
714 if (!parent_item) {
715 parent_item = fLT->AddItem(NULL, "Rotations", pic, pic);
716 parent_item->SetTipText("List of rotations");
717 }
718 } else if (!strcmp(matrix->IsA()->GetName(),"TGeoCombiTrans") ||
719 !strcmp(matrix->IsA()->GetName(),"TGeoHMatrix")) {
720 pic = pic_combi;
721 parent_item = fLT->FindChildByName(NULL, "Combined");
722 if (!parent_item) {
723 parent_item = fLT->AddItem(NULL, "Combined", pic, pic);
724 parent_item->SetTipText("List of combined transformations");
725 }
726 } else continue;
727 fLT->AddItem(parent_item, matrix->GetName(), matrix, pic, pic);
728 }
729}
730
731////////////////////////////////////////////////////////////////////////////////
732/// Handle close button.
733
735{
736 DeleteWindow();
737}
738
739////////////////////////////////////////////////////////////////////////////////
740/// Handle item click.
741/// Iterate daughters
742
744{
745 if (btn!=kButton1) return;
746 DoSelect(item);
747 if (!item || !item->GetUserData()) return;
748 //gClient->NeedRedraw(fLT);
749}
750
751////////////////////////////////////////////////////////////////////////////////
752/// Connect signals to slots.
753
755{
756 fClose->Connect("Clicked()", "TGeoMatrixDialog", this, "DoClose()");
757 fLT->Connect("Clicked(TGListTreeItem *, Int_t)", "TGeoMatrixDialog", this,
758 "DoItemClick(TGListTreeItem *, Int_t)");
759}
760
762
763////////////////////////////////////////////////////////////////////////////////
764/// Transient panel ctor.
765
767 :TGMainFrame(gClient->GetRoot(),175,20)
768{
769 fGedEditor = ged;
770 fModel = obj;
771 fCan = new TGCanvas(this, 170, 100);
772 fTab = new TGTab(fCan->GetViewPort(), 10, 10);
779 5, 0, 2, 2));
780 TString wname = name;
781 wname += " Editor";
782 SetWindowName(wname.Data());
784 fClose = new TGTextButton(this, "Close");
787 Layout();
789 MapWindow();
790 gROOT->GetListOfCleanups()->Add(this);
791 fClose->Connect("Clicked()", "TGeoTransientPanel", this, "Hide()");
792}
793
794////////////////////////////////////////////////////////////////////////////////
795/// Destructor.
796
798{
800 delete fTab;
801 delete fCan;
802 gROOT->GetListOfCleanups()->Remove(this);
803}
804
805////////////////////////////////////////////////////////////////////////////////
806/// When closed via WM close button, just unmap (i.e. hide) editor
807/// for later use.
808
810{
811 UnmapWindow();
812 gROOT->GetListOfCleanups()->Remove(this);
813}
814
815////////////////////////////////////////////////////////////////////////////////
816/// Get editor for a class.
817/// Look in fStyle for any object deriving from TGedFrame,
818
820{
821 TClass *class2 = TClass::GetClass(TString::Format("%sEditor",cl->GetName()));
822 if (class2 && class2->InheritsFrom(TGedFrame::Class())) {
823 TGFrameElement *fr;
824 TIter next(fStyle->GetList());
825 while ((fr = (TGFrameElement *) next()))
826 if (fr->fFrame->IsA() == class2) return;
827 TGClient *client = fGedEditor->GetClient();
828 TGWindow *exroot = (TGWindow*) client->GetRoot();
829 client->SetRoot(fStyle);
831 TGedFrame* gfr = reinterpret_cast<TGedFrame*>(class2->New());
832 gfr->SetModelClass(cl);
834 client->SetRoot(exroot);
835 fStyle->AddFrame(gfr, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 0, 0, 2, 2));
836 gfr->MapSubwindows();
837 }
838}
839
840////////////////////////////////////////////////////////////////////////////////
841/// Update the editors in the main tab to reflect the selected object.
842
844{
845 if (!model) return;
846 fModel = model;
847 GetEditors(model->IsA());
848 TGFrameElement *el;
849 TIter next(fStyle->GetList());
850 while ((el = (TGFrameElement *) next())) {
851 if ((el->fFrame)->InheritsFrom(TGedFrame::Class())) {
852 ((TGedFrame *)(el->fFrame))->SetModel(model);
853 }
854 }
856}
857
858////////////////////////////////////////////////////////////////////////////////
859/// Hide the transient frame
860
862{
863 UnmapWindow();
864}
865
866////////////////////////////////////////////////////////////////////////////////
867/// Hide the transient frame
868
870{
871 MapWindow();
872}
873
874////////////////////////////////////////////////////////////////////////////////
875/// Delete editors.
876
878{
879 fStyle->Cleanup();
880}
881
882
void Class()
Definition: Class.C:29
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
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:363
#define gClient
Definition: TGClient.h:166
@ kSunkenFrame
Definition: TGFrame.h:61
@ kVerticalFrame
Definition: TGFrame.h:59
@ kDoubleBorder
Definition: TGFrame.h:63
@ kHorizontalFrame
Definition: TGFrame.h:60
@ 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
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:572
#define gROOT
Definition: TROOT.h:410
#define gVirtualX
Definition: TVirtualX.h:345
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Definition: TClass.cxx:4824
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
Definition: TClass.cxx:4720
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:2885
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:369
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:1099
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:371
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:949
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:373
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:303
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:258
virtual void Move(Int_t x, Int_t y)
Move frame.
Definition: TGFrame.cxx:575
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
virtual void MapWindow()
Definition: TGFrame.h:251
UInt_t GetWidth() const
Definition: TGFrame.h:271
virtual void UnmapWindow()
Definition: TGFrame.h:253
virtual void SetTextColor(Pixel_t color, Bool_t global=kFALSE)
Changes text color.
Definition: TGLabel.cxx:359
virtual void SetText(TGString *newText)
Set new text in label.
Definition: TGLabel.cxx:177
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:1837
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1746
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:435
TGTabElement * GetTabTab(Int_t tabIndex) const
Return the tab element of tab with index tabIndex.
Definition: TGTab.cxx:612
Int_t GetNumberOfTabs() const
Return number of tabs.
Definition: TGTab.cxx:658
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:507
virtual TGCompositeFrame * AddTab(TGString *text)
Add a tab to the tab widget.
Definition: TGTab.cxx:341
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:84
virtual void RaiseWindow()
Definition: TGWindow.h:94
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:93
void SetModelClass(TClass *mcl)
Definition: TGedFrame.h:84
TList * GetListOfMedia() const
Definition: TGeoManager.h:477
TObjArray * GetListOfVolumes() const
Definition: TGeoManager.h:478
TObjArray * GetListOfMatrices() const
Definition: TGeoManager.h:475
TGeoVolume * GetMasterVolume() const
Definition: TGeoManager.h:512
TList * GetListOfMaterials() const
Definition: TGeoManager.h:476
TObjArray * GetListOfShapes() const
Definition: TGeoManager.h:480
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:108
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:94
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:53
Int_t GetNdaughters() const
Definition: TGeoVolume.h:350
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:148
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:818
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition: TList.cxx:354
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:53
TObject * FindObject(const char *keyname) const
Check if a (key,value) pair exists with keyname as name of the key.
Definition: TMap.cxx:214
TObject * Remove(TObject *key)
Remove the (key,value) pair with key from the map.
Definition: TMap.cxx:295
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:165
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:867
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:2286
int main(int argc, char **argv)