/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/EventDisplay/BesVisClient/BesVisClient-00-04-04/src/BesAboutHelp.cxx

Go to the documentation of this file.
00001 //
00002 // BesAboutHelp.cxx
00003 //
00004 
00005 static char* rcsname="$Name: BesVisClient-00-04-04 $";
00006 static char* rcsdate="$Date: 2014/04/18 02:12:32 $";
00007 
00008 #include "BesVisClient/BesAboutHelp.h"
00009 #include <iostream>
00010 
00011 #include <TGLabel.h>
00012 #include <TList.h>
00013 #include <TEnv.h>
00014 #include <TVirtualX.h>
00015 #include <TGButton.h>
00016 #include <TGClient.h>
00017 #include <TGTab.h>
00018 #include <TGLayout.h>
00019 #include <TGListBox.h>
00020 #include <TString.h>
00021 #include <TGIcon.h>
00022 #include <TGPicture.h>
00023 #include <TASImage.h>
00024 #include <stdio.h>
00025 #include <stdlib.h>
00026 using namespace std;
00027 
00028 
00029 //#ifndef __CINT__
00030 ClassImp(BesAboutHelp)
00031 //#endif
00032 
00033 
00034 //_________________________________________________________________
00035 // BesAboutHelp
00036 // Information about Bes Vis Info
00037 //
00038 //
00039 BesAboutHelp::BesAboutHelp(const TGWindow *p, const TGWindow *main) :
00040         TGTransientFrame(p, main, 360, 750) {
00041     //
00042     // BesAboutHelp normal constructor
00043 
00044     fWidgets = new TList();
00045 
00046     this->SetBackgroundPixmap(GetPic("AboutBckgnd.gif"));
00047 
00048     // Create title frame
00049     fTitleFrame = new TGHorizontalFrame(this, 10, 10);
00050     fTitleFrame->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
00051 
00052     // Add icon
00053     //const TGPicture *icon = fClient->GetPicture("mb_asterisk_s.xpm");
00054     //fIcon = new TGIcon(fTitleFrame, icon, icon->GetWidth(), icon->GetHeight());
00055     //fLayout = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5, 5, 5);
00056     //fWidgets->Add(fLayout);
00057     //fTitleFrame->AddFrame(fIcon, fLayout);
00058 
00059     // Create title
00060     FontStruct_t titlefont;
00061     titlefont = gClient->GetFontByName(gEnv->GetValue("Gui.BoldFont",
00062                                        "-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1"));
00063 
00064     GCValues_t gval;
00065     gval.fMask = kGCFont;
00066     gval.fFont = gVirtualX->GetFontHandle(titlefont);
00067     GContext_t titlegc = gVirtualX->CreateGC(gClient->GetRoot()->GetId(), &gval);
00068 
00069     TString title("BesVis ");
00070     title.Append(TString(TString(rcsname).Strip(TString::kBoth, '$')).Remove(0,5).Data());
00071     fTitle = new TGLabel(fTitleFrame, title.Data(), titlegc);
00072     fLayout = new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 10, 5, 5, 5);
00073     fWidgets->Add(fLayout);
00074     //fTitleFrame->AddFrame(fTitle, fLayout);
00075 
00076     fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 0, 75, 0);
00077     fWidgets->Add(fLayout);
00078     AddFrame(fTitleFrame, fLayout);
00079 
00080     // Create tabs
00081     fMain = new TGTab(this, 300, 650);
00082     fMain->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
00083 
00084     TGCompositeFrame *tf;
00085 
00086     // About
00087     tf = fMain->AddTab("About");
00088     tf->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
00089 
00090     fAbout = new TGVerticalFrame(tf, 200, 750);
00091     fAbout->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
00092     fLayout = new TGLayoutHints(kLHintsExpandX | kLHintsCenterY);
00093     fWidgets->Add(fLayout);
00094     tf->AddFrame(fAbout, fLayout);
00095 
00096     fDescription1 = new TGLabel(fAbout, "BESIII  Visualizaion Software");
00097     fDescription1->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
00098     fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY);
00099     fWidgets->Add(fLayout);
00100     fAbout->AddFrame(fDescription1, fLayout);
00101 
00102     TString date((TString(TString(rcsdate).Strip(TString::kBoth, '$')).Remove(0,5)).Data());
00103     fDescription2 = new TGLabel(fAbout, ""/*date.Data()*/);
00104     fDescription2->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
00105     fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY);
00106     fWidgets->Add(fLayout);
00107 
00108     fAbout->AddFrame(fDescription2, fLayout);
00109     fDescription3 = new TGLabel(fAbout, "Developed by Zhengyun YOU in Peking University");
00110     fDescription3->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
00111     fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY);
00112     fWidgets->Add(fLayout);
00113     fAbout->AddFrame(fDescription3, fLayout);
00114 
00115     fDescription4 = new TGLabel(fAbout, "Emai: youzy@hep.pku.cn");
00116     fDescription4->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
00117     fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY);
00118     fWidgets->Add(fLayout);
00119     fAbout->AddFrame(fDescription4, fLayout);
00120 
00121     // Version
00122     tf = fMain->AddTab("Version");
00123     tf->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
00124 
00125     fVersion = new TGListBox(tf);
00126     fVersion->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
00127 
00128     fLayout = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2);
00129     fWidgets->Add(fLayout);
00130     tf->AddFrame(fVersion, fLayout);
00131 
00132 
00133     fVersion->AddEntry("2005-12-23", 0);
00134     fVersion->AddEntry("    V 1.0.0", 0);
00135     fVersion->AddEntry("", 0);
00136     //for (Int_t iEntry = 0; iEntry < fVersion->GetNumberOfEntries(); iEntry++) {
00137     //fVersion->GetEntry(iEntry)->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
00138     //}
00139     fVersion->Resize(80, 80);
00140 
00141     for (Int_t iTab = 0; iTab < fMain->GetNumberOfTabs(); iTab++) {
00142         fMain->GetTabTab(iTab)->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
00143     }
00144 
00145     fLayout = new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5);
00146     fWidgets->Add(fLayout);
00147     AddFrame(fMain, fLayout);
00148 
00149     // Create bottom frame
00150     fBottomFrame = new TGHorizontalFrame(this, 10, 10);
00151     fBottomFrame->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
00152 
00153     // Close button
00154     fCloseBtn = new TGTextButton(fBottomFrame, "    &Close    ", 1);
00155     fCloseBtn->Associate(this);
00156     fCloseBtn->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
00157     fLayout = new TGLayoutHints(kLHintsRight | kLHintsCenterY, 2, 2, 2, 2);
00158     fWidgets->Add(fLayout);
00159     fBottomFrame->AddFrame(fCloseBtn, fLayout);
00160 
00161     fLayout = new TGLayoutHints(kLHintsBottom | kLHintsExpandX, 5, 5, 0, 5);
00162     fWidgets->Add(fLayout);
00163     AddFrame(fBottomFrame, fLayout);
00164 
00165     // Palette
00166     tf = fMain->AddTab("Palette");
00167     tf->SetBackgroundPixmap(GetPic("AboutGrey.gif"));
00168 
00169     fMdcPaletteFrame= new TGVerticalFrame(tf, 200, 700);
00170     fMdcPaletteFrame->SetBackgroundPixmap(GetPic("MdcPalette.gif"));
00171     fLayout = new TGLayoutHints(kLHintsExpandX | kLHintsCenterY);
00172     fWidgets->Add(fLayout);
00174     //fMdcPaletteFrame = new TGHorizontalFrame(this, 10, 10);
00175     //fMdcPaletteFrame->SetBackgroundPixmap(GetPic("MdcPalette.gif"));
00176     //fLayout = new TGLayoutHints(kLHintsRight | kLHintsCenterY, 2, 2, 2, 2);
00177     //fWidgets->Add(fLayout);
00178     //fBottomFrame->AddFrame(fMdcPaletteFrame, fLayout);
00179 
00180     //fLayout = new TGLayoutHints(kLHintsBottom | kLHintsExpandX, 5, 5, 0, 5);
00181 
00182     // Widget layout
00183     SetWindowName("About BesVis");
00184     MapSubwindows();
00185 
00186     // position relative to the parent's window
00187     Int_t  ax, ay;
00188     Window_t wdum;
00189     gVirtualX->TranslateCoordinates(main->GetId(), GetParent()->GetId(),
00190                                     (Int_t)(((TGFrame *) main)->GetWidth() - fWidth) >> 1,
00191                                     (Int_t)(((TGFrame *) main)->GetHeight() - fHeight) >> 1,
00192                                     ax, ay, wdum);
00193     Move(ax, ay);
00194     SetWMPosition(ax, ay);
00195 
00196     Resize(GetDefaultSize());
00197     Resize(360,750);
00198     MapWindow();
00199 }
00200 
00201 //_________________________________________________________________
00202 
00203 BesAboutHelp::~BesAboutHelp() {
00204     //
00205     // BesAboutHelp default destructor
00206 
00207     fWidgets->Delete();
00208     delete fWidgets;
00209 
00210     delete fCloseBtn;
00211     delete fTitle;
00212     //delete fIcon;
00213     delete fMain;
00214     delete fAbout;
00215     delete fVersion;
00216     delete fDescription1;
00217     delete fDescription2;
00218     delete fDescription3;
00219     delete fDescription4;
00220     delete fTitleFrame;
00221     delete fBottomFrame;
00222 
00223 }
00224 
00225 //_________________________________________________________________
00226 
00227 Bool_t BesAboutHelp::ProcessMessage(Long_t msg, Long_t parm, Long_t) {
00228     //
00229     // Handle message send to the BesAboutHelp object
00230     switch ( GET_MSG(msg) ) {
00231     case kC_COMMAND:
00232         switch ( GET_SUBMSG(msg) ) {
00233         case kCM_BUTTON:
00234             delete this;
00235             break;
00236         default:
00237             break;
00238         }
00239         break;
00240     default:
00241         break;
00242     }
00243     return kTRUE;
00244 }
00245 
00246 Pixmap_t BesAboutHelp::GetPic(const char *file)
00247 {
00248     TString filePath = TString(getenv("BESVISLIBROOT"));
00249     filePath += "/icons/";
00250     filePath += file;
00251 
00252     TASImage asImage(filePath);
00253     Pixmap_t pic = asImage.GetPixmap();
00254     //asImage->Draw();
00255     return pic;
00256 }

Generated on Tue Nov 29 23:12:00 2016 for BOSS_7.0.2 by  doxygen 1.4.7