#include <FileMenu.h>
Public Member Functions | |
| FileMenu (TGMenuBar *menubar, TGMainFrame *mf) | |
| virtual | ~FileMenu () |
| void | HandleMenu (int menu) |
Private Member Functions | |
| int | Open () |
| int | Save () |
| int | SaveAs () |
| int | Close () |
| int | Print () |
| int | Quit () |
| int | NoImpl (const char *m) |
Private Attributes | |
| TGMainFrame * | fMainFrame |
| Main graphics frame. | |
| TGPopupMenu * | fFileMenu |
| The file menu. | |
| TGLayoutHints * | fLayout |
| How to layout the menu. | |
|
||||||||||||
|
Definition at line 33 of file FileMenu.cxx. References fFileMenu, fLayout, kM_FILE_OPEN, kM_FILE_PRINT, kM_FILE_QUIT, kM_FILE_SAVE, and kM_FILE_SAVEAS. 00033 : 00034 fMainFrame(mf) 00035 { 00036 fFileMenu = new TGPopupMenu(gClient->GetRoot()); 00037 fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0); 00038 00039 // Create the list of functions. Associate each which a command code 00040 fFileMenu->AddEntry("&Open File...", kM_FILE_OPEN); 00041 fFileMenu->AddEntry("&Save", kM_FILE_SAVE); 00042 fFileMenu->AddEntry("S&ave as...", kM_FILE_SAVEAS); 00043 fFileMenu->AddSeparator(); 00044 fFileMenu->AddEntry("&Print", kM_FILE_PRINT); 00045 fFileMenu->AddSeparator(); 00046 fFileMenu->AddEntry("&Quit", kM_FILE_QUIT); 00047 00048 fFileMenu->Connect("Activated(Int_t)", 00049 "evdb::FileMenu",this,"HandleMenu(int)"); 00050 00051 // Attach the menu to the menu bar 00052 menubar->AddPopup("&File",fFileMenu,fLayout); 00053 }
|
|
|
Definition at line 57 of file FileMenu.cxx. References fFileMenu, and fLayout. 00058 {
00059 if (fLayout) { delete fLayout; fLayout = 0; }
00060 if (fFileMenu) { delete fFileMenu; fFileMenu = 0; }
00061 }
|
|
|
|
|
|
Definition at line 65 of file FileMenu.cxx. References kM_FILE_OPEN, kM_FILE_PRINT, kM_FILE_QUIT, kM_FILE_SAVE, kM_FILE_SAVEAS, NoImpl(), Open(), Print(), Quit(), Save(), and SaveAs(). 00066 {
00067 switch(menu) {
00068 case kM_FILE_OPEN: this->Open(); break;
00069 case kM_FILE_SAVE: this->Save(); break;
00070 case kM_FILE_SAVEAS: this->SaveAs(); break;
00071 case kM_FILE_PRINT: this->Print(); break;
00072 case kM_FILE_QUIT: this->Quit(); break;
00073 default: this->NoImpl("??"); break;
00074 }
00075 }
|
|
|
Definition at line 136 of file FileMenu.cxx. References fMainFrame. Referenced by HandleMenu(), Save(), and SaveAs(). 00137 {
00138 std::string s;
00139 s = "Sorry action '"; s += method; s+= "' is not implemented.\n";
00140 // Why isn't this a memory leak? Dunno, but its seems the TG classes
00141 // are all managed by TGClient which takes care of deletion
00142 new TGMsgBox(evdb::TopWindow(), fMainFrame,
00143 "No implementation",s.c_str(),kMBIconExclamation);
00144 return 0;
00145 }
|
|
|
Definition at line 79 of file FileMenu.cxx. References evdb::IoModule::AddFile(), evdb::IoModule::GoToFile(), evdb::IoModule::Instance(), and evdb::IoModule::Reload(). Referenced by HandleMenu(). 00080 {
00081 static TString dir(""); // Static so that directory remembers where
00082 // we were last time
00083 const char* filetypes[] = { "ROOT files", "*.root",
00084 "All files", "*",
00085 0, 0 };
00086 TGFileInfo finfo;
00087
00088 finfo.fFileTypes = filetypes;
00089 finfo.fIniDir = StrDup(dir.Data());
00090
00091 new TGFileDialog(evdb::TopWindow(),evdb::TopWindow(),kFDOpen, &finfo);
00092
00093 // Add the file to the list of files in the IoModule. Make it the
00094 // current file
00095 IoModule::Instance()->AddFile(finfo.fFilename);
00096 IoModule::Instance()->GoToFile(finfo.fFilename);
00097 IoModule::Instance()->Reload();
00098
00099 return 1;
00100 }
|
|
|
Definition at line 120 of file FileMenu.cxx. Referenced by HandleMenu(). 00121 {
00122 new PrintDialog();
00123 return 1;
00124 }
|
|
|
Definition at line 128 of file FileMenu.cxx. Referenced by HandleMenu(). 00129 {
00130 std::cout << "\n";
00131 exit(0);
00132 }
|
|
|
Definition at line 104 of file FileMenu.cxx. References NoImpl(). Referenced by HandleMenu(). 00105 {
00106 this->NoImpl("Save");
00107 return 0;
00108 }
|
|
|
Definition at line 112 of file FileMenu.cxx. References NoImpl(). Referenced by HandleMenu(). 00113 {
00114 this->NoImpl("SaveAs");
00115 return 0;
00116 }
|
|
|
The file menu.
Definition at line 39 of file FileMenu.h. Referenced by FileMenu(), and ~FileMenu(). |
|
|
How to layout the menu.
Definition at line 40 of file FileMenu.h. Referenced by FileMenu(), and ~FileMenu(). |
|
|
Main graphics frame.
Definition at line 38 of file FileMenu.h. Referenced by NoImpl(). |
1.3.9.1