]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Alieve/TPCSector2DEditor.cxx
Conform to new TGedFrame paradigm in ROOT.
[u/mrichter/AliRoot.git] / EVE / Alieve / TPCSector2DEditor.cxx
1 // $Header$
2
3 #include "TPCSector2DEditor.h"
4 #include <Alieve/TPCSector2D.h>
5
6 #include <TVirtualPad.h>
7 #include <TColor.h>
8
9 #include <TGLabel.h>
10 #include <TGButton.h>
11 #include <TGNumberEntry.h>
12 #include <TGColorSelect.h>
13 #include <TGSlider.h>
14 #include <TGDoubleSlider.h>
15
16 using namespace Reve;
17 using namespace Alieve;
18
19 //______________________________________________________________________
20 // TPCSector2DEditor
21 //
22
23 ClassImp(TPCSector2DEditor)
24
25 TPCSector2DEditor::TPCSector2DEditor(const TGWindow *p,
26                                      Int_t width, Int_t height,
27                                      UInt_t options, Pixel_t back) :
28   TGedFrame(p, width, height, options | kVerticalFrame, back),
29   fM(0),
30   fShowMax(0), fAverage(0), fUseTexture(0)
31 {
32   MakeTitle("TPCSector2D");
33
34   fUseTexture = new TGCheckButton(this, "UseTexture");
35   AddFrame(fUseTexture, new TGLayoutHints(kLHintsTop, 3, 1, 1, 0));
36   fUseTexture->Connect
37     ("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoUseTexture()");
38
39   {
40     TGHorizontalFrame* f = new TGHorizontalFrame(this);
41     fShowMax = new TGCheckButton(f, "ShowMax");
42     f->AddFrame(fShowMax, new TGLayoutHints(kLHintsLeft, 3, 16, 1, 0));
43     fShowMax->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoShowMax()");
44     fAverage = new TGCheckButton(f, "Average");
45     f->AddFrame(fAverage, new TGLayoutHints(kLHintsLeft, 3, 1, 1, 0));
46     fAverage->Connect("Toggled(Bool_t)","Alieve::TPCSector2DEditor", this, "DoAverage()");
47     AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
48   }
49 }
50
51 TPCSector2DEditor::~TPCSector2DEditor()
52 {}
53
54 /**************************************************************************/
55
56 void TPCSector2DEditor::SetModel(TObject* obj)
57 {
58   fM = dynamic_cast<TPCSector2D*>(obj);
59
60   fShowMax->SetState(fM->fShowMax ? kButtonDown : kButtonUp);
61   SetupAverage();
62
63   fUseTexture->SetState(fM->fUseTexture ? kButtonDown : kButtonUp);
64 }
65
66 /**************************************************************************/
67
68 void TPCSector2DEditor::DoShowMax()
69 {
70   fM->SetShowMax(fShowMax->IsOn());
71   SetupAverage();
72   Update();
73 }
74
75 void TPCSector2DEditor::DoAverage()
76 {
77   fM->SetAverage(fAverage->IsOn());
78   Update();
79 }
80
81 void TPCSector2DEditor::SetupAverage()
82 {
83   if(fM->fShowMax) {
84     fAverage->SetEnabled(kFALSE);
85   } else {
86     fAverage->SetEnabled(kTRUE);
87     fAverage->SetState(fM->fAverage ? kButtonDown : kButtonUp);
88   }
89 }
90
91 /**************************************************************************/
92
93 void TPCSector2DEditor::DoUseTexture()
94 {
95   fM->fUseTexture = fUseTexture->IsOn();
96   Update();
97 }