Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

HelpMenu.cxx

Go to the documentation of this file.
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 // Define ID codes for the actions on the file menu
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 // Build the help menu
00036 //======================================================================
00037   fHelpMenu = new TGPopupMenu(gClient->GetRoot());
00038   fLayout   = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
00039 
00040   // Create the list of functions. Associate each which a command code
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   // Attach the menu to the menu bar
00050   menubar->AddPopup("&Help",fHelpMenu,fLayout);
00051 }
00052 
00053 //......................................................................
00054 
00055 HelpMenu::~HelpMenu() 
00056 {
00057 //======================================================================
00058 // Delete the help menu
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 // Take care of menu events
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 // Start a help browser
00085 //======================================================================
00086   this->NoImpl("Contents");
00087   return 0;
00088 }
00089 
00090 //......................................................................
00091 
00092 int HelpMenu::ReleaseNotes() 
00093 {
00094 //======================================================================
00095 // Print information about this release of the event display
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 // Pop open a window containing information about versions of things
00109 // used in the event display.
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   // Why isn't this a memory leak? Dunno, but its seems the TG classes
00143   // are all managed by TGClient which takes care of deletion
00144   new TGMsgBox(evdb::TopWindow(), fMainFrame,
00145                "No implementation",s.c_str(),kMBIconExclamation);
00146   return 0;
00147 }
00148 

Generated on Sat Oct 11 02:35:27 2008 for NOvA Offline by  doxygen 1.3.9.1