]> SALOME platform Git repositories - modules/shaper.git/blob - src/XGUI/XGUI_ContextMenuMgr.h
Salome HOME
Create pop-up menu in 3d viewer
[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   void connectViewer() const;
35
36 signals:
37   void actionTriggered(const QString& theId, bool isChecked);
38
39 private slots:
40   void onAction(bool isChecked);
41
42   void onContextMenuRequest(QContextMenuEvent* theEvent);
43
44 private:
45   QMenu* objectBrowserMenu() const;
46   QMenu* viewerMenu() const;
47
48   QMap<QString, QAction*> myActions;
49
50   XGUI_Workshop* myWorkshop;
51 };
52
53 #endif