]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/Aliengui/AliTagFrame.cxx
Adding the AlienGUILinkDef.
[u/mrichter/AliRoot.git] / ANALYSIS / Aliengui / AliTagFrame.cxx
CommitLineData
90d21c72 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
31ClassImp(AliTagFrame)
32
33//___________________________________________________________________________
34AliTagFrame::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), fMin(0), fMax(0), fRange(range) {
36 //constructor
37 SetCleanup(kDeepCleanup);
38
39 SetWindowName(tagName);
40/*
41 AliTagFrameFunctions tagFunctions [6] = {
42 &AliTagFrame::Vx, &AliTagFrame::Vy, &AliTagFrame::Vz,
43 &AliTagFrame::Participants, &AliTagFrame::ImpactParameter, &AliTagFrame::PrimaryVertex
44 };
45
46 AliTagFrameFunctions tagFunctions [3] = {
47 &AliTagFrame::NegMultiplicityRange, &AliTagFrame::VOsRange, &AliTagFrame::NPionRange
48 };
49*/
50
51 CreateTagName(tagName);
52 // CREATE_TAG_FRAME(this, tagFunctions[tagId])();
53 if(fRange == kRangeMinMax){
54 CreateTagRange(fVFrame1, fEntry1, "Min");
55 CreateTagRange(fVFrame2, fEntry2, "Max");
56 }
57 else if(fRange == kRangeMin){
58 CreateTagRange(fVFrame1, fEntry1, "Min");
59 }
60 else if(fRange == kRangeMax){
61 CreateTagRange(fVFrame1, fEntry1, "Max");
62 }
63
64 CreateTagButton();
65
66 fButton->Connect("Clicked()", "AliTagFrame", this, "OnClicked()");
67
68 MapSubwindows();
69 Resize();
70 MapWindow();
71
72 gClient->WaitFor(this);
73}
74
75//___________________________________________________________________________
76AliTagFrame::~AliTagFrame() {
77 // destructor
78
79 // DeleteWindow();
80}
81
82//___________________________________________________________________________
83void AliTagFrame::CreateTagName(const char* name) {
84 // Creates the Tag Name and insert it at Result Group Frame
85
86 AddFrame(new TGLabel(this, new TGString(name)), new TGLayoutHints(kLHintsLeft, 5,5,40,5));
87}
88
89//___________________________________________________________________________
90void AliTagFrame::CreateTagRange(TGVerticalFrame * vFrame, TGNumberEntryField *& entry, const char* name) {
91 // Creates the label and entries.
92
93 vFrame = new TGVerticalFrame(this);
94 AddFrame(vFrame, new TGLayoutHints(kLHintsCenterX, 5,5,5,5));
95
96 TGLabel * label2 = new TGLabel(vFrame, new TGString(name));
97 vFrame->AddFrame(label2, new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5,5,5,5));
98 entry = new TGNumberEntryField(vFrame);
99 vFrame->AddFrame(entry, new TGLayoutHints(kLHintsBottom, 5,5,5,5));
100}
101
102//___________________________________________________________________________
103void AliTagFrame::CreateTagButton() {
104 // Creates the OK button.
105
106 fButton = new TGTextButton(this, "OK", 1);
107 AddFrame(fButton, new TGLayoutHints(kLHintsRight, 5,5,35,5));
108}
109
110//___________________________________________________________________________
111void AliTagFrame::OnClicked() {
112 // OnClicked slot.
113
114 if(fRange == kRangeMinMax){
115 fMin = static_cast<int>(fEntry1->GetNumber());
116 fMax = static_cast<int>(fEntry2->GetNumber());
117 }
118 else if(fRange == kRangeMin){
119 fMin = static_cast<int>(fEntry1->GetNumber());
120 }
121 else if(fRange == kRangeMax){
122 fMax = static_cast<int>(fEntry1->GetNumber());
123 }
124
125 TTimer::SingleShot(1, "AliTagFrame", this, "CloseWindow()");
126}
127