Logo ROOT   6.10/09
Reference Guide
TEveGridStepperEditor.cxx
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, 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 #include "TEveGridStepperEditor.h"
13 #include "TEveGridStepper.h"
14 #include "TEveGValuators.h"
15 
16 #include "TVirtualPad.h"
17 #include "TColor.h"
18 
19 #include "TGLabel.h"
20 #include "TGSlider.h"
21 #include "TGButton.h"
22 #include "TGNumberEntry.h"
23 
24 /** \class TEveGridStepperSubEditor
25 \ingroup TEve
26 Sub-editor for TEveGridStepper class.
27 */
28 
30 
31 ////////////////////////////////////////////////////////////////////////////////
32 /// Constructor.
33 
35  TGVerticalFrame(p),
36  fM (0),
37  fNx(0), fNy(0), fNz(0),
38  fDx(0), fDy(0), fDz(0)
39 {
40  Int_t labelW = 15;
41 
42  TGHorizontalFrame* hf = new TGHorizontalFrame(this);
43 
44  {
45  TGGroupFrame* f = new TGGroupFrame(hf, "NumRows", kVerticalFrame);
46  f->SetWidth(30);
47  hf->AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
48 
49  fNx = new TEveGValuator(f,"X:", 200, 0);
50  fNx->SetNELength(3);
51  fNx->SetLabelWidth(labelW);
52  fNx->SetShowSlider(kFALSE);
53  fNx->Build();
54  fNx->SetLimits(1, 15);
55  fNx->Connect("ValueSet(Double_t)",
56  "TEveGridStepperSubEditor", this, "DoNs()");
57  f->AddFrame(fNx, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
58 
59  fNy = new TEveGValuator(f,"Y:", 200, 0);
60  fNy->SetNELength(3);
61  fNy->SetLabelWidth(labelW);
62  fNy->SetShowSlider(kFALSE);
63  fNy->Build();
64  fNy->SetLimits(1, 15);
65  fNy->Connect("ValueSet(Double_t)",
66  "TEveGridStepperSubEditor", this, "DoNs()");
67  f->AddFrame(fNy, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
68 
69  fNz = new TEveGValuator(f,"Z:", 200, 0);
70  fNz->SetNELength(3);
71  fNz->SetLabelWidth(labelW);
72  fNz->SetShowSlider(kFALSE);
73  fNz->Build();
74  fNz->SetLimits(1, 15);
75  fNz->Connect("ValueSet(Double_t)",
76  "TEveGridStepperSubEditor", this, "DoNs()");
77  f->AddFrame(fNz, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
78 
79  //AddFrame(f, new TGLayoutHints(kLHintsExpandX, 2, 0, 0, 0));
80  }
81  {
82  TGGroupFrame* f = new TGGroupFrame(hf, "Step", kVerticalFrame);
83  f->SetWidth(130);
84  hf->AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
85 
86  fDx = new TEveGValuator(f,"X:", 200, 0);
87  fDx->SetNELength(5);
88  fDx->SetLabelWidth(labelW);
89  fDx->SetShowSlider(kFALSE);
90  fDx->Build();
91  fDx->SetLimits(0.1, 100, 101, TGNumberFormat::kNESRealOne);
92  fDx->Connect("ValueSet(Double_t)",
93  "TEveGridStepperSubEditor", this, "DoDs()");
94  f->AddFrame(fDx, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
95 
96  fDy = new TEveGValuator(f,"Y:", 200, 0);
97  fDy->SetNELength(5);
98  fDy->SetLabelWidth(labelW);
99  fDy->SetShowSlider(kFALSE);
100  fDy->Build();
101  fDy->SetLimits(0.1, 100, 101, TGNumberFormat::kNESRealOne);
102  fDy->Connect("ValueSet(Double_t)",
103  "TEveGridStepperSubEditor", this, "DoDs()");
104  f->AddFrame(fDy, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
105 
106  fDz = new TEveGValuator(f,"Z:", 200, 0);
107  fDz->SetNELength(5);
108  fDz->SetLabelWidth(labelW);
109  fDz->SetShowSlider(kFALSE);
110  fDz->Build();
111  fDz->SetLimits(0.1, 100, 101, TGNumberFormat::kNESRealOne);
112  fDz->Connect("ValueSet(Double_t)",
113  "TEveGridStepperSubEditor", this, "DoDs()");
114  f->AddFrame(fDz, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
115 
116  //AddFrame(f, new TGLayoutHints(kLHintsExpandX, 2, 0, 0, 0));
117  }
118  AddFrame(hf, new TGLayoutHints(kLHintsExpandX, 2, 0, 0, 0));
119 }
120 
121 ////////////////////////////////////////////////////////////////////////////////
122 /// Set model object.
123 
125 {
126  fM = m;
127 
128  fNx->SetValue(fM->fNx);
129  fNy->SetValue(fM->fNy);
130  fNz->SetValue(fM->fNz);
131 
132  fDx->SetValue(fM->fDx);
133  fDy->SetValue(fM->fDy);
134  fDz->SetValue(fM->fDz);
135 }
136 
137 ////////////////////////////////////////////////////////////////////////////////
138 /// Emit Changed signal.
139 
141 {
142  Emit("Changed()");
143 }
144 
145 ////////////////////////////////////////////////////////////////////////////////
146 /// Slot for changing fN's.
147 
149 {
151  Changed();
152 }
153 
154 ////////////////////////////////////////////////////////////////////////////////
155 /// Slot for changing fD's.
156 
158 {
159  fM->SetDs(fDx->GetValue(), fDy->GetValue(), fDz->GetValue());
160  Changed();
161 }
162 
163 /** \class TEveGridStepperEditor
164 \ingroup TEve
165 Editor for TEveGridStepper class.
166 */
167 
169 
170 ////////////////////////////////////////////////////////////////////////////////
171 /// Constructor.
172 
174  UInt_t options, Pixel_t back) :
175  TGedFrame(p, width, height, options | kVerticalFrame, back),
176  fM (0),
177  fSE (0)
178 {
179  MakeTitle("TEveGridStepper");
180 
181  fSE = new TEveGridStepperSubEditor(this);
182  AddFrame(fSE, new TGLayoutHints(kLHintsTop, 2, 0, 2, 2));
183  fSE->Connect("Changed()", "TEveGridStepperEditor", this, "Update()");
184 }
185 
186 ////////////////////////////////////////////////////////////////////////////////
187 /// Set model object.
188 
190 {
191  fM = dynamic_cast<TEveGridStepper*>(obj);
192  fSE->SetModel(fM);
193 }
virtual void SetModel(TObject *obj)
Set model object.
virtual void SetValue(Float_t v, Bool_t emit=kFALSE)
Set value, optionally emit signal.
TEveGridStepperSubEditor(const TEveGridStepperSubEditor &)
int Int_t
Definition: RtypesCore.h:41
void DoDs()
Slot for changing fD&#39;s.
Composite GUI element for single value selection (supports label, number-entry and slider)...
ULong_t Pixel_t
Definition: GuiTypes.h:39
Editor for TEveGridStepper class.
Sub-editor for TEveGridStepper class.
void DoNs()
Slot for changing fN&#39;s.
unsigned int UInt_t
Definition: RtypesCore.h:42
TMarker * m
Definition: textangle.C:8
void Changed()
Emit Changed signal.
const Bool_t kFALSE
Definition: RtypesCore.h:92
virtual void SetWidth(UInt_t w)
Definition: TGFrame.h:293
Provide discrete position coordinates for placement of objects on regular grids.
#define ClassImp(name)
Definition: Rtypes.h:336
double f(double x)
void SetDs(Float_t dx, Float_t dy, Float_t dz=0)
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
std::string MakeTitle(std::string_view version, std::string_view histname, std::string_view title, std::string_view axis)
Definition: speedtest.cxx:115
Mother of all ROOT objects.
Definition: TObject.h:37
void SetNs(Int_t nx, Int_t ny, Int_t nz=1)
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Definition: TQObject.h:164
Float_t GetValue() const
void SetModel(TEveGridStepper *m)
Set model object.