|
||||
File indexing completed on 2025-01-18 09:55:21
0001 //========================================================================== 0002 // AIDA Detector description implementation 0003 //-------------------------------------------------------------------------- 0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) 0005 // All rights reserved. 0006 // 0007 // For the licensing terms see $DD4hepINSTALL/LICENSE. 0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. 0009 // 0010 // Author : M.Frank 0011 // 0012 //========================================================================== 0013 #ifndef DDEVE_CONTEXTMENU_H 0014 #define DDEVE_CONTEXTMENU_H 0015 0016 // Framework include files 0017 #include "DD4hep/Callback.h" 0018 0019 // ROOT include files 0020 #include "TClass.h" 0021 0022 // C/C++ include files 0023 #include <string> 0024 0025 /* 0026 * dd4hep namespace declaration 0027 */ 0028 namespace dd4hep { 0029 0030 /// DD4hep specific handler for TEve context menus 0031 /** @class ContextMenuHandler ContextMenu.h DDEve/ContextMenu.h 0032 * 0033 * \author M.Frank 0034 * \version 1.0 0035 * \ingroup DD4HEP_EVE 0036 */ 0037 class ContextMenuHandler : public TObject { 0038 protected: 0039 /// User callback 0040 Callback m_call; 0041 /// User parameter 0042 void* m_param; 0043 public: 0044 /// Initializing constructor 0045 ContextMenuHandler(Callback cb, void* param); 0046 /// Default destructor 0047 virtual ~ContextMenuHandler(); 0048 /// User parameter hook 0049 void *param() const { return m_param; } 0050 /// Callback 0051 void Context(TObject* target); 0052 /// Root implementation macro 0053 ClassDefOverride(ContextMenuHandler,0); 0054 }; 0055 0056 0057 /// DD4hep specific TEve context menu 0058 /** @class ContextMenu ContextMenu.h DDEve/ContextMenu.h 0059 * 0060 * \author M.Frank 0061 * \version 1.0 0062 * \ingroup DD4HEP_EVE 0063 */ 0064 class ContextMenu { 0065 typedef std::vector<ContextMenuHandler*> Handlers; 0066 /// Callback map 0067 Handlers m_calls; 0068 /// List of menu entries 0069 TClass* m_class; 0070 0071 /// Initializing constructor 0072 ContextMenu(TClass* cl); 0073 /// Default destructor 0074 virtual ~ContextMenu(); 0075 /// Add user callback 0076 ContextMenu& Add(const std::string& title, Callback cb, void* ud); 0077 public: 0078 /// Instantiator 0079 static ContextMenu& instance(TClass* cl); 0080 /// Clear all existing items 0081 ContextMenu& Clear(); 0082 /// Add a separator 0083 ContextMenu& AddSeparator(); 0084 /// Add a user item to the menu 0085 template <typename Q,typename T> 0086 ContextMenu& Add(const std::string& title, Q* ptr, void (T::*pmf)(TObject*, void* ud), void* ud=0) { 0087 return Add(title, Callback(ptr).make(pmf), ud); 0088 } 0089 /// Root implementation macro 0090 ClassDef(ContextMenu,0); 0091 }; 0092 0093 0094 } /* End namespace dd4hep */ 0095 0096 0097 #endif // DDEVE_CONTEXTMENU_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |