From Stefano:
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveBeamsInfoEditor.cxx
1 // $Id$
2 // Author: Stefano Carrazza 2010
3
4 /**************************************************************************
5  * Copyright(c) 1998-2009, ALICE Experiment at CERN, all rights reserved. *
6  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
7  * full copyright notice.                                                 *
8  **************************************************************************/
9
10 #include "AliEveBeamsInfoEditor.h"
11 #include "AliEveBeamsInfo.h"
12
13 #include "TVirtualPad.h"
14 #include "TColor.h"
15
16 // Cleanup these includes:
17 #include "TGLabel.h"
18 #include "TGButton.h"
19 #include "TGNumberEntry.h"
20 #include "TGColorSelect.h"
21 #include "TGDoubleSlider.h"
22 #include "TGString.h"
23 #include "TGComboBox.h"
24 #include "TGFrame.h"
25
26
27 //______________________________________________________________________________
28 // GUI editor for AliEveBeamsInfo.
29 //
30
31 ClassImp(AliEveBeamsInfoEditor)
32
33 //______________________________________________________________________________
34 AliEveBeamsInfoEditor::AliEveBeamsInfoEditor(const TGWindow *p, Int_t width, Int_t height,
35              UInt_t options, Pixel_t back) :
36   TGedFrame(p, width, height, options | kVerticalFrame, back),
37   fM(0),
38   fEventSelection(0),
39   fShowEvents(0),
40   fSelect(0),
41   fButtonPrev(0),
42   fButtonNext(0)
43 {
44   // Constructor.
45   MakeTitle("AliEveBeamsInfo");
46
47   // Events selection
48   fEventSelection = new TGGroupFrame(this, "Event selection:", kHorizontalFrame);
49
50   fShowEvents = new TGCheckButton(fEventSelection, new TGHotString("&Show info "));
51   fShowEvents->SetState(kButtonDown);
52   fShowEvents->Connect("Clicked()", "AliEveBeamsInfoEditor", this, "ShowEventSelection()");
53   fEventSelection->AddFrame(fShowEvents, new TGLayoutHints(kLHintsLeft | kLHintsTop));
54
55   fSelect = new TGComboBox(fEventSelection,-1,kHorizontalFrame | kSunkenFrame | kDoubleBorder | kOwnBackground);
56   fSelect->AddEntry("All events",0);
57   fSelect->AddEntry("Beam 1",1);
58   fSelect->AddEntry("Beam 2",2);
59   fSelect->AddEntry("Beams 1 & 2",3);
60   fSelect->Resize(102,22);
61   fSelect->Select(0);
62   fEventSelection->AddFrame(fSelect, new TGLayoutHints(kLHintsRight | kLHintsExpandX));
63
64   fSelect->Connect("Selected(Int_t)", "AliEveBeamsInfoEditor", this, "SelectEventSelection(Int_t)");
65
66   AddFrame(fEventSelection, new TGLayoutHints(kLHintsExpandX));
67
68   //**********
69
70   TGHorizontalFrame *h = new TGHorizontalFrame(this);
71
72   fButtonPrev = new TGTextButton(h, "Previous event");
73   h->AddFrame(fButtonPrev, new TGLayoutHints(kLHintsLeft | kLHintsCenterY | kLHintsExpandX));
74   fButtonPrev->Connect("Clicked()", "AliEveBeamsInfoEditor", this, "ShowPrevEvent()");
75
76   fButtonNext = new TGTextButton(h, "Next event");
77   h->AddFrame( fButtonNext, new TGLayoutHints(kLHintsRight | kLHintsNormal | kLHintsExpandX));
78   fButtonNext->Connect("Clicked()", "AliEveBeamsInfoEditor", this, "ShowNextEvent()");
79
80   AddFrame(h, new TGLayoutHints(kLHintsExpandX | kLHintsCenterY));
81
82 }
83
84 //______________________________________________________________________________
85 void AliEveBeamsInfoEditor::SetModel(TObject* obj)
86 {
87   // Set model object.
88   fM = dynamic_cast<AliEveBeamsInfo*>(obj);
89 }
90
91 //______________________________________________________________________________
92 void AliEveBeamsInfoEditor::ShowEventSelection()
93 {
94    fM->ShowEventSelection();
95 }
96
97 //______________________________________________________________________________
98 void AliEveBeamsInfoEditor::SelectEventSelection(Int_t id)
99 {
100    fM->SelectEventSelection(id);
101 }
102
103 //______________________________________________________________________________
104 void AliEveBeamsInfoEditor::ShowPrevEvent()
105 {
106   fM->ShowPrevEvent();
107 }
108
109 //______________________________________________________________________________
110 void AliEveBeamsInfoEditor::ShowNextEvent()
111 {
112   fM->ShowNextEvent();
113 }
114
115 /******************************************************************************/