Salome HOME
Issue 1303 Re-ordering of Sketcher menus: additional structure for feature info to...
[modules/shaper.git] / src / XGUI / XGUI_MenuMgr.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        XGUI_MenuMgr.hxx
4 // Created:     13 Apr 2016
5 // Author:      Natalia ERMOLAEVA
6
7 #ifndef XGUI_MENUMGR_H_
8 #define XGUI_MENUMGR_H_
9
10 #include "XGUI.h"
11
12 #include <Events_Listener.h>
13
14 #include <string>
15 #include <list>
16 #include <memory>
17
18 class XGUI_MenuWorkbench;
19 class XGUI_Workshop;
20 class Config_FeatureMessage;
21
22 /**
23 * \ingroup GUI
24 * A class for management of menu actions (features). The actions should be arranged like they are
25 * in XML file. It listens the read feature of XML and fills internal structure of menu workbenches
26 * and groups of feature. After, it creates menues and tools in the module.
27 */
28 class XGUI_MenuMgr : public Events_Listener
29 {
30  public:
31   /// Constructor
32   /// \param the current workshop
33   XGUI_EXPORT XGUI_MenuMgr(XGUI_Workshop* theWorkshop);
34   XGUI_EXPORT virtual ~XGUI_MenuMgr() {}
35
36   /// Redefinition of Events_Listener method
37   XGUI_EXPORT virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
38
39 protected:
40   /// Process event "Add a feature"
41   void addFeature(const std::shared_ptr<Config_FeatureMessage>& theMessage);
42
43   /// Finds or creates a workbench for the given name
44   /// \param theWorkbenchName a name defined in XML
45   /// \return an instance of workbench
46   std::shared_ptr<XGUI_MenuWorkbench> findWorkbench(std::string& theWorkbenchName);
47
48 private:
49   XGUI_Workshop* myWorkshop; /// the current workshop
50   std::list< std::shared_ptr<XGUI_MenuWorkbench> > myWorkbenches; /// container of existing workbenchs
51 };
52
53 #endif /* XGUI_MENUMGR_H_ */