Salome HOME
6c9034d49e30d95b990a8cade7b9627bea1f6db5
[modules/shaper.git] / src / XGUI / XGUI_Workshop.h
1 #ifndef XGUI_WORKSHOP_H
2 #define XGUI_WORKSHOP_H
3
4 #include "XGUI.h"
5 #include <Events_Listener.h>
6
7 #include <QObject>
8 #include <QMap>
9 #include <QIcon>
10 #include <QKeySequence>
11
12 class XGUI_MainWindow;
13 class XGUI_Command;
14 class XGUI_Module;
15 class XGUI_Workbench;
16 class XGUI_SelectionMgr;
17 class XGUI_Displayer;
18 class XGUI_OperationMgr;
19 class ModuleBase_Operation;
20 class ModuleBase_PropPanelOperation;
21
22 class Config_FeatureMessage;
23 class Config_PointerMessage;
24
25 /**\class XGUI_Workshop
26  * \ingroup GUI
27  * \brief Class which defines a configuration of the application (Workshop) and launches it.
28  */
29 class XGUI_EXPORT XGUI_Workshop: public QObject, public Events_Listener
30 {
31 Q_OBJECT
32 public:
33
34   XGUI_Workshop();
35   virtual ~XGUI_Workshop();
36
37   //! Starting of the application
38   void startApplication();
39
40   //! Returns main window (Desktop) of the application
41   XGUI_MainWindow* mainWindow() const
42   {
43     return myMainWindow;
44   }
45
46   //! Returns selection manager object
47   XGUI_SelectionMgr* selector() const { return mySelector; }
48
49   //! Returns displayer
50   XGUI_Displayer* displayer() const { return myDisplayer; }
51
52   //! ! Returns operation manager.
53   XGUI_OperationMgr* operationMgr() const { return myOperationMgr; }
54
55   //! Creates and adds a new workbench (menu group) with the given name and returns it
56   XGUI_Workbench* addWorkbench(const QString& theName);
57
58   //! Redefinition of Events_Listener method
59   virtual void processEvent(const Events_Message* theMessage);
60
61 public slots:
62   void updateCommandStatus();
63
64   void onNew();
65   void onOpen();
66   void onSave();
67   void onSaveAs();
68   void onExit();
69   void onUndo();
70   void onRedo();
71
72 protected:
73   //Event-loop processing methods:
74   void addFeature(const Config_FeatureMessage*);
75   void connectWithOperation(ModuleBase_Operation* theOperation);
76
77 protected slots:
78   /// SLOT, that is called after the operation is started. Update workshop state according to
79   /// the started operation, e.g. visualizes the property panel and connect to it.
80   void onOperationStarted();
81   /// SLOT, that is called after the operation is stopped. Update workshop state, e.g.
82   /// hides the property panel and udpate the command status.
83   /// \param theOpertion a stopped operation
84   void onOperationStopped(ModuleBase_Operation* theOperation);
85
86 private:
87   void initMenu();
88
89   XGUI_Module* loadModule(const QString& theModule);
90   bool activateModule();
91
92   XGUI_MainWindow* myMainWindow;
93   XGUI_Module* myPartSetModule;
94
95   XGUI_SelectionMgr* mySelector;
96   XGUI_Displayer* myDisplayer;
97
98   XGUI_OperationMgr* myOperationMgr; ///< manager to manipulate through the operations
99 };
100
101 #endif