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
24 /// \param theParent a parent object
25 XGUI_ContextMenuMgr(XGUI_Workshop* theParent);
26 virtual ~XGUI_ContextMenuMgr();
28 /// Create all actions for context menus. It is called on creation of application
31 /// Returns action according to the given ID
32 /// \param theId an id of an action
33 QAction* action(const QString& theId) const;
35 /// Returns list of registered actions Ids
36 QStringList actionIds() const;
38 /// update state of internal commands
39 void updateCommandsStatus();
41 /// Connect to object browser from workshop. Has to called at creation of viewer.
42 void connectObjectBrowser() const;
44 /// Connect to viewer from workshop. Has to called at creation of viewer.
45 void connectViewer() const;
47 /// Add menu atems for viewer into the given menu (used in SALOME mode)
48 /// \param theMenu a menu instance
49 void addViewerItems(QMenu* theMenu) const;
52 /// Signal aabout triggered action
53 /// \param theId an id of triggered action
54 /// \param isChecked is checked flag
55 void actionTriggered(const QString& theId, bool isChecked);
58 /// Process action event
59 /// \param isChecked a checked action flag
60 void onAction(bool isChecked);
62 /// Process context menu event
63 /// \param theEvent a context menu event
64 void onContextMenuRequest(QContextMenuEvent* theEvent);
69 * \param theId - string ID of the item
70 * \param theAction - action to add
72 void addAction(const QString& theId, QAction* theAction);
74 /// Creates menu for object browser
75 QMenu* objectBrowserMenu() const;
77 /// Creates menu for viewer
78 QMenu* viewerMenu() const;
80 /// Map of created actions [id : Action]
81 QMap<QString, QAction*> myActions;
83 /// Reference to workshop
84 XGUI_Workshop* myWorkshop;