1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///\class AliMUONAttPainterSelectorFrame
20 /// Widget to select painter view type
22 ///\author Laurent Aphecetche, Subatech
24 #include "AliMUONAttPainterSelectorFrame.h"
26 #include "AliMUONAttPainter.h"
27 #include "AliMUONPainterInterfaceHelper.h"
30 #include <TGButtonGroup.h>
33 ClassImp(AliMUONAttPainterSelectorFrame)
36 //_____________________________________________________________________________
37 AliMUONAttPainterSelectorFrame::AliMUONAttPainterSelectorFrame(TGWindow* p, UInt_t w, UInt_t h)
38 : TGHorizontalFrame(p,w,h),
46 fCathode = new TGButtonGroup(this,"Cathode",kHorizontalFrame);
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));
53 fPlane = new TGButtonGroup(this,"Plane",kHorizontalFrame);
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));
60 fViewPoint = new TGButtonGroup(this,"ViewPoint",kHorizontalFrame);
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));
67 fViewPoint->SetState(kFALSE); //FIXME: until we're sure back views are handled correctly
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)");
78 //_____________________________________________________________________________
79 AliMUONAttPainterSelectorFrame::~AliMUONAttPainterSelectorFrame()
84 //_____________________________________________________________________________
86 AliMUONAttPainterSelectorFrame::CathodeClicked(Int_t buttonId)
88 /// Cathode button clicked
90 fAttributes.SetPlane(kFALSE,kFALSE);
92 TGButton* button = fCathode->GetButton(buttonId);
94 Long_t i = reinterpret_cast<Long_t>(button->GetUserData());
98 fAttributes.SetCathode(kTRUE,kFALSE);
102 fAttributes.SetCathode(kFALSE,kTRUE);
109 Clicked(&fAttributes);
112 //_____________________________________________________________________________
114 AliMUONAttPainterSelectorFrame::PlaneClicked(Int_t buttonId)
116 /// Plane button clicked
118 fAttributes.SetCathode(kFALSE,kFALSE);
120 TGButton* button = fPlane->GetButton(buttonId);
122 Long_t i = reinterpret_cast<Long_t> (button->GetUserData());
126 fAttributes.SetPlane(kTRUE,kFALSE);
130 fAttributes.SetPlane(kFALSE,kTRUE);
137 Clicked(&fAttributes);
141 //_____________________________________________________________________________
143 AliMUONAttPainterSelectorFrame::ViewClicked(Int_t buttonId)
145 /// View button clicked
147 TGButton* button = fViewPoint->GetButton(buttonId);
149 Long_t i = reinterpret_cast<Long_t> (button->GetUserData());
153 fAttributes.SetViewPoint(kTRUE,kFALSE);
157 fAttributes.SetViewPoint(kFALSE,kTRUE);
164 Clicked(&fAttributes);
168 //_____________________________________________________________________________
170 AliMUONAttPainterSelectorFrame::Clicked(const AliMUONAttPainter* newValues)
174 Long_t params[] = { (Long_t)newValues };
176 Emit("Clicked(AliMUONAttPainter*)",params);
179 //_____________________________________________________________________________
181 AliMUONAttPainterSelectorFrame::Update(const AliMUONAttPainter& att)
183 /// Update button state from the painter attributes
185 AliMUONPainterInterfaceHelper::Unselect(*fCathode,"*");
186 AliMUONPainterInterfaceHelper::Unselect(*fPlane,"*");
187 AliMUONPainterInterfaceHelper::Unselect(*fViewPoint,"*");
191 fCathode->SetState(!fAttributes.IsCathodeAndPlaneDisabled());
192 fPlane->SetState(!fAttributes.IsCathodeAndPlaneDisabled());
194 if ( fAttributes.IsCathodeDefined() )
196 AliMUONPainterInterfaceHelper::Select(*fCathode,fAttributes.CathodeName());
199 if ( fAttributes.IsPlaneDefined() )
201 AliMUONPainterInterfaceHelper::Select(*fPlane,fAttributes.PlaneName());
204 AliMUONPainterInterfaceHelper::Select(*fViewPoint,fAttributes.ViewPointName());