1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 #ifndef XGUI_ContextMenuMgr_H
4 #define XGUI_ContextMenuMgr_H
13 class QContextMenuEvent;
18 * A claas wihich provides manement of context menu
20 class XGUI_EXPORT XGUI_ContextMenuMgr : public QObject
25 /// \param theParent a parent object
26 XGUI_ContextMenuMgr(XGUI_Workshop* theParent);
27 virtual ~XGUI_ContextMenuMgr();
29 /// Create all actions for context menus. It is called on creation of application
32 /// Returns action according to the given ID
33 /// \param theId an id of an action
34 QAction* action(const QString& theId) const;
36 /// Returns list of registered actions Ids
37 QStringList actionIds() const;
39 /// update state of internal commands
40 void updateCommandsStatus();
42 /// Connect to object browser from workshop. Has to called at creation of viewer.
43 void connectObjectBrowser() const;
45 /// Connect to viewer from workshop. Has to called at creation of viewer.
46 void connectViewer() const;
48 /// Add menu atems for viewer into the given menu (used in SALOME mode)
49 /// \param theMenu a popup menu to be shown in the viewer
50 void addViewerItems(QMenu* theMenu) const;
53 /// Signal aabout triggered action
54 /// \param theId an id of triggered action
55 /// \param isChecked is checked flag
56 void actionTriggered(const QString& theId, bool isChecked);
59 /// Process action event
60 /// \param isChecked a checked action flag
61 void onAction(bool isChecked);
63 /// Process context menu event
64 /// \param theEvent a context menu event
65 void onContextMenuRequest(QContextMenuEvent* theEvent);
70 * \param theId - string ID of the item
71 * \param theAction - action to add
73 void addAction(const QString& theId, QAction* theAction);
75 /// Creates menu for object browser
76 QMenu* objectBrowserMenu() const;
78 /// Creates menu for viewer
79 QMenu* viewerMenu() const;
81 /// Map of created actions [id : Action]
82 QMap<QString, QAction*> myActions;
84 /// Reference to workshop
85 XGUI_Workshop* myWorkshop;