1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 #ifndef XGUI_ContextMenuMgr_H
4 #define XGUI_ContextMenuMgr_H
13 class QContextMenuEvent;
17 * A claas wihich provides manement of context menu
19 class XGUI_EXPORT XGUI_ContextMenuMgr : public QObject
23 XGUI_ContextMenuMgr(XGUI_Workshop* theParent);
24 virtual ~XGUI_ContextMenuMgr();
26 /// Create all actions for context menus. It is called on creation of application
29 /// Returns action according to the given ID
30 QAction* action(const QString& theId) const;
32 /// Returns list of registered actions Ids
33 QStringList actionIds() const;
35 /// update state of internal commands
36 void updateCommandsStatus();
38 /// Connect to object browser from workshop. Has to called at creation of viewer.
39 void connectObjectBrowser() const;
41 /// Connect to viewer from workshop. Has to called at creation of viewer.
42 void connectViewer() const;
44 /// Add menu atems for viewer into the given menu (used in SALOME mode)
45 void addViewerItems(QMenu* theMenu) const;
48 void actionTriggered(const QString& theId, bool isChecked);
51 void onAction(bool isChecked);
53 void onContextMenuRequest(QContextMenuEvent* theEvent);
58 * \param theId - string ID of the item
59 * \param theAction - action to add
61 void addAction(const QString& theId, QAction* theAction);
63 QMenu* objectBrowserMenu() const;
64 QMenu* viewerMenu() const;
66 QMap<QString, QAction*> myActions;
68 XGUI_Workshop* myWorkshop;