AliRoot Core  v5-06-15 (45dab64)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONAttPainterSelectorFrame.cxx
Go to the documentation of this file.
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 
23 
25 
26 #include "AliMUONAttPainter.h"
28 #include "AliLog.h"
29 #include <TGButton.h>
30 #include <TGButtonGroup.h>
31 
35 
36 //_____________________________________________________________________________
38 : TGHorizontalFrame(p,w,h),
39 fCathode(0x0),
40 fPlane(0x0),
41 fViewPoint(0x0),
42 fAttributes()
43 {
45 
46  fCathode = new TGButtonGroup(this,"Cathode",kHorizontalFrame);
47 
48  fAttributes.SetCathode(kTRUE,kFALSE);
49  AliMUONPainterInterfaceHelper::AddRadioButton(*fCathode,fAttributes.CathodeName(),(void*)(10));
50  fAttributes.SetCathode(kFALSE,kTRUE);
51  AliMUONPainterInterfaceHelper::AddRadioButton(*fCathode,fAttributes.CathodeName(),(void*)(1));
52 
53  fPlane = new TGButtonGroup(this,"Plane",kHorizontalFrame);
54 
55  fAttributes.SetPlane(kTRUE,kFALSE);
56  AliMUONPainterInterfaceHelper::AddRadioButton(*fPlane,fAttributes.PlaneName(),(void*)(10));
57  fAttributes.SetPlane(kFALSE,kTRUE);
58  AliMUONPainterInterfaceHelper::AddRadioButton(*fPlane,fAttributes.PlaneName(),(void*)(1));
59 
60  fViewPoint = new TGButtonGroup(this,"ViewPoint",kHorizontalFrame);
61 
62  fAttributes.SetViewPoint(kTRUE,kFALSE);
63  AliMUONPainterInterfaceHelper::AddRadioButton(*fViewPoint,fAttributes.ViewPointName(),(void*)(10));
64  fAttributes.SetViewPoint(kFALSE,kTRUE);
65  AliMUONPainterInterfaceHelper::AddRadioButton(*fViewPoint,fAttributes.ViewPointName(),(void*)(1));
66 
67  fViewPoint->SetState(kFALSE); //FIXME: until we're sure back views are handled correctly
68 
69  AddFrame(fCathode);
70  AddFrame(fPlane);
71  AddFrame(fViewPoint);
72 
73  fCathode->Connect("Clicked(Int_t)","AliMUONAttPainterSelectorFrame",this,"CathodeClicked(Int_t)");
74  fPlane->Connect("Clicked(Int_t)","AliMUONAttPainterSelectorFrame",this,"PlaneClicked(Int_t)");
75  fViewPoint->Connect("Clicked(Int_t)","AliMUONAttPainterSelectorFrame",this,"ViewClicked(Int_t)");
76 }
77 
78 //_____________________________________________________________________________
80 {
82 }
83 
84 //_____________________________________________________________________________
85 void
87 {
89 
90  fAttributes.SetPlane(kFALSE,kFALSE);
91 
92  TGButton* button = fCathode->GetButton(buttonId);
93 
94  Long_t i = reinterpret_cast<Long_t>(button->GetUserData());
95 
96  if ( i == 10 )
97  {
98  fAttributes.SetCathode(kTRUE,kFALSE);
99  }
100  else if ( i == 1 )
101  {
102  fAttributes.SetCathode(kFALSE,kTRUE);
103  }
104  else
105  {
106  AliFatal("");
107  }
108 
110 }
111 
112 //_____________________________________________________________________________
113 void
115 {
117 
118  fAttributes.SetCathode(kFALSE,kFALSE);
119 
120  TGButton* button = fPlane->GetButton(buttonId);
121 
122  Long_t i = reinterpret_cast<Long_t> (button->GetUserData());
123 
124  if ( i == 10 )
125  {
126  fAttributes.SetPlane(kTRUE,kFALSE);
127  }
128  else if ( i == 1 )
129  {
130  fAttributes.SetPlane(kFALSE,kTRUE);
131  }
132  else
133  {
134  AliFatal("");
135  }
136 
138 
139 }
140 
141 //_____________________________________________________________________________
142 void
144 {
146 
147  TGButton* button = fViewPoint->GetButton(buttonId);
148 
149  Long_t i = reinterpret_cast<Long_t> (button->GetUserData());
150 
151  if ( i == 10 )
152  {
153  fAttributes.SetViewPoint(kTRUE,kFALSE);
154  }
155  else if ( i == 1 )
156  {
157  fAttributes.SetViewPoint(kFALSE,kTRUE);
158  }
159  else
160  {
161  AliFatal("");
162  }
163 
165 
166 }
167 
168 //_____________________________________________________________________________
169 void
171 {
173 
174  Long_t params[] = { (Long_t)newValues };
175 
176  Emit("Clicked(AliMUONAttPainter*)",params);
177 }
178 
179 //_____________________________________________________________________________
180 void
182 {
184 
188 
189  fAttributes = att;
190 
193 
194  if ( fAttributes.IsCathodeDefined() )
195  {
197  }
198 
199  if ( fAttributes.IsPlaneDefined() )
200  {
202  }
203 
205 
206 }
Widget to select the painter(s) view type.
TString CathodeName() const
static void AddRadioButton(TGButtonGroup &bg, const TString &name, void *userData=0x0, Bool_t select=kFALSE)
TGButtonGroup * fPlane
plane selection buttons
TString PlaneName() const
Bool_t IsPlaneDefined() const
Whether we are defined by plane.
Bool_t IsCathodeDefined() const
Whether we are defined by cathode.
void SetViewPoint(Bool_t front, Bool_t back)
void Clicked(const AliMUONAttPainter *newValues)
void SetCathode(Bool_t cath0, Bool_t cath1)
Bool_t IsCathodeAndPlaneDisabled() const
Whether cathode & plane are disabled.
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
AliMUONAttPainter fAttributes
attributes
TGButtonGroup * fViewPoint
viewpoint selection buttons
static void Unselect(TGButtonGroup &bg, const TString &buttonName, Bool_t emit=kFALSE)
static void Select(TGButtonGroup &bg, const TString &buttonName, Bool_t emit=kFALSE)
TString ViewPointName() const
Basic attributes shared by all painters.
TGButtonGroup * fCathode
cathode selection buttons
void SetPlane(Bool_t bending, Bool_t nonBending)
void Update(const AliMUONAttPainter &att)