Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / XGUI / XGUI_ContextMenuMgr.h
1
2 #ifndef XGUI_ContextMenuMgr_H
3 #define XGUI_ContextMenuMgr_H
4
5 #include "XGUI.h"
6
7 #include <QObject>
8 #include <QMap>
9
10 class XGUI_Workshop;
11 class QAction;
12 class QContextMenuEvent;
13 class QMenu;
14
15 class XGUI_EXPORT XGUI_ContextMenuMgr: public QObject
16 {
17 Q_OBJECT
18 public:
19   XGUI_ContextMenuMgr(XGUI_Workshop* theParent);
20   virtual ~XGUI_ContextMenuMgr();
21
22   void createActions();
23
24   void addAction(const QString& theId, QAction* theAction);
25
26   QAction* action(const QString& theId) const;
27
28   QStringList actionIds() const;
29
30   void updateCommandsStatus();
31
32   void connectObjectBrowser() const;
33
34 signals:
35   void actionTriggered(const QString& theId, bool isChecked);
36
37 private slots:
38   void onAction(bool isChecked);
39
40   void onContextMenuRequest(QContextMenuEvent* theEvent);
41
42 private:
43   QMenu* objectBrowserMenu() const;
44
45   QMap<QString, QAction*> myActions;
46
47   XGUI_Workshop* myWorkshop;
48 };
49
50 #endif