1 #ifndef XGUI_WORKSHOP_H
2 #define XGUI_WORKSHOP_H
5 #include "XGUI_Constants.h"
6 #include <Events_Listener.h>
11 #include <QKeySequence>
13 class XGUI_MainWindow;
17 class XGUI_SelectionMgr;
19 class XGUI_OperationMgr;
20 class XGUI_SalomeConnector;
21 class XGUI_ObjectsBrowser;
22 class XGUI_ActionsMgr;
23 class XGUI_ErrorDialog;
24 class XGUI_SalomeViewer;
25 class XGUI_ViewerProxy;
26 class XGUI_PropertyPanel;
28 class ModuleBase_Operation;
30 class Config_FeatureMessage;
31 class Config_PointerMessage;
36 /**\class XGUI_Workshop
38 * \brief Class which defines a configuration of the application (Workshop) and launches it.
40 class XGUI_EXPORT XGUI_Workshop: public QObject, public Events_Listener
45 XGUI_Workshop(XGUI_SalomeConnector* theConnector = 0);
46 virtual ~XGUI_Workshop();
48 //! Starting of the application
49 void startApplication();
51 //! Returns main window (Desktop) of the application
52 XGUI_MainWindow* mainWindow() const
57 //! Returns selection manager object
58 XGUI_SelectionMgr* selector() const { return mySelector; }
61 XGUI_Displayer* displayer() const { return myDisplayer; }
63 //! ! Returns operation manager.
64 XGUI_OperationMgr* operationMgr() const { return myOperationMgr; }
66 //! ! Returns an actions manager
67 XGUI_ActionsMgr* actionsMgr() const { return myActionsMgr; };
69 //! Returns property panel widget
70 XGUI_PropertyPanel* propertyPanel() const { return myPropertyPanel; }
72 //! Creates and adds a new workbench (menu group) with the given name and returns it
73 XGUI_Workbench* addWorkbench(const QString& theName);
75 //! Redefinition of Events_Listener method
76 virtual void processEvent(const Events_Message* theMessage);
78 //! Returns an object which provides interface to Salome Module (LightApp_Module)
79 XGUI_SalomeConnector* salomeConnector() const { return mySalomeConnector; }
81 //! Provides an object which provides interface to Salome Viewer
82 XGUI_SalomeViewer* salomeViewer() const;
84 //! Returns true if the application works as SALOME module
85 bool isSalomeMode() const { return mySalomeConnector != 0; }
87 //! Returns Object browser
88 XGUI_ObjectsBrowser* objectBrowser() const { return myObjectBrowser; }
90 void salomeViewerSelectionChanged();
92 XGUI_ViewerProxy* viewer() const { return myViewerProxy; }
94 //! Returns icon name according to feature Id
95 static QString featureIcon(const std::string& theId);
99 void salomeViewerSelection();
102 void updateCommandStatus();
112 void showPropertyPanel();
113 void hidePropertyPanel();
114 void showObjectBrowser();
115 void hideObjectBrowser();
117 void onFeatureTriggered();
118 void changeCurrentDocument(FeaturePtr thePart);
121 void errorOccurred(const QString&);
124 //Event-loop processing methods:
125 void addFeature(const Config_FeatureMessage*);
126 void connectWithOperation(ModuleBase_Operation* theOperation);
127 void saveDocument(QString theName);
130 /// SLOT, that is called after the operation is started. Update workshop state according to
131 /// the started operation, e.g. visualizes the property panel and connect to it.
132 void onOperationStarted();
133 /// SLOT, that is called after the operation is stopped. Update workshop state, e.g.
134 /// hides the property panel and udpate the command status.
135 /// \param theOpertion a stopped operation
136 void onOperationStopped(ModuleBase_Operation* theOperation);
141 XGUI_Module* loadModule(const QString& theModule);
142 bool activateModule();
144 QDockWidget* createObjectBrowser(QWidget* theParent);
145 QDockWidget* createPropertyPanel(QWidget* theParent);
147 // Creates Dock widgets: Object browser and Property panel
148 void createDockWidgets();
150 QString myCurrentFile;
151 XGUI_MainWindow* myMainWindow;
152 XGUI_Module* myPartSetModule;
153 XGUI_ObjectsBrowser* myObjectBrowser;
154 XGUI_PropertyPanel* myPropertyPanel;
155 XGUI_SelectionMgr* mySelector;
156 XGUI_Displayer* myDisplayer;
157 XGUI_OperationMgr* myOperationMgr; ///< manager to manipulate through the operations
158 XGUI_ActionsMgr* myActionsMgr;
159 XGUI_SalomeConnector* mySalomeConnector;
160 XGUI_ErrorDialog* myErrorDlg;
161 XGUI_ViewerProxy* myViewerProxy;
163 static QMap<QString, QString> myIcons;