]>
Commit | Line | Data |
---|---|---|
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 | ///////////////////////////////////////////////////////////////////////// | |
18 | // ALICE INFO FRAME CLASS // | |
19 | // Author: Mayeul ROUSSELET // | |
20 | // e-mail: Mayeul.Rousselet@cern.ch // | |
21 | // Last update:26/08/2003 // | |
22 | ///////////////////////////////////////////////////////////////////////// | |
23 | ||
24 | #include <TGFrame.h> | |
25 | #include <TGLabel.h> | |
26 | #include <TGIcon.h> | |
27 | ||
28 | #include "AliInfoFrame.h" | |
29 | #include "AliDisplay2.h" | |
30 | ||
31 | ClassImp(AliInfoFrame) | |
32 | ||
33 | //_____________________________________________________________ | |
34 | AliInfoFrame::AliInfoFrame(TGCompositeFrame *p, UInt_t w, UInt_t h) | |
35 | { | |
36 | // Constructor | |
37 | fMainFrame = new TGCompositeFrame(p, w, h, kVerticalFrame); | |
38 | ||
39 | fTitleFrame = new TGCompositeFrame(fMainFrame,w,h,kRaisedFrame|kVerticalFrame); | |
40 | AddLabel("ALICE",kLHintsTop | kLHintsCenterX); | |
41 | AddLabel("Event Display",kLHintsTop | kLHintsCenterX); | |
42 | ||
43 | TString filename=StrDup(gAliDisplay2->GetIconsPath()); | |
44 | filename.Append("Alice.xpm"); | |
45 | TGPicture *alicelogo = (TGPicture *) gClient->GetPicture(filename); | |
46 | TGIcon *alice = new TGIcon(fTitleFrame,alicelogo,50,50); | |
47 | fTitleFrame->AddFrame(alice,new TGLayoutHints(kLHintsTop | kLHintsCenterX,0,0,0,0)); | |
48 | ||
49 | AddLabel("Powered by",kLHintsTop | kLHintsCenterX); | |
50 | AddLabel("AliRoot",kLHintsTop | kLHintsCenterX); | |
51 | fMainFrame->AddFrame(fTitleFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,0,3)); | |
52 | ||
53 | //Feedback | |
54 | fFiguresFrame = new TGCompositeFrame(fMainFrame,w,h,kRaisedFrame|kVerticalFrame); | |
55 | TGCompositeFrame *frame = new TGCompositeFrame(fFiguresFrame,w,100, kHorizontalFrame); | |
56 | fNbEventLabel = new TGLabel(frame,""); | |
57 | TGLabel * label = new TGLabel(frame,"Event number"); | |
58 | fNbEventLabel->SetText(gAliDisplay2->GetEventNumber()); | |
59 | frame->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft ,10,0,0,0)); | |
60 | frame->AddFrame(fNbEventLabel,new TGLayoutHints(kLHintsTop | kLHintsRight,5,10,0,0)); | |
61 | ||
62 | fFiguresFrame->AddFrame(frame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,0,0)); | |
63 | ||
64 | frame = new TGCompositeFrame(fFiguresFrame,w,100, kHorizontalFrame); | |
65 | label = new TGLabel(frame,"Nb Particles"); | |
66 | fNbParticuleLabel = new TGLabel(frame,""); | |
67 | fNbParticuleLabel->SetText(gAliDisplay2->GetNbParticles()); | |
68 | frame->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft,10,0,0,0)); | |
69 | frame->AddFrame(fNbParticuleLabel,new TGLayoutHints(kLHintsTop | kLHintsRight,5,10,0,0)); | |
70 | ||
71 | fFiguresFrame->AddFrame(frame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,0,0)); | |
72 | ||
73 | frame = new TGCompositeFrame(fFiguresFrame,w,100, kHorizontalFrame); | |
74 | label = new TGLabel(frame,"Nb Hits"); | |
75 | fNbHitsLabel = new TGLabel(frame,""); | |
76 | fNbHitsLabel->SetText("--"); | |
77 | frame->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft,10,0,0,0)); | |
78 | frame->AddFrame(fNbHitsLabel,new TGLayoutHints(kLHintsTop | kLHintsRight ,5,10,0,0)); | |
79 | frame->Layout(); | |
80 | fFiguresFrame->AddFrame(frame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,0,0)); | |
81 | ||
82 | frame = new TGCompositeFrame(fFiguresFrame,w,100, kHorizontalFrame); | |
83 | label = new TGLabel(frame,"Nb Clusters"); | |
84 | fNbClustersLabel = new TGLabel(frame,""); | |
85 | fNbClustersLabel->SetText("--"); | |
86 | frame->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft,10,0,0,0)); | |
87 | frame->AddFrame(fNbClustersLabel,new TGLayoutHints(kLHintsTop | kLHintsRight ,5,10,0,0)); | |
88 | frame->Layout(); | |
89 | fFiguresFrame->AddFrame(frame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,0,0)); | |
90 | fMainFrame->AddFrame(fFiguresFrame,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,0,0,2,0)); | |
91 | ||
92 | fMainFrame->Layout(); | |
93 | fMainFrame->MapSubwindows(); | |
94 | fMainFrame->MapWindow(); | |
95 | } | |
96 | ||
97 | //_____________________________________________________________ | |
98 | AliInfoFrame::~AliInfoFrame(void){ | |
99 | // Destructor | |
100 | delete fMainFrame; | |
101 | delete fTitleFrame; | |
102 | delete fFiguresFrame; | |
103 | delete fNbParticuleLabel; | |
104 | delete fNbEventLabel; | |
105 | delete fNbHitsLabel; | |
106 | } | |
107 | ||
108 | //_____________________________________________________________ | |
109 | void AliInfoFrame::AddLabel(const char *text, UInt_t options){ | |
110 | // Adds new label | |
111 | TGLabel * label = new TGLabel(fTitleFrame,text); | |
112 | fTitleFrame->AddFrame(label,new TGLayoutHints(options,0,0,0,0)); | |
113 | } | |
114 | ||
115 | //_____________________________________________________________ | |
116 | void AliInfoFrame::Update() | |
117 | { | |
118 | // Updates the layout | |
119 | fNbParticuleLabel->SetText(gAliDisplay2->GetNbParticles()); | |
120 | fNbEventLabel->SetText(gAliDisplay2->GetEventNumber()); | |
121 | if(gAliDisplay2->IsEnabled(kHits))fNbHitsLabel->SetText(gAliDisplay2->GetNbHits()); | |
122 | else fNbHitsLabel->SetText("--"); | |
123 | if(gAliDisplay2->IsEnabled(kClusters))fNbClustersLabel->SetText(gAliDisplay2->GetNbClusters()); | |
124 | else fNbClustersLabel->SetText("--"); | |
125 | fMainFrame->Layout(); | |
126 | } | |
127 |