EditMenu.cxx
Go to the documentation of this file.
1 ///
2 /// \file EditMenu.cxx
3 /// \brief The edit pull down menu
4 /// \author messier@indiana.edu
5 ///
7 #include "TGMenu.h"
9 
10 namespace evdb
11 {
12  EditMenu::EditMenu(TGMenuBar* menubar,
13  TGMainFrame* /*mf*/)
14  {
15  fEditMenu = new TGPopupMenu(gClient->GetRoot());
16 
17  fDrawingMenu = new TGPopupMenu();
18  fExpMenu = new TGPopupMenu();
19 
20  fEditMenu->AddPopup("Configure &Drawing", fDrawingMenu);
21  fEditMenu->AddPopup("Configure &Experiment Services", fExpMenu);
22 
23  fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
24 
25  menubar->AddPopup("&Edit",fEditMenu,fLayout);
26  }
27 
28  //......................................................................
29 
31  {
32  if (fLayout) { delete fLayout; fLayout = nullptr; }
33  if (fEditMenu) { delete fEditMenu; fEditMenu = nullptr; }
34  if (fExpMenu) { delete fExpMenu; fExpMenu = nullptr; }
35  if (fDrawingMenu) { delete fDrawingMenu; fDrawingMenu = nullptr; }
36  }
37 
38  //....................................................................
39 
40  void EditMenu::WipeMenu(TGPopupMenu* m)
41  {
42  for (unsigned int i=0;;++i) {
43  TGMenuEntry* me = m->GetEntry(i);
44  if (me) m->DeleteEntry(i);
45  else break;
46  }
47  }
48 
49  //....................................................................
50 
52  {
53  this->WipeMenu(fDrawingMenu);
54  this->WipeMenu(fExpMenu);
55 
57 
58  unsigned int i;
59  for (i=0; i<st.fServices.size(); ++i) {
60  const ServiceTableEntry& ste = st.fServices[i];
61  if (ste.fCategory==kDRAWING_SERVICE) {
62  fDrawingMenu->AddEntry(ste.fName.c_str(), i);
63  }
64  else if (ste.fCategory==kEXPERIMENT_SERVICE) {
65  fExpMenu->AddEntry(ste.fName.c_str(), i);
66  }
67  fEditMenu->Connect("Activated(Int_t)",
68  "evdb::EditMenu",
69  this,
70  "MenuSelect(int)");
71  }
72  }
73 
74  //......................................................................
75 
77  {
79  }
80 
81 }// namespace
82 ////////////////////////////////////////////////////////////////////////
static constexpr int kDRAWING_SERVICE
Definition: ServiceTable.h:19
The edit pull down menu.
static ServiceTable & Instance()
EditMenu(TGMenuBar *menubar, TGMainFrame *mf)
Definition: EditMenu.cxx:12
Collection of Services used in the event display.
Definition: ServiceTable.h:36
void WipeMenu(TGPopupMenu *m)
Definition: EditMenu.cxx:40
void Edit(unsigned int i)
Manage all things related to colors for the event display.
Definition: Display3DPad.h:11
TGPopupMenu * fExpMenu
Experiment services.
Definition: EditMenu.h:35
static constexpr int kEXPERIMENT_SERVICE
Definition: ServiceTable.h:20
void SetServices()
Definition: EditMenu.cxx:51
Definition: NueSkimmer.h:24
void MenuSelect(int which)
Definition: EditMenu.cxx:76
TGLayoutHints * fLayout
How to layout the menu.
Definition: EditMenu.h:36
TGPopupMenu * fDrawingMenu
Drawing options.
Definition: EditMenu.h:34
std::vector< ServiceTableEntry > fServices
Definition: ServiceTable.h:50
virtual ~EditMenu()
Definition: EditMenu.cxx:30
Information about a service required by the event display.
Definition: ServiceTable.h:25
Interface to services and their configurations.
TGPopupMenu * fEditMenu
The file menu.
Definition: EditMenu.h:33