1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: XGUI_MenuMgr.hxx
4 // Created: 13 Apr 2016
5 // Author: Natalia ERMOLAEVA
7 #ifndef XGUI_MENUMGR_H_
8 #define XGUI_MENUMGR_H_
12 #include <Events_Listener.h>
18 class XGUI_MenuWorkbench;
20 class Config_FeatureMessage;
26 * A class for management of menu actions (features). The actions should be arranged like they are
27 * in XML file. It listens the read feature of XML and fills internal structure of menu workbenches
28 * and groups of feature. After, it creates menues and tools in the module.
30 class XGUI_MenuMgr : public Events_Listener
34 /// \param the current workshop
35 XGUI_EXPORT XGUI_MenuMgr(XGUI_Workshop* theWorkshop);
36 XGUI_EXPORT virtual ~XGUI_MenuMgr() {}
38 XGUI_EXPORT void createFeatureActions();
40 /// Redefinition of Events_Listener method
41 XGUI_EXPORT virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
44 /// Process event "Add a feature"
45 void addFeature(const std::shared_ptr<Config_FeatureMessage>& theMessage);
47 /// Finds or creates a workbench for the given name
48 /// \param theWorkbenchName a name defined in XML
49 /// \return an instance of workbench
50 std::shared_ptr<XGUI_MenuWorkbench> findWorkbench(const std::string& theWorkbenchName);
52 /// Creates a new action by the message
53 /// \param theMessage an XML information of the feature
54 /// \param theWchName a workbench name, will be used as menu/tool bar name
55 /// \param aUseSeparator boolean value if a separator should be added after the action
57 QAction* buildAction(const std::shared_ptr<Config_FeatureMessage>& theMessage,
58 const std::string& theWchName, const bool aUseSeparator) const;
61 XGUI_Workshop* myWorkshop; /// the current workshop
62 std::list< std::shared_ptr<XGUI_MenuWorkbench> > myWorkbenches; /// container of existing workbenchs
65 #endif /* XGUI_MENUMGR_H_ */