Coverity
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveVZEROModuleEditor.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
3  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
4  * full copyright notice.                                                 *
5  **************************************************************************/
6
7 #include "AliEveVZEROModuleEditor.h"
8 #include <EveDet/AliEveVZEROModule.h>
9
10 #include <AliVZERORawStream.h>
11
12 #include <TEveGValuators.h>
13 #include <TGSlider.h>
14
15 //______________________________________________________________________________
16 //
17 // Editor for AliEveVZEROModule.
18
19 ClassImp(AliEveVZEROModuleEditor)
20
21 AliEveVZEROModuleEditor::AliEveVZEROModuleEditor(const TGWindow *p,
22                                        Int_t width, Int_t height,
23                                        UInt_t options, Pixel_t back) :
24   TGedFrame(p, width, height, options | kVerticalFrame, back),
25   fM(0),
26   fSampleIndex(NULL)
27 {
28   // Constructor.
29
30   MakeTitle("AliEveVZEROModule");
31
32   fSampleIndex = new TEveGValuator(this,"Sample", 200, 0);
33   fSampleIndex->SetNELength(4);
34   fSampleIndex->SetLabelWidth(60);
35   fSampleIndex->Build();
36   fSampleIndex->GetSlider()->SetWidth(120);
37   fSampleIndex->SetLimits(0, AliVZERORawStream::kNEvOfInt-1, AliVZERORawStream::kNEvOfInt, TGNumberFormat::kNESInteger);
38   fSampleIndex->Connect("ValueSet(Double_t)",
39                  "AliEveVZEROModuleEditor", this, "DoSampleIndex()");
40   AddFrame(fSampleIndex, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
41
42   /*
43   fSampleIndex = new TGNumberEntry(this,
44                                    AliVZERORawStream::kNEvOfInt/2, 3, -1,
45                                    TGNumberFormat::kNESInteger,
46                                    TGNumberFormat::kNEANonNegative,
47                                    TGNumberFormat::kNELLimitMinMax,
48                                    0,AliVZERORawStream::kNEvOfInt);
49   AddFrame(fSampleIndex, new TGLayoutHints(kLHintsNormal, 10, 2, 0, 0));
50   fSampleIndex->Connect("ValueSet(Double_t)",
51                         "AliEveVZEROModuleEditor", this, "DoSampleIndex()");
52   fSampleIndex->SetText("ADC sample index (between 0 and 21)");
53   */
54 }
55
56 /******************************************************************************/
57
58 void AliEveVZEROModuleEditor::SetModel(TObject* obj)
59 {
60   // Set model object.
61
62   fM = static_cast<AliEveVZEROModule*>(obj);
63
64   fSampleIndex->SetValue(fM->GetSampleIndex());
65 }
66
67 /******************************************************************************/
68
69 void AliEveVZEROModuleEditor::DoSampleIndex()
70 {
71   // Slot for SampleIndex.
72
73   fM->SetSampleIndex((Int_t)fSampleIndex->GetValue());
74   Update();
75 }