1 #ifndef XGUI_WORKSHOP_H
2 #define XGUI_WORKSHOP_H
5 #include <Events_Listener.h>
10 #include <QKeySequence>
12 class XGUI_MainWindow;
16 class XGUI_SelectionMgr;
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 class XGUI_ViewerProxy;
25 class XGUI_PropertyPanel;
27 class ModuleBase_Operation;
29 class Config_FeatureMessage;
30 class Config_PointerMessage;
35 /**\class XGUI_Workshop
37 * \brief Class which defines a configuration of the application (Workshop) and launches it.
39 class XGUI_EXPORT XGUI_Workshop: public QObject, public Events_Listener
44 XGUI_Workshop(XGUI_SalomeConnector* theConnector = 0);
45 virtual ~XGUI_Workshop();
47 //! Starting of the application
48 void startApplication();
50 //! Returns main window (Desktop) of the application
51 XGUI_MainWindow* mainWindow() const
56 //! Returns selection manager object
57 XGUI_SelectionMgr* selector() const { return mySelector; }
60 XGUI_Displayer* displayer() const { return myDisplayer; }
62 //! ! Returns operation manager.
63 XGUI_OperationMgr* operationMgr() const { return myOperationMgr; }
65 //! ! Returns an actions manager
66 XGUI_ActionsMgr* actionsMgr() const { return myActionsMgr; };
68 //! Returns property panel widget
69 XGUI_PropertyPanel* propertyPanel() const { return myPropertyPanel; }
71 //! Creates and adds a new workbench (menu group) with the given name and returns it
72 XGUI_Workbench* addWorkbench(const QString& theName);
74 //! Redefinition of Events_Listener method
75 virtual void processEvent(const Events_Message* theMessage);
77 //! Returns an object which provides interface to Salome Module (LightApp_Module)
78 XGUI_SalomeConnector* salomeConnector() const { return mySalomeConnector; }
80 //! Provides an object which provides interface to Salome Viewer
81 XGUI_SalomeViewer* salomeViewer() const;
83 //! Returns true if the application works as SALOME module
84 bool isSalomeMode() const { return mySalomeConnector != 0; }
86 //! Returns Object browser
87 XGUI_ObjectsBrowser* objectBrowser() const { return myObjectBrowser; }
89 void salomeViewerSelectionChanged();
91 XGUI_ViewerProxy* viewer() const { return myViewerProxy; }
94 void salomeViewerSelection();
97 void updateCommandStatus();
107 void showPropertyPanel();
108 void hidePropertyPanel();
109 void showObjectBrowser();
110 void hideObjectBrowser();
112 void onFeatureTriggered();
113 void changeCurrentDocument();
116 void errorOccurred(const QString&);
119 //Event-loop processing methods:
120 void addFeature(const Config_FeatureMessage*);
121 void connectWithOperation(ModuleBase_Operation* theOperation);
122 void saveDocument(QString theName);
125 /// SLOT, that is called after the operation is started. Update workshop state according to
126 /// the started operation, e.g. visualizes the property panel and connect to it.
127 void onOperationStarted();
128 /// SLOT, that is called after the operation is stopped. Update workshop state, e.g.
129 /// hides the property panel and udpate the command status.
130 /// \param theOpertion a stopped operation
131 void onOperationStopped(ModuleBase_Operation* theOperation);
136 XGUI_Module* loadModule(const QString& theModule);
137 bool activateModule();
139 QDockWidget* createObjectBrowser(QWidget* theParent);
140 QDockWidget* createPropertyPanel(QWidget* theParent);
142 // Creates Dock widgets: Object browser and Property panel
143 void createDockWidgets();
145 QString myCurrentFile;
146 XGUI_MainWindow* myMainWindow;
147 XGUI_Module* myPartSetModule;
148 XGUI_ObjectsBrowser* myObjectBrowser;
149 XGUI_PropertyPanel* myPropertyPanel;
150 XGUI_SelectionMgr* mySelector;
151 XGUI_Displayer* myDisplayer;
152 XGUI_OperationMgr* myOperationMgr; ///< manager to manipulate through the operations
153 XGUI_ActionsMgr* myActionsMgr;
154 XGUI_SalomeConnector* mySalomeConnector;
155 XGUI_ErrorDialog* myErrorDlg;
156 XGUI_ViewerProxy* myViewerProxy;