![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2008 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtMenuManager.h,v $ $Revision: 1.8 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #ifndef DtMenuManager_H_ 00014 #define DtMenuManager_H_ 00015 00016 #include <vrvCoreQt/vrvCoreQt.h> 00017 #include <vrvUtil/DtVirtualBaseClass.h> 00018 #include <vrvCore/DtMenuPath.h> 00019 00020 #include <QtCore/QObject> 00021 00022 class QMenu; 00023 class QAction; 00024 00025 namespace makVrv 00026 { 00027 class DtDe; 00028 class DtMenuPath; 00029 00030 00034 class DT_DLL_VRVCOREQT DtMenuManager : public QObject , public DtVirtualBaseClass 00035 { 00036 Q_OBJECT; 00037 public: 00038 00040 static DtMenuManager& instance(DtDe& de); 00041 00043 virtual ~DtMenuManager(); 00044 00046 void registerMenu(const DtMenuPath& path, QMenu* menu); 00047 00049 void registerMenuItem(const DtMenuPath& path, QAction* action); 00050 00052 QMenu* findMenu(const DtMenuPath& path) const; 00053 00055 QAction* findMenuItem(const DtMenuPath& path) const; 00056 00059 const std::map<DtMenuPath,QMenu*>& menus() const; 00060 const std::map<DtMenuPath,QAction*> menuItems() const; 00061 00062 boost::signal<void (const DtMenuPath&)> signal_menuDeleted; 00063 boost::signal<void (const DtMenuPath&)> signal_menuItemDeleted; 00064 00065 protected slots: 00066 00068 void onMenuDestroyed(QObject* obj); 00069 00071 void onActionDestroyed(QObject* obj); 00072 00073 protected: 00074 00076 DtMenuManager(); 00077 00078 std::map<DtMenuPath,QMenu*> myMenus; 00079 std::map<DtMenuPath,QAction*> myMenuItems; 00080 }; 00081 } 00082 00083 #endif 00084