CMS 3D CMS Logo

CSGActionSupervisor.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : CSGActionSupervisor
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Alja Mrak-Tadel
10 // Created: Aug 2009
11 //
12 #include <sigc++/sigc++.h>
13 
17 
18 // constructors and destructor
19 //
21  m_tooltipDelay(3)
22 {
23 }
24 
26 {
27  for(std::vector<CSGAction*>::iterator it= m_actionList.begin(),itEnd = m_actionList.end();
28  it != itEnd;
29  ++it) {
30  delete *it;
31  }
32 }
33 
34 CSGAction*
36 {
37  std::vector<CSGAction*>::iterator it_act;
38  for (it_act = m_actionList.begin(); it_act != m_actionList.end(); ++it_act) {
39  if ((*it_act)->getName() == name)
40  return *it_act;
41  }
42  fwLog(fwlog::kWarning) << "No action is found with name " << name.c_str() << std::endl;
43  return 0;
44 }
45 
47  m_actionList.push_back(action);
48 }
49 
50 const std::vector<CSGAction *>& CSGActionSupervisor::getListOfActions() const {
51  return m_actionList;
52 }
53 
54 void
56 {
57  fwLog(fwlog::kInfo) << "Default action.\n";
58 }
59 
60 void
62 {
63  std::vector<CSGAction*>::iterator it_act;
64  for (it_act = m_actionList.begin(); it_act != m_actionList.end(); ++it_act) {
65  if (enable)
66  (*it_act)->globalEnable();
67  else
68  (*it_act)->globalDisable();
69  }
70 }
71 
73  std::vector<CSGAction*>::iterator it_act;
74  for (it_act = m_actionList.begin(); it_act != m_actionList.end(); ++it_act) {
75  if (entry == (*it_act)->getMenuEntry()) {
76  (*it_act)->activated.emit();
77  return kTRUE;
78  }
79  }
80  return kFALSE;
81 }
82 
84  std::vector<CSGAction*>::iterator it_act;
85  for (it_act = m_actionList.begin(); it_act != m_actionList.end(); ++it_act) {
86  if ((*it_act)->getToolBarData() && (*it_act)->getToolBarData()->fId == entry) {
87  (*it_act)->activated.emit();
88  return kTRUE;
89  }
90  }
91  return kFALSE;
92 }
93 
95 }
96 
97 void CSGActionSupervisor::resizeMenu(TGPopupMenu *menu) {
98  std::vector<CSGAction*>::iterator it_act;
99  for (it_act = m_actionList.begin(); it_act != m_actionList.end(); ++it_act) {
100  if ((*it_act)->getMenu() == menu && (*it_act)->getKeycode() != 0) {
101  (*it_act)->resizeMenuEntry();
102  }
103  }
104 }
105 
107  return m_tooltipDelay;
108 }
virtual void enableActions(bool enable=true)
Bool_t activateMenuEntry(int entry)
void resizeMenu(TGPopupMenu *menu)
void addToActionMap(CSGAction *action)
std::vector< CSGAction * > m_actionList
Long_t getToolTipDelay() const
virtual void defaultAction()
CSGAction * getAction(const std::string &name)
#define fwLog(_level_)
Definition: fwLog.h:50
const std::vector< CSGAction * > & getListOfActions() const
Bool_t activateToolBarEntry(int entry)
virtual void HandleMenu(Int_t id)