BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
BesAboutHelp.cxx
Go to the documentation of this file.
1//
2// BesAboutHelp.cxx
3//
4
5static char* rcsname="$Name: BesVisClient-00-04-03 $";
6static char* rcsdate="$Date: 2012/03/29 06:15:16 $";
7
9#include <iostream>
10
11#include <TGLabel.h>
12#include <TList.h>
13#include <TEnv.h>
14#include <TVirtualX.h>
15#include <TGButton.h>
16#include <TGClient.h>
17#include <TGTab.h>
18#include <TGLayout.h>
19#include <TGListBox.h>
20#include <TString.h>
21#include <TGIcon.h>
22#include <TGPicture.h>
23#include <TASImage.h>
24#include <stdio.h>
25#include <stdlib.h>
26using namespace std;
27
28
29//#ifndef __CINT__
31//#endif
32
33
34//_________________________________________________________________
35// BesAboutHelp
36// Information about Bes Vis Info
37//
38//
39BesAboutHelp::BesAboutHelp(const TGWindow *p, const TGWindow *main) :
40 TGTransientFrame(p, main, 360, 750) {
41 //
42 // BesAboutHelp normal constructor
43
44 fWidgets = new TList();
45
46 this->SetBackgroundPixmap(GetPic("AboutBckgnd.gif"));
47
48 // Create title frame
49 fTitleFrame = new TGHorizontalFrame(this, 10, 10);
50 fTitleFrame->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
51
52 // Add icon
53 //const TGPicture *icon = fClient->GetPicture("mb_asterisk_s.xpm");
54 //fIcon = new TGIcon(fTitleFrame, icon, icon->GetWidth(), icon->GetHeight());
55 //fLayout = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5, 5, 5);
56 //fWidgets->Add(fLayout);
57 //fTitleFrame->AddFrame(fIcon, fLayout);
58
59 // Create title
60 FontStruct_t titlefont;
61 titlefont = gClient->GetFontByName(gEnv->GetValue("Gui.BoldFont",
62 "-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1"));
63
64 GCValues_t gval;
65 gval.fMask = kGCFont;
66 gval.fFont = gVirtualX->GetFontHandle(titlefont);
67 GContext_t titlegc = gVirtualX->CreateGC(gClient->GetRoot()->GetId(), &gval);
68
69 TString title("BesVis ");
70 title.Append(TString(TString(rcsname).Strip(TString::kBoth, '$')).Remove(0,5).Data());
71 fTitle = new TGLabel(fTitleFrame, title.Data(), titlegc);
72 fLayout = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 10, 5, 5, 5);
73 fWidgets->Add(fLayout);
74 //fTitleFrame->AddFrame(fTitle, fLayout);
75
76 fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 75, 0);
77 fWidgets->Add(fLayout);
78 AddFrame(fTitleFrame, fLayout);
79
80 // Create tabs
81 fMain = new TGTab(this, 300, 650);
82 fMain->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
83
84 TGCompositeFrame *tf;
85
86 // About
87 tf = fMain->AddTab("About");
88 tf->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
89
90 fAbout = new TGVerticalFrame(tf, 200, 750);
91 fAbout->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
92 fLayout = new TGLayoutHints(kLHintsExpandX | kLHintsCenterY);
93 fWidgets->Add(fLayout);
94 tf->AddFrame(fAbout, fLayout);
95
96 fDescription1 = new TGLabel(fAbout, "BESIII Visualizaion Software");
97 fDescription1->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
98 fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY);
99 fWidgets->Add(fLayout);
100 fAbout->AddFrame(fDescription1, fLayout);
101
102 TString date((TString(TString(rcsdate).Strip(TString::kBoth, '$')).Remove(0,5)).Data());
103 fDescription2 = new TGLabel(fAbout, ""/*date.Data()*/);
104 fDescription2->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
105 fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY);
106 fWidgets->Add(fLayout);
107
108 fAbout->AddFrame(fDescription2, fLayout);
109 fDescription3 = new TGLabel(fAbout, "Developed by Zhengyun YOU in Peking University");
110 fDescription3->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
111 fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY);
112 fWidgets->Add(fLayout);
113 fAbout->AddFrame(fDescription3, fLayout);
114
115 fDescription4 = new TGLabel(fAbout, "Emai: [email protected]");
116 fDescription4->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
117 fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY);
118 fWidgets->Add(fLayout);
119 fAbout->AddFrame(fDescription4, fLayout);
120
121 // Version
122 tf = fMain->AddTab("Version");
123 tf->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
124
125 fVersion = new TGListBox(tf);
126 fVersion->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
127
128 fLayout = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2);
129 fWidgets->Add(fLayout);
130 tf->AddFrame(fVersion, fLayout);
131
132
133 fVersion->AddEntry("2005-12-23", 0);
134 fVersion->AddEntry(" V 1.0.0", 0);
135 fVersion->AddEntry("", 0);
136 //for (Int_t iEntry = 0; iEntry < fVersion->GetNumberOfEntries(); iEntry++) {
137 //fVersion->GetEntry(iEntry)->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
138 //}
139 fVersion->Resize(80, 80);
140
141 for (Int_t iTab = 0; iTab < fMain->GetNumberOfTabs(); iTab++) {
142 fMain->GetTabTab(iTab)->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
143 }
144
145 fLayout = new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5);
146 fWidgets->Add(fLayout);
147 AddFrame(fMain, fLayout);
148
149 // Create bottom frame
150 fBottomFrame = new TGHorizontalFrame(this, 10, 10);
151 fBottomFrame->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
152
153 // Close button
154 fCloseBtn = new TGTextButton(fBottomFrame, " &Close ", 1);
155 fCloseBtn->Associate(this);
156 fCloseBtn->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
157 fLayout = new TGLayoutHints(kLHintsRight | kLHintsCenterY, 2, 2, 2, 2);
158 fWidgets->Add(fLayout);
159 fBottomFrame->AddFrame(fCloseBtn, fLayout);
160
161 fLayout = new TGLayoutHints(kLHintsBottom | kLHintsExpandX, 5, 5, 0, 5);
162 fWidgets->Add(fLayout);
163 AddFrame(fBottomFrame, fLayout);
164
165 // Palette
166 tf = fMain->AddTab("Palette");
167 tf->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
168
169 fMdcPaletteFrame= new TGVerticalFrame(tf, 200, 700);
170 fMdcPaletteFrame->SetBackgroundPixmap(GetPic("MdcPalette.gif"));
171 fLayout = new TGLayoutHints(kLHintsExpandX | kLHintsCenterY);
172 fWidgets->Add(fLayout);
173 //// Create Mdc Palette frame
174 //fMdcPaletteFrame = new TGHorizontalFrame(this, 10, 10);
175 //fMdcPaletteFrame->SetBackgroundPixmap(GetPic("MdcPalette.gif"));
176 //fLayout = new TGLayoutHints(kLHintsRight | kLHintsCenterY, 2, 2, 2, 2);
177 //fWidgets->Add(fLayout);
178 //fBottomFrame->AddFrame(fMdcPaletteFrame, fLayout);
179
180 //fLayout = new TGLayoutHints(kLHintsBottom | kLHintsExpandX, 5, 5, 0, 5);
181
182 // Widget layout
183 SetWindowName("About BesVis");
184 MapSubwindows();
185
186 // position relative to the parent's window
187 Int_t ax, ay;
188 Window_t wdum;
189 gVirtualX->TranslateCoordinates(main->GetId(), GetParent()->GetId(),
190 (Int_t)(((TGFrame *) main)->GetWidth() - fWidth) >> 1,
191 (Int_t)(((TGFrame *) main)->GetHeight() - fHeight) >> 1,
192 ax, ay, wdum);
193 Move(ax, ay);
194 SetWMPosition(ax, ay);
195
196 Resize(GetDefaultSize());
197 Resize(360,750);
198 MapWindow();
199}
200
201//_________________________________________________________________
202
204 //
205 // BesAboutHelp default destructor
206
207 fWidgets->Delete();
208 delete fWidgets;
209
210 delete fCloseBtn;
211 delete fTitle;
212 //delete fIcon;
213 delete fMain;
214 delete fAbout;
215 delete fVersion;
216 delete fDescription1;
217 delete fDescription2;
218 delete fDescription3;
219 delete fDescription4;
220 delete fTitleFrame;
221 delete fBottomFrame;
222
223}
224
225//_________________________________________________________________
226
227Bool_t BesAboutHelp::ProcessMessage(Long_t msg, Long_t parm, Long_t) {
228 //
229 // Handle message send to the BesAboutHelp object
230 switch ( GET_MSG(msg) ) {
231 case kC_COMMAND:
232 switch ( GET_SUBMSG(msg) ) {
233 case kCM_BUTTON:
234 delete this;
235 break;
236 default:
237 break;
238 }
239 break;
240 default:
241 break;
242 }
243 return kTRUE;
244}
245
246Pixmap_t BesAboutHelp::GetPic(const char *file)
247{
248 TString filePath = TString(getenv("BESVISLIBROOT"));
249 filePath += "/icons/";
250 filePath += file;
251
252 TASImage asImage(filePath);
253 Pixmap_t pic = asImage.GetPixmap();
254 //asImage->Draw();
255 return pic;
256}
ClassImp(BesAboutHelp) BesAboutHelp
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm, Long_t)
BesAboutHelp(const TGWindow *p, const TGWindow *main)
virtual ~BesAboutHelp()
virtual Pixmap_t GetPic(const char *file)
int main()
Definition: test_IFile.cxx:11