Public Member Functions | Private Member Functions | Private Attributes | List of all members
evdb::WindowMenu Class Reference

#include <WindowMenu.h>

Public Member Functions

 WindowMenu (TGMenuBar *menubar, TGMainFrame *mf)
 
virtual ~WindowMenu ()
 
void HandleMenu (int menu)
 

Private Member Functions

int NoImpl (const char *m)
 
int No3DViewer ()
 

Private Attributes

TGPopupMenu * fWindowMenu
 
TGLayoutHints * fLayout
 

Detailed Description

Definition at line 19 of file WindowMenu.h.

Constructor & Destructor Documentation

evdb::WindowMenu::WindowMenu ( TGMenuBar *  menubar,
TGMainFrame *  mf 
)

Definition at line 25 of file WindowMenu.cxx.

26  {
27  fWindowMenu = new TGPopupMenu(gClient->GetRoot());
28  fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
29 
30  // Create the list of functions. Associate each which a command code
31  unsigned int cnt = 2;
32  unsigned int i=0;
33  const std::vector<std::string>& names = DisplayWindow::Names();
34  for (; i<names.size(); ++i) {
35  fWindowMenu->AddEntry(names[i].c_str(), cnt+i);
36  }
37  fWindowMenu->AddSeparator();
38 
39  // Create the list of functions. Associate each which a command code
40  const std::vector<std::string>& lnames = ListWindow::Names();
41  for (unsigned int j=0; j<lnames.size(); ++j) {
42  fWindowMenu->AddEntry(lnames[j].c_str(), cnt+i+j);
43  }
44  fWindowMenu->AddSeparator();
45  fWindowMenu->AddEntry("&Scan Window", 0);
46  fWindowMenu->AddSeparator();
47  //fWindowMenu->AddEntry("&MC Information", -2);
48  fWindowMenu->AddEntry("&ROOT Browser", 1);
49  fWindowMenu->Connect("Activated(Int_t)",
50  "evdb::WindowMenu",this,"HandleMenu(int)");
51 
52  // Attach the menu to the menu bar
53  menubar->AddPopup("&Window",fWindowMenu,fLayout);
54  }
TGLayoutHints * fLayout
Definition: WindowMenu.h:35
static const std::vector< std::string > & Names()
Definition: ListWindow.cxx:46
static const std::vector< std::string > & Names()
TGPopupMenu * fWindowMenu
Definition: WindowMenu.h:34
evdb::WindowMenu::~WindowMenu ( )
virtual

Definition at line 58 of file WindowMenu.cxx.

59  {
60  if (fLayout) { delete fLayout; fLayout = 0; }
61  if (fWindowMenu) { delete fWindowMenu; fWindowMenu = 0; }
62  }
TGLayoutHints * fLayout
Definition: WindowMenu.h:35
TGPopupMenu * fWindowMenu
Definition: WindowMenu.h:34

Member Function Documentation

void evdb::WindowMenu::HandleMenu ( int  menu)

Definition at line 66 of file WindowMenu.cxx.

67  {
68  if( menu == 0 ){
69  new ScanWindow();
70  return;
71  }
72  //
73  // Check if the menu has selected one of the named "user" windows
74  //
75  if (menu-2 < (int)DisplayWindow::Names().size()) {
76  int aok = DisplayWindow::OpenWindow(menu-2);
77  if (aok<0) this->NoImpl("Error openning requested window");
78  return;
79  }
80  }
static int OpenWindow(int type=0)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
int NoImpl(const char *m)
Definition: WindowMenu.cxx:84
static const std::vector< std::string > & Names()
int evdb::WindowMenu::No3DViewer ( )
private

Definition at line 98 of file WindowMenu.cxx.

99  {
100  new TGMsgBox(evdb::TopWindow(),
101  evdb::TopWindow(),
102  "Not for this view",
103  "This display does not implement a 3D viewer",
104  kMBIconExclamation);
105  return 0;
106  }
const TGWindow * TopWindow()
Definition: evdb.cxx:12
int evdb::WindowMenu::NoImpl ( const char *  m)
private

Definition at line 84 of file WindowMenu.cxx.

85  {
86  std::string s;
87  s = "Sorry action '"; s += method; s+= "' is not implemented.\n";
88  // Why isn't this a memory leak? Dunno, but its seems the TG classes
89  // are all managed by TGClient which takes care of deletion
90  new TGMsgBox(evdb::TopWindow(),
92  "No implementation",s.c_str(),kMBIconExclamation);
93  return 0;
94  }
std::string string
Definition: nybbler.cc:12
const TGWindow * TopWindow()
Definition: evdb.cxx:12
static QCString * s
Definition: config.cpp:1042

Member Data Documentation

TGLayoutHints* evdb::WindowMenu::fLayout
private

Definition at line 35 of file WindowMenu.h.

TGPopupMenu* evdb::WindowMenu::fWindowMenu
private

Definition at line 34 of file WindowMenu.h.


The documentation for this class was generated from the following files: