]> SALOME platform Git repositories - modules/shaper.git/blob - src/XGUI/XGUI_Workshop.h
Salome HOME
Merge branch 'master' of newgeom:newgeom.git
[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 XGUI_SalomeConnector;
20 class XGUI_ObjectsBrowser;
21 class XGUI_ActionsMgr;
22 class ModuleBase_Operation;
23 class ModuleBase_PropPanelOperation;
24
25 class Config_FeatureMessage;
26 class Config_PointerMessage;
27
28 class QWidget;
29 class QDockWidget;
30
31 /**\class XGUI_Workshop
32  * \ingroup GUI
33  * \brief Class which defines a configuration of the application (Workshop) and launches it.
34  */
35 class XGUI_EXPORT XGUI_Workshop: public QObject, public Events_Listener
36 {
37 Q_OBJECT
38 public:
39
40   XGUI_Workshop(XGUI_SalomeConnector* theConnector = 0);
41   virtual ~XGUI_Workshop();
42
43   //! Starting of the application
44   void startApplication();
45
46   //! Returns main window (Desktop) of the application
47   XGUI_MainWindow* mainWindow() const
48   {
49     return myMainWindow;
50   }
51
52   //! Returns selection manager object
53   XGUI_SelectionMgr* selector() const { return mySelector; }
54
55   //! Returns displayer
56   XGUI_Displayer* displayer() const;
57
58   //! ! Returns operation manager.
59   XGUI_OperationMgr* operationMgr() const { return myOperationMgr; }
60
61   //! Creates and adds a new workbench (menu group) with the given name and returns it
62   XGUI_Workbench* addWorkbench(const QString& theName);
63
64   //! Redefinition of Events_Listener method
65   virtual void processEvent(const Events_Message* theMessage);
66
67   XGUI_SalomeConnector* salomeConnector() const { return mySalomeConnector; }
68
69   //! Returns true if the application works as SALOME module
70   bool isSalomeMode() const { return mySalomeConnector != 0; }
71
72   //! Returns Object browser
73   XGUI_ObjectsBrowser* objectBrowser() const { return myObjectBrowser; }
74
75 public slots:
76   void updateCommandStatus();
77
78   void onNew();
79   void onOpen();
80   void onSave();
81   void onSaveAs();
82   void onExit();
83   void onUndo();
84   void onRedo();
85
86   void showPropertyPanel();
87   void hidePropertyPanel();
88   void showObjectBrowser();
89   void hideObjectBrowser();
90
91   void onFeatureTriggered();
92
93 protected:
94   //Event-loop processing methods:
95   void addFeature(const Config_FeatureMessage*);
96   void connectWithOperation(ModuleBase_Operation* theOperation);
97
98 protected slots:
99   /// SLOT, that is called after the operation is started. Update workshop state according to
100   /// the started operation, e.g. visualizes the property panel and connect to it.
101   void onOperationStarted();
102   /// SLOT, that is called after the operation is stopped. Update workshop state, e.g.
103   /// hides the property panel and udpate the command status.
104   /// \param theOpertion a stopped operation
105   void onOperationStopped(ModuleBase_Operation* theOperation);
106
107 private:
108   void initMenu();
109
110   XGUI_Module* loadModule(const QString& theModule);
111   bool activateModule();
112
113   QDockWidget* createObjectBrowser(QWidget* theParent);
114   QDockWidget* createPropertyPanel(QWidget* theParent);
115
116   // Creates Dock widgets: Object browser and Property panel
117   void createDockWidgets();
118   void setPropertyPannelTitle(const QString& theTitle);
119
120
121   XGUI_MainWindow* myMainWindow;
122   XGUI_Module* myPartSetModule;
123
124   XGUI_ObjectsBrowser* myObjectBrowser;
125   QDockWidget* myPropertyPanelDock;
126
127   XGUI_SelectionMgr* mySelector;
128   XGUI_Displayer* myDisplayer;
129
130   XGUI_OperationMgr* myOperationMgr; ///< manager to manipulate through the operations
131   XGUI_ActionsMgr* myActionsMgr;
132
133
134   XGUI_SalomeConnector* mySalomeConnector;
135 };
136
137 #endif