LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
HelpMenu.cxx
Go to the documentation of this file.
1 #include <cstdlib>
11 #include <string>
12 #include <iostream>
13 
14 #include "TROOT.h"
15 #include "TSystem.h"
16 #include "TGMsgBox.h"
17 #include "TGMenu.h"
18 #include "TGLayout.h"
19 
22 
23 namespace evdb{
24 
25  // Define ID codes for the actions on the file menu
26  enum {
30  };
31 
32  //......................................................................
33 
34  HelpMenu::HelpMenu(TGMenuBar* menubar, TGMainFrame* mf) :
35  fMainFrame(mf)
36  {
37  //======================================================================
38  // Build the help menu
39  //======================================================================
40  fHelpMenu = new TGPopupMenu(gClient->GetRoot());
41  fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
42 
43  // Create the list of functions. Associate each which a command code
44  fHelpMenu->AddEntry("&Contents", kM_HELP_CONTENTS);
45  fHelpMenu->AddEntry("&Release Notes", kM_HELP_RELEASENOTES);
46  fHelpMenu->AddSeparator();
47  fHelpMenu->AddEntry("&About", kM_HELP_ABOUT);
48 
49  // fHelpMenu->Connect("Activated(Int_t)",
50  // "evdb::HelpMenu",this,"HandleMenu(int)");
51 
52  // Attach the menu to the menu bar
53  menubar->AddPopup("&Help",fHelpMenu,fLayout);
54  }
55 
56  //......................................................................
57 
59  {
60  //======================================================================
61  // Delete the help menu
62  //======================================================================
63  if (fLayout) { delete fLayout; fLayout = 0; }
64  if (fHelpMenu) { delete fHelpMenu; fHelpMenu = 0; }
65  }
66 
67  //......................................................................
68 
69  void HelpMenu::HandleMenu(int menu)
70  {
71  //======================================================================
72  // Take care of menu events
73  //======================================================================
74  switch(menu) {
75  case kM_HELP_CONTENTS: this->Contents(); break;
76  case kM_HELP_RELEASENOTES: this->ReleaseNotes(); break;
77  case kM_HELP_ABOUT: this->About(); break;
78  default: this->NoImpl("??"); break;
79  }
80  }
81 
82  //......................................................................
83 
85  {
86  //======================================================================
87  // Start a help browser
88  //======================================================================
89  this->NoImpl("Contents");
90  return 0;
91  }
92 
93  //......................................................................
94 
96  {
97  //======================================================================
98  // Print information about this release of the event display
99  //======================================================================
100  const char* releaseNotes = "This is a pre-release version of event display";
101  new TGMsgBox(evdb::TopWindow(), evdb::TopWindow(),
102  "Release notes",releaseNotes,kMBIconExclamation);
103  return 0;
104  }
105 
106  //......................................................................
107 
109  {
110  //======================================================================
111  // Pop open a window containing information about versions of things
112  // used in the event display.
113  //======================================================================
114  std::string about;
115 
116  about = "MIPP Event Display\n\n";
117 
118  about += " Version: ";
119  about += "$Id: HelpMenu.cxx,v 1.2 2012-09-20 21:38:32 greenc Exp $";
120  about += "\n";
121 
122  about += " ";
123  about += gSystem->GetBuildArch();
124  about += "\n";
125 
126  about += " ";
127  about += gSystem->GetBuildNode();
128  about += "\n";
129 
130  about += " Based on ROOT version: ";
131  about += gROOT->GetVersion();
132  about += "\n";
133 
134  new TGMsgBox(evdb::TopWindow(), fMainFrame,
135  "Release notes",about.c_str(),kMBIconExclamation);
136  return 0;
137  }
138 
139  //......................................................................
140 
141  int HelpMenu::NoImpl(const char* method)
142  {
143  std::string s;
144  s = "Sorry action '"; s += method; s+= "' is not implemented.\n";
145  // Why isn't this a memory leak? Dunno, but its seems the TG classes
146  // are all managed by TGClient which takes care of deletion
147  new TGMsgBox(evdb::TopWindow(), fMainFrame,
148  "No implementation",s.c_str(),kMBIconExclamation);
149  return 0;
150  }
151 
152 }//namespace
Float_t s
Definition: plot.C:23
void HandleMenu(int menu)
Definition: HelpMenu.cxx:69
int ReleaseNotes()
Definition: HelpMenu.cxx:95
Manage all things related to colors for the event display.
TGMainFrame * fMainFrame
Definition: HelpMenu.h:35
The help pull down menu.
TGPopupMenu * fHelpMenu
Definition: HelpMenu.h:36
const TGWindow * TopWindow()
Definition: evdb.cxx:12
int NoImpl(const char *m)
Definition: HelpMenu.cxx:141
virtual ~HelpMenu()
Definition: HelpMenu.cxx:58
HelpMenu(TGMenuBar *menubar, TGMainFrame *mf)
Definition: HelpMenu.cxx:34
int Contents()
Definition: HelpMenu.cxx:84
TGLayoutHints * fLayout
Definition: HelpMenu.h:37