ROOT  6.06/09
Reference Guide
TGeoTabManager.h
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 #ifndef ROOT_TGeoTabManager
13 #define ROOT_TGeoTabManager
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TGeoTabManager //
18 // //
19 // Manager for editor tabs //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #ifndef ROOT_TGFrame
24 #include "TGFrame.h"
25 #endif
26 
27 #ifndef ROOT_TMap
28 #include "TMap.h"
29 #endif
30 
31 class TVirtualPad;
32 class TClass;
33 
34 class TList;
35 class TGCompositeFrame;
36 class TGLabel;
37 class TGTab;
38 class TGComboBox;
39 class TGListTree;
40 class TGListTreeItem;
41 class TGCanvas;
42 
43 class TGedEditor;
44 
45 class TGeoShape;
46 class TGeoVolume;
47 class TGeoMedium;
48 class TGeoMaterial;
49 class TGeoMatrix;
50 
51 class TGeoTreeDialog;
52 class TGeoTransientPanel;
53 
54 class TGeoTabManager : public TObject {
55  friend class TGeoManagerEditor;
56 private:
57  TGedEditor *fGedEditor; // Parent editor
58  TVirtualPad *fPad; // Pad to which this applies
59  TGTab *fTab; // Parent tab
60  TGeoVolume *fVolume; // Edited volume
61  TGeoTransientPanel *fShapePanel; // Panel for editing shapes
62  TGeoTransientPanel *fMediumPanel; // Panel for editing media
63  TGeoTransientPanel *fMaterialPanel; // Panel for editing materials
64  TGeoTransientPanel *fMatrixPanel; // Panel for editing matrices
65  TGCompositeFrame *fVolumeTab; // Volume tab
66 
67  static TMap fgEditorToMgrMap; // Map from ged-editor to associated tab-manager
68 
69  void GetEditors(TClass *cl);
70 public:
72  virtual ~TGeoTabManager();
73 
75  static void Cleanup(TGCompositeFrame *frame);
76  TVirtualPad *GetPad() const {return fPad;}
77  TGTab *GetTab() const {return fTab;}
78  Int_t GetTabIndex() const;
79  static void MoveFrame(TGCompositeFrame *fr, TGCompositeFrame *p);
80  void SetVolTabEnabled(Bool_t flag=kTRUE);
81  void SetModel(TObject *model);
82  void SetTab();
83 
84  void GetShapeEditor(TGeoShape *shape);
85  void GetVolumeEditor(TGeoVolume *vol);
86  void GetMatrixEditor(TGeoMatrix *matrix);
87  void GetMediumEditor(TGeoMedium *medium);
88  void GetMaterialEditor(TGeoMaterial *material);
89 
91  TGeoVolume *GetVolume() const {return fVolume;}
92 
93  ClassDef(TGeoTabManager, 0) // Tab manager for geometry editors
94 };
95 
96 //////////////////////////////////////////////////////////////////////////
97 // //
98 // TGeoTreeDialog //
99 // //
100 // Dialog frame for selecting objects with a tree hierarchy //
101 // //
102 //////////////////////////////////////////////////////////////////////////
103 
105 
106 protected:
107  static TObject *fgSelectedObj; // Selected object
108  TGCanvas *fCanvas; // TGCanvas containing the list tree
109  TGLabel *fObjLabel; // Label for selected object
110  TGListTree *fLT; // List tree for selecting
111  TGCompositeFrame *f1; // Composite frame containing the selection
112  TGTextButton *fClose; // Close button
113 
114  virtual void BuildListTree() = 0;
115  virtual void ConnectSignalsToSlots() = 0;
116 public:
117  TGeoTreeDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1);
118  virtual ~TGeoTreeDialog();
119 
120  static TObject *GetSelected();
121  // Slots
122  virtual void DoClose() = 0;
123  virtual void DoItemClick(TGListTreeItem *item, Int_t btn) = 0;
124  void DoSelect(TGListTreeItem *item);
125 
126  ClassDef(TGeoTreeDialog, 0) // List-Tree based dialog
127 };
128 
129 //////////////////////////////////////////////////////////////////////////
130 // //
131 // TGeoVolumeDialog //
132 // //
133 // Special tree dialog class for selecting volumes. //
134 // //
135 //////////////////////////////////////////////////////////////////////////
136 
138 
139 protected:
140  virtual void BuildListTree();
141  virtual void ConnectSignalsToSlots();
142 
143 public:
144  TGeoVolumeDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1);
145  virtual ~TGeoVolumeDialog() {;}
146 
147  // Slots
148  virtual void DoClose();
149  virtual void DoItemClick(TGListTreeItem *item, Int_t btn);
150 
151  ClassDef(TGeoVolumeDialog, 0) // List-Tree based volume dialog
152 };
153 
154 //////////////////////////////////////////////////////////////////////////
155 // //
156 // TGeoShapeDialog //
157 // //
158 // Special tree dialog class for selecting shapes. //
159 // //
160 //////////////////////////////////////////////////////////////////////////
161 
163 
164 protected:
165  virtual void BuildListTree();
166  virtual void ConnectSignalsToSlots();
167 
168 public:
169  TGeoShapeDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1);
170  virtual ~TGeoShapeDialog() {;}
171 
172  // Slots
173  virtual void DoClose();
174  virtual void DoItemClick(TGListTreeItem *item, Int_t btn);
175 
176  ClassDef(TGeoShapeDialog, 0) // List-Tree based shape dialog
177 };
178 
179 //////////////////////////////////////////////////////////////////////////
180 // //
181 // TGeoMediumDialog //
182 // //
183 // Special tree dialog class for selecting media. //
184 // //
185 //////////////////////////////////////////////////////////////////////////
186 
188 
189 protected:
190  virtual void BuildListTree();
191  virtual void ConnectSignalsToSlots();
192 
193 public:
194  TGeoMediumDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1);
195  virtual ~TGeoMediumDialog() {;}
196 
197  // Slots
198  virtual void DoClose();
199  virtual void DoItemClick(TGListTreeItem *item, Int_t btn);
200 
201  ClassDef(TGeoMediumDialog, 0) // List-Tree based medium dialog
202 };
203 
204 //////////////////////////////////////////////////////////////////////////
205 // //
206 // TGeoMaterialDialog //
207 // //
208 // Special tree dialog class for selecting materials. //
209 // //
210 //////////////////////////////////////////////////////////////////////////
211 
213 
214 protected:
215  virtual void BuildListTree();
216  virtual void ConnectSignalsToSlots();
217 
218 public:
219  TGeoMaterialDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1);
220  virtual ~TGeoMaterialDialog() {;}
221 
222  // Slots
223  virtual void DoClose();
224  virtual void DoItemClick(TGListTreeItem *item, Int_t btn);
225 
226  ClassDef(TGeoMaterialDialog, 0) // List-Tree based material dialog
227 };
228 
229 //////////////////////////////////////////////////////////////////////////
230 // //
231 // TGeoMatrixDialog //
232 // //
233 // Special tree dialog class for selecting matrices. //
234 // //
235 //////////////////////////////////////////////////////////////////////////
236 
238 
239 protected:
240  virtual void BuildListTree();
241  virtual void ConnectSignalsToSlots();
242 
243 public:
244  TGeoMatrixDialog(TGFrame *caller, const TGWindow *main, UInt_t w = 1, UInt_t h = 1);
245  virtual ~TGeoMatrixDialog() {;}
246 
247  // Slots
248  virtual void DoClose();
249  virtual void DoItemClick(TGListTreeItem *item, Int_t btn);
250 
251  ClassDef(TGeoMatrixDialog, 0) // List-Tree based matrix dialog
252 };
253 
254 //////////////////////////////////////////////////////////////////////////
255 // //
256 // TGeoTransientPanel //
257 // //
258 // Special transient tab holding TGeo editors. //
259 // //
260 //////////////////////////////////////////////////////////////////////////
261 
263  TGedEditor *fGedEditor; // ged-editor steering this panel
264  TGCanvas *fCan; // TGCanvas containing a TGTab
265  TGTab *fTab; //tab widget holding the editor
266  TGCompositeFrame *fTabContainer; //main tab container
267  TGCompositeFrame *fStyle; //style tab container frame
268  TObject *fModel; //selected object
269  TGTextButton *fClose; //close button
270 
271 public:
272  TGeoTransientPanel(TGedEditor* ged, const char *name, TObject *obj);
273  virtual ~TGeoTransientPanel();
274 
275  virtual void CloseWindow();
276  virtual void DeleteEditors();
277 
278  TGTab *GetTab() const {return fTab;}
279  TGCompositeFrame *GetStyle() const {return fStyle;}
280  TObject *GetModel() const {return fModel;}
281 
282  void GetEditors(TClass *cl);
283  virtual void Hide();
284  virtual void Show();
285  void SetModel(TObject *model);
286 
287  ClassDef(TGeoTransientPanel, 0) // List-Tree based dialog
288 };
289 
290 #endif
TGCanvas * fCanvas
virtual void DoClose()
Handle close button.
virtual ~TGeoTreeDialog()
Destructor.
virtual void ConnectSignalsToSlots()
Connect signals to slots.
TGCompositeFrame * GetVolumeTab() const
virtual void ConnectSignalsToSlots()
Connect signals to slots.
virtual void DoClose()
Handle close button.
void SetTab()
Set a given tab element as active one.
void GetEditors(TClass *cl)
Get editor for a class.
virtual void BuildListTree()
Build shape specific list tree.
Definition: TGTab.h:66
virtual ~TGeoMatrixDialog()
static TObject * fgSelectedObj
virtual void DoItemClick(TGListTreeItem *item, Int_t btn)
Handle item click.
virtual void DeleteEditors()
Delete editors.
TGeoTabManager(TGedEditor *ged)
TH1 * h
Definition: legend2.C:5
virtual void ConnectSignalsToSlots()
Connect signals to slots.
TGCompositeFrame * fVolumeTab
virtual void DoClose()=0
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void GetMaterialEditor(TGeoMaterial *material)
Get editor for a material.
TGListTree * fLT
virtual void BuildListTree()
Build volume specific list tree.
Int_t GetTabIndex() const
Get index for a given tab element.
void SetVolTabEnabled(Bool_t flag=kTRUE)
Enable/disable tabs.
virtual ~TGeoMediumDialog()
static void Cleanup(TGCompositeFrame *frame)
Static method to cleanup hirarchically all daughters of a composite frame.
TGCompositeFrame * f1
virtual ~TGeoTransientPanel()
Destructor.
void DoSelect(TGListTreeItem *item)
Update dialog to reflect current clicked object.
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual void BuildListTree()
Build matrix specific list tree.
TVirtualPad * fPad
virtual void BuildListTree()
Build volume specific list tree.
void GetMediumEditor(TGeoMedium *medium)
Get editor for a medium.
virtual void ConnectSignalsToSlots()=0
virtual ~TGeoMaterialDialog()
TGeoShapeDialog(TGFrame *caller, const TGWindow *main, UInt_t w=1, UInt_t h=1)
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition: TVirtualPad.h:59
A doubly linked list.
Definition: TList.h:47
TGeoTransientPanel * fMatrixPanel
virtual void DoItemClick(TGListTreeItem *item, Int_t btn)=0
TObject * GetModel() const
TGeoVolumeDialog(TGFrame *caller, const TGWindow *main, UInt_t w=1, UInt_t h=1)
virtual void DoClose()
Handle close button.
virtual void ConnectSignalsToSlots()
Connect signals to slots.
TGLabel * fObjLabel
void SetModel(TObject *model)
Update the editors in the main tab to reflect the selected object.
virtual ~TGeoTabManager()
Dtor.
virtual void DoItemClick(TGListTreeItem *item, Int_t btn)
Handle item click.
static TGeoTabManager * GetMakeTabManager(TGedEditor *ged)
Static method to return the tab manager currently appended to the pad or create one if not existing...
unsigned int UInt_t
Definition: RtypesCore.h:42
TGCompositeFrame * fStyle
void GetVolumeEditor(TGeoVolume *vol)
Get editor for a volume.
TGeoTransientPanel * fShapePanel
void GetEditors(TClass *cl)
Get editor for a class.
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
TGCompositeFrame * fTabContainer
static void MoveFrame(TGCompositeFrame *fr, TGCompositeFrame *p)
Move frame fr at the end of the list of parent p.
TGedEditor * fGedEditor
void SetModel(TObject *model)
Send the SetModel signal to all editors in the tab TYPE.
int main(int argc, char *argv[])
Definition: python64.c:14
TGeoTreeDialog(TGFrame *caller, const TGWindow *main, UInt_t w=1, UInt_t h=1)
Constructor.
virtual void ConnectSignalsToSlots()
Connect signals to slots.
virtual ~TGeoShapeDialog()
TGTextButton * fClose
TGedEditor * fGedEditor
TGeoTransientPanel * fMediumPanel
TGeoTransientPanel * fMaterialPanel
virtual void DoClose()
Handle close button.
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:44
TGeoTransientPanel(TGedEditor *ged, const char *name, TObject *obj)
static TObject * GetSelected()
TGeoMatrixDialog(TGFrame *caller, const TGWindow *main, UInt_t w=1, UInt_t h=1)
static TMap fgEditorToMgrMap
TGeoMaterialDialog(TGFrame *caller, const TGWindow *main, UInt_t w=1, UInt_t h=1)
#define name(a, b)
Definition: linkTestLib0.cpp:5
Mother of all ROOT objects.
Definition: TObject.h:58
TGeoVolume * GetVolume() const
TGCompositeFrame * GetStyle() const
virtual void DoItemClick(TGListTreeItem *item, Int_t btn)
Handle item click.
virtual void BuildListTree()
Build volume specific list tree.
TGTab * GetTab() const
virtual ~TGeoVolumeDialog()
TVirtualPad * GetPad() const
virtual void Show()
Hide the transient frame.
TGTab * GetTab() const
virtual void DoClose()
Handle close button.
virtual void Hide()
Hide the transient frame.
const Bool_t kTRUE
Definition: Rtypes.h:91
TObject * obj
virtual void BuildListTree()=0
virtual void DoItemClick(TGListTreeItem *item, Int_t btn)
Handle item click.
TGTextButton * fClose
virtual void CloseWindow()
When closed via WM close button, just unmap (i.e.
void GetMatrixEditor(TGeoMatrix *matrix)
Get editor for a matrix.
TGeoVolume * fVolume
TGeoMediumDialog(TGFrame *caller, const TGWindow *main, UInt_t w=1, UInt_t h=1)
void GetShapeEditor(TGeoShape *shape)
Get editor for a shape.
virtual void DoItemClick(TGListTreeItem *item, Int_t btn)
Handle item click.