3 #include "GridStepperEditor.h"
4 #include <Reve/GridStepper.h>
5 #include <Reve/RGValuators.h>
7 #include <TVirtualPad.h>
13 #include <TGNumberEntry.h>
17 //______________________________________________________________________
18 // GridStepperSubEditor
22 ClassImp(GridStepperSubEditor)
24 //______________________________________________________________________
25 GridStepperSubEditor::GridStepperSubEditor(const TGWindow *p) :
38 TGHorizontalFrame* VF = new TGHorizontalFrame(this);
41 TGGroupFrame* f = new TGGroupFrame(VF, "NumRows", kVerticalFrame);
43 VF->AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
45 fNx = new RGValuator(f,"X:", 200, 0);
47 fNx->SetLabelWidth(labelW);
48 fNx->SetShowSlider(kFALSE);
50 fNx->SetLimits(1, 15);
51 fNx->Connect("ValueSet(Double_t)",
52 "Reve::GridStepperSubEditor", this, "DoNs()");
53 f->AddFrame(fNx, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
55 fNy = new RGValuator(f,"Y:", 200, 0);
57 fNy->SetLabelWidth(labelW);
58 fNy->SetShowSlider(kFALSE);
60 fNy->SetLimits(1, 15);
61 fNy->Connect("ValueSet(Double_t)",
62 "Reve::GridStepperSubEditor", this, "DoNs()");
63 f->AddFrame(fNy, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
65 fNz = new RGValuator(f,"Z:", 200, 0);
67 fNz->SetLabelWidth(labelW);
68 fNz->SetShowSlider(kFALSE);
70 fNz->SetLimits(1, 15);
71 fNz->Connect("ValueSet(Double_t)",
72 "Reve::GridStepperSubEditor", this, "DoNs()");
73 f->AddFrame(fNz, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
75 //AddFrame(f, new TGLayoutHints(kLHintsExpandX, 2, 0, 0, 0));
78 TGGroupFrame* f = new TGGroupFrame(VF, "Step", kVerticalFrame);
80 VF->AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
82 fDx = new RGValuator(f,"X:", 200, 0);
84 fDx->SetLabelWidth(labelW);
85 fDx->SetShowSlider(kFALSE);
87 fDx->SetLimits(0.1, 100, 101, TGNumberFormat::kNESRealOne);
88 fDx->Connect("ValueSet(Double_t)",
89 "Reve::GridStepperSubEditor", this, "DoDs()");
90 f->AddFrame(fDx, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
92 fDy = new RGValuator(f,"Y:", 200, 0);
94 fDy->SetLabelWidth(labelW);
95 fDy->SetShowSlider(kFALSE);
97 fDy->SetLimits(0.1, 100, 101, TGNumberFormat::kNESRealOne);
98 fDy->Connect("ValueSet(Double_t)",
99 "Reve::GridStepperSubEditor", this, "DoDs()");
100 f->AddFrame(fDy, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
102 fDz = new RGValuator(f,"Z:", 200, 0);
104 fDz->SetLabelWidth(labelW);
105 fDz->SetShowSlider(kFALSE);
107 fDz->SetLimits(0.1, 100, 101, TGNumberFormat::kNESRealOne);
108 fDz->Connect("ValueSet(Double_t)",
109 "Reve::GridStepperSubEditor", this, "DoDs()");
110 f->AddFrame(fDz, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
112 //AddFrame(f, new TGLayoutHints(kLHintsExpandX, 2, 0, 0, 0));
114 AddFrame(VF, new TGLayoutHints(kLHintsExpandX, 2, 0, 0, 0));
117 //______________________________________________________________________
118 void GridStepperSubEditor::SetModel(GridStepper* m)
123 fNx->SetValue(m->Nx);
124 fNy->SetValue(m->Ny);
125 fNz->SetValue(m->Nz);
127 fDx->SetValue(m->Dx);
128 fDy->SetValue(m->Dy);
129 fDz->SetValue(m->Dz);
132 //______________________________________________________________________
133 void GridStepperSubEditor::Changed()
135 // Emit Changed signal.
140 //______________________________________________________________________
141 void GridStepperSubEditor::DoNs()
143 fM->SetNs((Int_t)fNx->GetValue(), (Int_t)fNy->GetValue(), (Int_t)fNz->GetValue());
147 //______________________________________________________________________
148 void GridStepperSubEditor::DoDs()
150 // Set some value from some widget
151 fM->SetDs(fDx->GetValue(), fDy->GetValue(), fDz->GetValue());
155 //______________________________________________________________________
160 ClassImp(GridStepperEditor)
162 //______________________________________________________________________
163 GridStepperEditor::GridStepperEditor(const TGWindow *p, Int_t width, Int_t height,
164 UInt_t options, Pixel_t back) :
165 TGedFrame(p, width, height, options | kVerticalFrame, back),
171 MakeTitle("GridStepper");
173 fSE = new GridStepperSubEditor(this);
174 AddFrame(fSE, new TGLayoutHints(kLHintsTop, 2, 0, 2, 2));
175 fSE->Connect("Changed()", "GridStepperEditor", this, "Update()");
178 /**************************************************************************/
180 //______________________________________________________________________
181 void GridStepperEditor::SetModel(TObject* obj)
184 fM = dynamic_cast<GridStepper*>(obj);