00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "EventDisplayBase/HelpMenu.h"
00011 #include <cstdlib>
00012 #include <string>
00013 #include <iostream>
00014 #include "TROOT.h"
00015 #include "TSystem.h"
00016 #include "TGMsgBox.h"
00017 #include "TGMenu.h"
00018 #include "TGLayout.h"
00019 #include "evdb.h"
00020 using namespace evdb;
00021
00022
00023 enum {
00024 kM_HELP_CONTENTS,
00025 kM_HELP_RELEASENOTES,
00026 kM_HELP_ABOUT
00027 };
00028
00029
00030
00031 HelpMenu::HelpMenu(TGMenuBar* menubar, TGMainFrame* mf) :
00032 fMainFrame(mf)
00033 {
00034
00035
00036
00037 fHelpMenu = new TGPopupMenu(gClient->GetRoot());
00038 fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
00039
00040
00041 fHelpMenu->AddEntry("&Contents", kM_HELP_CONTENTS);
00042 fHelpMenu->AddEntry("&Release Notes", kM_HELP_RELEASENOTES);
00043 fHelpMenu->AddSeparator();
00044 fHelpMenu->AddEntry("&About", kM_HELP_ABOUT);
00045
00046 fHelpMenu->Connect("Activated(Int_t)",
00047 "evdb::HelpMenu",this,"HandleMenu(int)");
00048
00049
00050 menubar->AddPopup("&Help",fHelpMenu,fLayout);
00051 }
00052
00053
00054
00055 HelpMenu::~HelpMenu()
00056 {
00057
00058
00059
00060 if (fLayout) { delete fLayout; fLayout = 0; }
00061 if (fHelpMenu) { delete fHelpMenu; fHelpMenu = 0; }
00062 }
00063
00064
00065
00066 void HelpMenu::HandleMenu(int menu)
00067 {
00068
00069
00070
00071 switch(menu) {
00072 case kM_HELP_CONTENTS: this->Contents(); break;
00073 case kM_HELP_RELEASENOTES: this->ReleaseNotes(); break;
00074 case kM_HELP_ABOUT: this->About(); break;
00075 default: this->NoImpl("??"); break;
00076 }
00077 }
00078
00079
00080
00081 int HelpMenu::Contents()
00082 {
00083
00084
00085
00086 this->NoImpl("Contents");
00087 return 0;
00088 }
00089
00090
00091
00092 int HelpMenu::ReleaseNotes()
00093 {
00094
00095
00096
00097 const char* releaseNotes = "This is a pre-release version of event display";
00098 new TGMsgBox(evdb::TopWindow(), evdb::TopWindow(),
00099 "Release notes",releaseNotes,kMBIconExclamation);
00100 return 0;
00101 }
00102
00103
00104
00105 int HelpMenu::About()
00106 {
00107
00108
00109
00110
00111 std::string about;
00112
00113 about = "MIPP Event Display\n\n";
00114
00115 about += " Version: ";
00116 about += "$Id: HelpMenu.cxx,v 1.1 2007/02/09 04:44:13 fmwk Exp $";
00117 about += "\n";
00118
00119 about += " ";
00120 about += gSystem->GetBuildArch();
00121 about += "\n";
00122
00123 about += " ";
00124 about += gSystem->GetBuildNode();
00125 about += "\n";
00126
00127 about += " Based on ROOT version: ";
00128 about += gROOT->GetVersion();
00129 about += "\n";
00130
00131 new TGMsgBox(evdb::TopWindow(), fMainFrame,
00132 "Release notes",about.c_str(),kMBIconExclamation);
00133 return 0;
00134 }
00135
00136
00137
00138 int HelpMenu::NoImpl(const char* method)
00139 {
00140 std::string s;
00141 s = "Sorry action '"; s += method; s+= "' is not implemented.\n";
00142
00143
00144 new TGMsgBox(evdb::TopWindow(), fMainFrame,
00145 "No implementation",s.c_str(),kMBIconExclamation);
00146 return 0;
00147 }
00148