]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/Aliengui/AliTagFrame.cxx
Correcting warnings
[u/mrichter/AliRoot.git] / ANALYSIS / Aliengui / AliTagFrame.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 //-----------------------------------------------------------------
19 //           AliTagFrame class
20 //   The class that deals with the event tag tab of the GUI
21 //   Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
22 //-----------------------------------------------------------------
23
24 #include "TGButton.h"
25 #include "TGLabel.h"
26 #include "TGNumberEntry.h"
27 #include "TTimer.h"
28
29 #include "AliTagFrame.h"
30
31 ClassImp(AliTagFrame)
32
33 //___________________________________________________________________________
34     AliTagFrame::AliTagFrame(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h, UInt_t options, const char* tagName, Int_t /*tagId*/, ETagRangeType range)
35   : TGTransientFrame(p, main, w, h, options), 
36     fMin(0), fMax(0), fRange(range),
37     fEntry1(0), fEntry2(0),
38     fButton(0), fVFrame1(0), fVFrame2(0) {
39   //constructor
40   SetCleanup(kDeepCleanup);
41
42   SetWindowName(tagName);
43 /*
44    AliTagFrameFunctions tagFunctions [6] = {
45      &AliTagFrame::Vx, &AliTagFrame::Vy, &AliTagFrame::Vz,
46      &AliTagFrame::Participants, &AliTagFrame::ImpactParameter, &AliTagFrame::PrimaryVertex
47    };
48
49    AliTagFrameFunctions tagFunctions [3] = {
50      &AliTagFrame::NegMultiplicityRange, &AliTagFrame::VOsRange, &AliTagFrame::NPionRange
51    };
52 */
53
54   CreateTagName(tagName);
55   //   CREATE_TAG_FRAME(this, tagFunctions[tagId])();
56   if(fRange == kRangeMinMax){
57     CreateTagRange(fVFrame1, fEntry1, "Min");
58     CreateTagRange(fVFrame2, fEntry2, "Max");
59   }
60   else if(fRange == kRangeMin){
61     CreateTagRange(fVFrame1, fEntry1, "Min");
62   }
63   else if(fRange == kRangeMax){
64     CreateTagRange(fVFrame1, fEntry1, "Max");
65   }
66    
67   CreateTagButton();
68
69   fButton->Connect("Clicked()", "AliTagFrame", this, "OnClicked()");
70
71   MapSubwindows();
72   Resize();
73   MapWindow();
74   
75   gClient->WaitFor(this); 
76 }
77
78 //___________________________________________________________________________
79 AliTagFrame::~AliTagFrame() {
80   // destructor
81
82   //   DeleteWindow();
83 }
84
85 //___________________________________________________________________________
86 void AliTagFrame::CreateTagName(const char* name) {
87   // Creates the Tag Name and insert it at Result Group Frame     
88
89    AddFrame(new TGLabel(this, new TGString(name)), new TGLayoutHints(kLHintsLeft, 5,5,40,5));
90 }
91
92 //___________________________________________________________________________
93 void AliTagFrame::CreateTagRange(TGVerticalFrame * vFrame, TGNumberEntryField *& entry, const char* name) {
94   // Creates the label and entries.
95   
96   vFrame = new TGVerticalFrame(this);
97   AddFrame(vFrame, new TGLayoutHints(kLHintsCenterX, 5,5,5,5));
98   
99   TGLabel * label2 = new TGLabel(vFrame, new TGString(name));
100   vFrame->AddFrame(label2, new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5,5,5,5));
101   entry = new TGNumberEntryField(vFrame);
102   vFrame->AddFrame(entry, new TGLayoutHints(kLHintsBottom, 5,5,5,5));
103 }
104
105 //___________________________________________________________________________
106 void AliTagFrame::CreateTagButton() {
107   // Creates the OK button.
108   
109   fButton = new TGTextButton(this, "OK", 1);
110   AddFrame(fButton, new TGLayoutHints(kLHintsRight, 5,5,35,5));
111 }
112
113 //___________________________________________________________________________
114 void AliTagFrame::OnClicked() {
115   // OnClicked slot.
116   
117   if(fRange == kRangeMinMax){
118     fMin = static_cast<int>(fEntry1->GetNumber());
119     fMax = static_cast<int>(fEntry2->GetNumber());
120   }
121   else if(fRange == kRangeMin){
122     fMin = static_cast<int>(fEntry1->GetNumber());
123   }
124   else if(fRange == kRangeMax){
125     fMax = static_cast<int>(fEntry1->GetNumber());
126   }
127   
128   TTimer::SingleShot(1, "AliTagFrame", this, "CloseWindow()");
129 }
130