]> SALOME platform Git repositories - modules/shaper.git/blob - src/XGUI/XGUI_Workshop.h
Salome HOME
Open, Save, Exit, etc. actions processing.
[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   void saveDocument(QString theName);
98
99 protected slots:
100   /// SLOT, that is called after the operation is started. Update workshop state according to
101   /// the started operation, e.g. visualizes the property panel and connect to it.
102   void onOperationStarted();
103   /// SLOT, that is called after the operation is stopped. Update workshop state, e.g.
104   /// hides the property panel and udpate the command status.
105   /// \param theOpertion a stopped operation
106   void onOperationStopped(ModuleBase_Operation* theOperation);
107
108 private:
109   void initMenu();
110
111   XGUI_Module* loadModule(const QString& theModule);
112   bool activateModule();
113
114   QDockWidget* createObjectBrowser(QWidget* theParent);
115   QDockWidget* createPropertyPanel(QWidget* theParent);
116
117   // Creates Dock widgets: Object browser and Property panel
118   void createDockWidgets();
119   void setPropertyPannelTitle(const QString& theTitle);
120
121   QString myCurrentFile;
122   XGUI_MainWindow* myMainWindow;
123   XGUI_Module* myPartSetModule;
124   XGUI_ObjectsBrowser* myObjectBrowser;
125   QDockWidget* myPropertyPanelDock;
126   XGUI_SelectionMgr* mySelector;
127   XGUI_Displayer* myDisplayer;
128   XGUI_OperationMgr* myOperationMgr; ///< manager to manipulate through the operations
129   XGUI_ActionsMgr* myActionsMgr;
130   XGUI_SalomeConnector* mySalomeConnector;
131 };
132
133 #endif