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 theWorkshop the current workshop
35 XGUI_EXPORT XGUI_MenuMgr(XGUI_Workshop* theWorkshop);
36 XGUI_EXPORT virtual ~XGUI_MenuMgr() {}
38 /// Creates feature actions
39 XGUI_EXPORT void createFeatureActions();
41 /// Redefinition of Events_Listener method
42 /// \param theMessage a message
43 XGUI_EXPORT virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
46 /// Process event "Add a feature"
47 void addFeature(const std::shared_ptr<Config_FeatureMessage>& theMessage);
49 /// Finds or creates a workbench for the given name
50 /// \param theWorkbenchName a name defined in XML
51 /// \return an instance of workbench
52 std::shared_ptr<XGUI_MenuWorkbench> findWorkbench(const std::string& theWorkbenchName);
54 /// Creates a new action by the message
55 /// \param theMessage an XML information of the feature
56 /// \param theWchName a workbench name, will be used as menu/tool bar name
57 /// \param aUseSeparator boolean value if a separator should be added after the action
59 QAction* buildAction(const std::shared_ptr<Config_FeatureMessage>& theMessage,
60 const std::string& theWchName, const bool aUseSeparator) const;
63 XGUI_Workshop* myWorkshop; ///< the current workshop
65 /// container of existing workbenchs
66 std::list< std::shared_ptr<XGUI_MenuWorkbench> > myWorkbenches;
69 #endif /* XGUI_MENUMGR_H_ */