00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <TSystem.h>
00011 #include <TROOT.h>
00012 #include <TRootHelpDialog.h>
00013
00014 #include "RSAbout.h"
00015 #include "RSVersion.h"
00016
00017
00018
00019 RootShowerAbout::RootShowerAbout(const TGWindow *p, const TGWindow *main,
00020 UInt_t w, UInt_t h, UInt_t options) :
00021 TGTransientFrame(p, main, w, h, options)
00022 {
00023 Int_t iday,imonth,iyear;
00024 Char_t message1[80];
00025 static const Char_t *months[] = {"January","February", "March","April","May","June","July",
00026 "August", "September","October","November","December"};
00027 TGPicture *fIconPicture;
00028 TGIcon *fIcon;
00029 UInt_t wh1 = (UInt_t)(0.6 * h);
00030 UInt_t wh2 = h - wh1;
00031
00032 const Char_t *root_version = gROOT->GetVersion();
00033 Int_t idatqq = gROOT->GetVersionDate();
00034 iday = idatqq%100;
00035 imonth = (idatqq/100)%100;
00036 iyear = (idatqq/10000);
00037 Char_t *root_date = Form("%s %d %4d",months[imonth-1],iday,iyear);
00038 fVFrame = new TGVerticalFrame(this, w, wh1, 0);
00039
00040 TString theLogoFilename = StrDup(gProgPath);
00041 theLogoFilename.Append("/icons/mclogo01.xpm");
00042
00043 fIconPicture = (TGPicture *)gClient->GetPicture(theLogoFilename);
00044 fIcon = new TGIcon(this, fIconPicture,
00045 fIconPicture->GetWidth(),
00046 fIconPicture->GetHeight());
00047 fLogoLayout = new TGLayoutHints(kLHintsCenterX, 0, 0, 0, 0);
00048 AddFrame(fIcon, fLogoLayout);
00049
00050 sprintf(message1," ROOT Shower Monte Carlo / Event Display v %s ",
00051 ROOTSHOWER_RELEASE);
00052 fLabel1 = new TGLabel(fVFrame, message1);
00053 sprintf(message1," Compiled with Root version %s, release date : %s ",
00054 root_version, root_date);
00055 fLabel2 = new TGLabel(fVFrame, message1);
00056 fLabel4 = new TGLabel(fVFrame, " (c) Bertrand Bellenot 1994 - 2008 ");
00057
00058 fBly = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 0, 0, 5, 5);
00059 fBfly = new TGLayoutHints(kLHintsTop | kLHintsRight| kLHintsExpandX, 0, 0, 5, 5);
00060
00061 fVFrame->AddFrame(fLabel1,fBly);
00062 fVFrame->AddFrame(fLabel2,fBly);
00063 fVFrame->AddFrame(fLabel4,fBly);
00064
00065
00066
00067
00068
00069 fHFrame = new TGHorizontalFrame(this, w, wh2, 0);
00070
00071 fOkButton = new TGTextButton(fHFrame, "&Ok", 1);
00072 fOkButton->Resize(100, fOkButton->GetDefaultHeight());
00073 fOkButton->Associate(this);
00074
00075 fL1 = new TGLayoutHints(kLHintsCenterX | kLHintsExpandX, 2, 2, 2, 2);
00076 fL2 = new TGLayoutHints(kLHintsBottom | kLHintsCenterX | kLHintsExpandX, 150, 150, 2, 10);
00077
00078 fHFrame->AddFrame(fOkButton, fL1);
00079
00080 fHFrame->Resize(100, fOkButton->GetDefaultHeight());
00081
00082 AddFrame(fVFrame, fBfly);
00083 AddFrame(fHFrame, fL2);
00084
00085 SetWindowName("About RootShower...");
00086 TGDimension size = GetDefaultSize();
00087 Resize(size);
00088
00089 SetWMSize(size.fWidth, size.fHeight);
00090 SetWMSizeHints(size.fWidth, size.fHeight, size.fWidth, size.fHeight, 0, 0);
00091 SetMWMHints(kMWMDecorAll | kMWMDecorResizeH | kMWMDecorMaximize |
00092 kMWMDecorMinimize | kMWMDecorMenu, kMWMFuncAll |
00093 kMWMFuncResize | kMWMFuncMaximize | kMWMFuncMinimize,
00094 kMWMInputModeless);
00095
00096
00097 Int_t ax, ay;
00098 Window_t wdummy;
00099 gVirtualX->TranslateCoordinates(main->GetId(), GetParent()->GetId(),
00100 (Int_t)(((TGFrame *) main)->GetWidth() - fWidth) >> 1,
00101 (Int_t)(((TGFrame *) main)->GetHeight() - fHeight) >> 1,
00102 ax, ay, wdummy);
00103 if (ax < 0) ax = 10;
00104 if (ay < 0) ay = 10;
00105 Move(ax, ay);
00106 SetWMPosition(ax, ay);
00107
00108 MapSubwindows();
00109 MapWindow();
00110
00111 fClient->WaitFor(this);
00112 }
00113
00114
00115 RootShowerAbout::~RootShowerAbout()
00116 {
00117 delete fOkButton;
00118 delete fVFrame;
00119 delete fHFrame;
00120 delete fLabel1;
00121 delete fLabel2;
00122 delete fLabel4;
00123 delete fBly;
00124 }
00125
00126
00127 void RootShowerAbout::CloseWindow()
00128 {
00129
00130
00131 DeleteWindow();
00132 }
00133
00134
00135 Bool_t RootShowerAbout::ProcessMessage(Long_t msg, Long_t ,
00136 Long_t )
00137 {
00138
00139 switch (GET_MSG(msg)) {
00140 case kC_COMMAND:
00141 switch (GET_SUBMSG(msg)) {
00142 case kCM_BUTTON:
00143 CloseWindow();
00144 break;
00145 default:
00146 break;
00147 }
00148 break;
00149 default:
00150 break;
00151 }
00152 return kTRUE;
00153 }
00154