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