2 #ifndef XGUI_ContextMenuMgr_H
3 #define XGUI_ContextMenuMgr_H
12 class QContextMenuEvent;
16 * A claas wihich provides manement of context menu
18 class XGUI_EXPORT XGUI_ContextMenuMgr: public QObject
22 XGUI_ContextMenuMgr(XGUI_Workshop* theParent);
23 virtual ~XGUI_ContextMenuMgr();
25 /// Create all actions for context menus. It is called on creation of application
28 /// Returns action according to the given ID
29 QAction* action(const QString& theId) const;
31 /// Returns list of registered actions Ids
32 QStringList actionIds() const;
34 /// update state of internal commands
35 void updateCommandsStatus();
37 /// Connect to object browser from workshop. Has to called at creation of viewer.
38 void connectObjectBrowser() const;
40 /// Connect to viewer from workshop. Has to called at creation of viewer.
41 void connectViewer() const;
43 /// Add menu atems for viewer into the given menu (used in SALOME mode)
44 void addViewerItems(QMenu* theMenu) const;
47 void actionTriggered(const QString& theId, bool isChecked);
50 void onAction(bool isChecked);
52 void onContextMenuRequest(QContextMenuEvent* theEvent);
57 * \param theId - string ID of the item
58 * \param theAction - action to add
60 void addAction(const QString& theId, QAction* theAction);
63 QMenu* objectBrowserMenu() const;
64 QMenu* viewerMenu() const;
66 QMap<QString, QAction*> myActions;
68 XGUI_Workshop* myWorkshop;