Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGeoGedFrame.cxx
Go to the documentation of this file.
1 // @(#)root/geombuilder:$Id$
2 // Author: Matevz Tadel 25/09/2006
3 
4 /** \class TGeoGedFrame
5 \ingroup Geometry_builder
6 
7 Common base class for geombuilder editors.
8 
9 */
10 
11 #include "TGeoGedFrame.h"
12 #include "TGeoTabManager.h"
13 #include "TGedEditor.h"
14 #include "TGTab.h"
15 #include "TVirtualPad.h"
16 
17 ClassImp(TGeoGedFrame);
18 
19 ////////////////////////////////////////////////////////////////////////////////
20 /// Constructor.
21 
22 TGeoGedFrame::TGeoGedFrame(const TGWindow *p, Int_t width, Int_t height,
23  UInt_t options, Pixel_t back) :
24  TGedFrame(p, width, height, options, back),
25  fTab(0), fTabMgr(0), fPad(0)
26 {
27  fTab = fGedEditor->GetTab();
28  fPad = fGedEditor->GetPad();
29  fTabMgr = TGeoTabManager::GetMakeTabManager(fGedEditor);
30 }
31 
32 ////////////////////////////////////////////////////////////////////////////////
33 /// Set active GUI attribute frames related to the selected object.
34 
35 void TGeoGedFrame::SetActive(Bool_t active)
36 {
37  if (active)
38  ((TGCompositeFrame*)GetParent())->ShowFrame(this);
39  else
40  ((TGCompositeFrame*)GetParent())->HideFrame(this);
41 
42 // no need to call for every single editor Layout of TGMainFrame
43 // ((TGMainFrame*)GetMainFrame())->Layout();
44 
45  // to avoid that the user changes options on a deactivated Tab
46  if (fTab->IsEnabled(fTab->GetCurrent()))
47  fTab->SetTab(fTab->GetCurrent());
48  else
49  fTab->SetTab(0);
50 }
51 
52 ////////////////////////////////////////////////////////////////////////////////
53 /// Override Update from TGedFrame as fGedEditor can be null.
54 
55 void TGeoGedFrame::Update()
56 {
57  if (fGedEditor) {
58  fGedEditor->Update();
59  } else {
60  fPad->Modified();
61  fPad->Update();
62  }
63 }