]>
Commit | Line | Data |
---|---|---|
7bb7ac14 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2003, 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 | ///////////////////////////////////////////////////////////////////////// | |
17 | // ALICE SHUTTER ITEM CLASS // | |
18 | // Author: Mayeul ROUSSELET // | |
19 | // e-mail: Mayeul.Rousselet@cern.ch // | |
20 | // Last update:26/08/2003 // | |
21 | ///////////////////////////////////////////////////////////////////////// | |
22 | ||
23 | #include <TGShutter.h> | |
24 | #include <TGFrame.h> | |
25 | #include <TGButton.h> | |
26 | ||
27 | #include "AliShutterItem.h" | |
28 | #include "AliDisplay2.h" | |
29 | ||
30 | ClassImp(AliShutterItem); | |
31 | ||
32 | //_____________________________________________________________ | |
33 | AliShutterItem::AliShutterItem(TGShutter *s, const char *text, UInt_t id) | |
34 | { | |
35 | // Constructor | |
36 | fShutterItem = new TGShutterItem(s, new TGHotString(text), id); | |
37 | fMainFrame = (TGCompositeFrame *) fShutterItem->GetContainer(); | |
38 | s->AddItem(fShutterItem); | |
39 | } | |
40 | ||
41 | //_____________________________________________________________ | |
42 | AliShutterItem::~AliShutterItem(void) | |
43 | { | |
44 | // Destructor | |
45 | delete fButton; | |
46 | delete fShutterItem; | |
47 | delete fMainFrame; | |
48 | } | |
49 | ||
50 | //_____________________________________________________________ | |
51 | void AliShutterItem::AddTextButton(const char* text, const char *tiptext, UInt_t idb) | |
52 | { | |
53 | //Add a TGTextButton in the TGShutterItem. This button will execute the fonction | |
54 | fButton = new TGTextButton(fMainFrame,new TGHotString(text),idb); | |
55 | fButton->Resize(100,fButton->GetDefaultHeight()); | |
56 | fButton->Connect("Clicked()","AliShutterItem",this,"DoButton(Int_t)"); | |
57 | fButton->SetToolTipText(tiptext); | |
58 | //fButton->Connect("Clicked()","AliDisplay2",gAliDisplay2,"DoViews(Int_t)"); | |
59 | fMainFrame->AddFrame(fButton, new TGLayoutHints( kLHintsTop | kLHintsCenterX ,5,5,10,10)); | |
60 | } | |
61 | ||
62 | //_____________________________________________________________ | |
63 | void AliShutterItem::AddPictureButton(const char* file, const char *tiptext, UInt_t idb) | |
64 | { | |
65 | //Add a TGPictureButton in the TGShutterItem. The icon file must be in DISPLAY/icons | |
66 | TString filename=StrDup(gAliDisplay2->GetIconsPath()); | |
67 | filename.Append(file); | |
68 | TGPicture *picture = (TGPicture *) gClient->GetPicture(filename); | |
69 | fButton = new TGPictureButton(fMainFrame,picture,idb); | |
70 | fButton->SetToolTipText(tiptext); | |
71 | fButton->Connect("Clicked()","AliShutterItem",this,"DoButton(Int_t)"); | |
72 | fMainFrame->AddFrame(fButton, new TGLayoutHints( kLHintsTop | kLHintsCenterX ,5,5,10,10)); | |
73 | } | |
74 | ||
75 | //_____________________________________________________________ | |
76 | void AliShutterItem::AddCheckButton(const char *text,Int_t idb) | |
77 | { | |
78 | // Add check button | |
79 | fButton = new TGCheckButton(fMainFrame,new TGHotString(text),idb); | |
80 | fButton->Resize(100,fButton->GetDefaultHeight()); | |
81 | fButton->Connect("Clicked()","AliShutterItem",this,"DoButton(Int_t)"); | |
82 | fMainFrame->AddFrame(fButton, new TGLayoutHints( kLHintsTop | kLHintsLeft ,5,5,10,10)); | |
83 | } | |
84 | ||
85 | //_____________________________________________________________ | |
86 | void AliShutterItem::DoButton(Int_t /*pos*/) const | |
87 | { | |
88 | // Show next/previous event if the buttom was used | |
89 | TGFrame *frame = (TGFrame *) gTQSender; | |
90 | TGButton *bu= (TGButton *) frame; | |
91 | int id = bu->WidgetId(); | |
92 | switch(id){ | |
93 | case kIdbNextEVENT:{ | |
94 | gAliDisplay2->ShowNextEvent(1); | |
95 | } | |
96 | break; | |
97 | case kIdbPrevEVENT:{ | |
98 | gAliDisplay2->ShowNextEvent(-1); | |
99 | } | |
100 | break; | |
101 | case kIdbCheckHITS:{ | |
102 | if(gAliDisplay2->IsEnabled(kHits)) gAliDisplay2->Disable(kHits); | |
103 | else gAliDisplay2->Enable(kHits); | |
104 | } | |
105 | break; | |
106 | case kIdbCheckCLUSTERS:{ | |
107 | if(gAliDisplay2->IsEnabled(kClusters)) gAliDisplay2->Disable(kClusters); | |
108 | else gAliDisplay2->Enable(kClusters); | |
109 | } | |
110 | break; | |
111 | case kIdbCheckHLT:{ | |
112 | if(gAliDisplay2->IsEnabled(kHLT)) gAliDisplay2->Disable(kHLT); | |
113 | else gAliDisplay2->Enable(kHLT); | |
114 | } | |
115 | break; | |
116 | case kIdbCheckTRACKS:{ | |
117 | if(gAliDisplay2->IsEnabled(kTracks)) gAliDisplay2->Disable(kTracks); | |
118 | else gAliDisplay2->Enable(kTracks); | |
119 | } | |
120 | break; | |
121 | case kIdbSIDEVIEW:{ | |
122 | gAliDisplay2->DoView(kIdbSIDEVIEW); | |
123 | } | |
124 | break; | |
125 | case kIdbFRONTVIEW:{ | |
126 | gAliDisplay2->DoView(kIdbFRONTVIEW); | |
127 | } | |
128 | break; | |
129 | case kIdbTOPVIEW:{ | |
130 | gAliDisplay2->DoView(kIdbTOPVIEW); | |
131 | } | |
132 | break; | |
133 | case kIdbALLVIEW:{ | |
134 | gAliDisplay2->DoView(kIdbALLVIEW); | |
135 | } | |
136 | break; | |
137 | default:break; | |
138 | } | |
139 | } | |
140 |