DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
ContextMenu.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 #ifndef DDEVE_CONTEXTMENU_H
14 #define DDEVE_CONTEXTMENU_H
15 
16 // Framework include files
17 #include "DD4hep/Callback.h"
18 
19 // ROOT include files
20 #include "TClass.h"
21 
22 // C/C++ include files
23 #include <string>
24 
25 /*
26  * dd4hep namespace declaration
27  */
28 namespace dd4hep {
29 
31 
37  class ContextMenuHandler : public TObject {
38  protected:
42  void* m_param;
43  public:
47  virtual ~ContextMenuHandler();
49  void *param() const { return m_param; }
51  void Context(TObject* target);
54  };
55 
56 
58 
64  class ContextMenu {
65  typedef std::vector<ContextMenuHandler*> Handlers;
69  TClass* m_class;
70 
72  ContextMenu(TClass* cl);
74  virtual ~ContextMenu();
76  ContextMenu& Add(const std::string& title, Callback cb, void* ud);
77  public:
79  static ContextMenu& instance(TClass* cl);
81  ContextMenu& Clear();
85  template <typename Q,typename T>
86  ContextMenu& Add(const std::string& title, Q* ptr, void (T::*pmf)(TObject*, void* ud), void* ud=0) {
87  return Add(title, Callback(ptr).make(pmf), ud);
88  }
91  };
92 
93 
94 } /* End namespace dd4hep */
95 
96 
97 #endif // DDEVE_CONTEXTMENU_H
dd4hep::ContextMenu::Handlers
std::vector< ContextMenuHandler * > Handlers
Definition: ContextMenu.h:65
dd4hep::ContextMenu::m_calls
Handlers m_calls
Callback map.
Definition: ContextMenu.h:67
dd4hep::ContextMenu
DD4hep specific TEve context menu.
Definition: ContextMenu.h:64
dd4hep::ContextMenuHandler::~ContextMenuHandler
virtual ~ContextMenuHandler()
Default destructor.
Definition: ContextMenu.cpp:42
dd4hep::ContextMenu::ClassDef
ClassDef(ContextMenu, 0)
Root implementation macro.
dd4hep::ContextMenu::Add
ContextMenu & Add(const std::string &title, Callback cb, void *ud)
Add user callback.
Definition: ContextMenu.cpp:91
dd4hep::ContextMenu::Add
ContextMenu & Add(const std::string &title, Q *ptr, void(T::*pmf)(TObject *, void *ud), void *ud=0)
Add a user item to the menu.
Definition: ContextMenu.h:86
Callback.h
dd4hep::ContextMenuHandler
DD4hep specific handler for TEve context menus.
Definition: ContextMenu.h:37
dd4hep::Callback
Definition of the generic callback structure for member functions.
Definition: Callback.h:38
dd4hep::ContextMenuHandler::ContextMenuHandler
ContextMenuHandler(Callback cb, void *param)
Initializing constructor.
dd4hep::ContextMenuHandler::param
void * param() const
User parameter hook.
Definition: ContextMenu.h:49
dd4hep::ContextMenu::AddSeparator
ContextMenu & AddSeparator()
Add a separator.
Definition: ContextMenu.cpp:83
dd4hep::ContextMenu::Clear
ContextMenu & Clear()
Clear all existing items.
Definition: ContextMenu.cpp:75
dd4hep::ContextMenu::m_class
TClass * m_class
List of menu entries.
Definition: ContextMenu.h:69
dd4hep::ContextMenu::~ContextMenu
virtual ~ContextMenu()
Default destructor.
Definition: ContextMenu.cpp:62
dd4hep::ContextMenuHandler::ClassDefOverride
ClassDefOverride(ContextMenuHandler, 0)
Root implementation macro.
dd4hep::ContextMenuHandler::m_param
void * m_param
User parameter.
Definition: ContextMenu.h:42
TObject
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
Definition: ROOTClasses.h:41
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::ContextMenu::instance
static ContextMenu & instance(TClass *cl)
Instantiator.
Definition: ContextMenu.cpp:66
dd4hep::ContextMenuHandler::m_call
Callback m_call
User callback.
Definition: ContextMenu.h:40
dd4hep::ContextMenuHandler::Context
void Context(TObject *target)
Callback.
Definition: ContextMenu.cpp:46
dd4hep::ContextMenu::ContextMenu
ContextMenu(TClass *cl)
Initializing constructor.