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;
27 class XGUI_ContextMenuMgr;
28 class XGUI_ModuleConnector;
30 class ModuleBase_Operation;
32 class Config_FeatureMessage;
33 class Config_PointerMessage;
38 /**\class XGUI_Workshop
40 * \brief Class which defines a configuration of the application (Workshop) and launches it.
42 class XGUI_EXPORT XGUI_Workshop: public QObject, public Events_Listener
47 XGUI_Workshop(XGUI_SalomeConnector* theConnector = 0);
48 virtual ~XGUI_Workshop();
50 //! Starting of the application
51 void startApplication();
53 //! Returns main window (Desktop) of the application
54 XGUI_MainWindow* mainWindow() const
59 //! Returns selection manager object
60 XGUI_SelectionMgr* selector() const { return mySelector; }
63 XGUI_Displayer* displayer() const { return myDisplayer; }
65 //! ! Returns operation manager.
66 XGUI_OperationMgr* operationMgr() const { return myOperationMgr; }
68 //! ! Returns an actions manager
69 XGUI_ActionsMgr* actionsMgr() const { return myActionsMgr; };
71 //! Returns property panel widget
72 XGUI_PropertyPanel* propertyPanel() const { return myPropertyPanel; }
74 //! Returns context menu manager object
75 XGUI_ContextMenuMgr* contextMenuMgr() const { return myContextMenuMgr; }
77 //! Creates and adds a new workbench (menu group) with the given name and returns it
78 XGUI_Workbench* addWorkbench(const QString& theName);
80 //! Redefinition of Events_Listener method
81 virtual void processEvent(const Events_Message* theMessage);
83 //! Returns an object which provides interface to Salome Module (LightApp_Module)
84 XGUI_SalomeConnector* salomeConnector() const { return mySalomeConnector; }
86 //! Provides an object which provides interface to Salome Viewer
87 XGUI_SalomeViewer* salomeViewer() const;
89 //! Returns true if the application works as SALOME module
90 bool isSalomeMode() const { return mySalomeConnector != 0; }
92 //! Returns Object browser
93 XGUI_ObjectsBrowser* objectBrowser() const { return myObjectBrowser; }
95 void salomeViewerSelectionChanged();
97 XGUI_ViewerProxy* viewer() const { return myViewerProxy; }
99 /// Returns the module connectory
100 /// \returns the instance of connector
101 XGUI_ModuleConnector* moduleConnector() const { return myModuleConnector; }
103 //! Returns icon name according to feature Id
104 static QString featureIcon(const std::string& theId);
106 //! Activates or deactivates a part
107 //! If PartPtr is Null pointer then PartSet will be activated
108 void activatePart(FeaturePtr theFeature);
111 void deleteFeatures(QFeatureList theList);
113 //! Show the given features in 3d Viewer
114 void showFeatures(QFeatureList theList, bool isVisible);
117 void salomeViewerSelection();
118 void errorOccurred(const QString&);
121 void updateCommandStatus();
131 void showPropertyPanel();
132 void hidePropertyPanel();
133 void showObjectBrowser();
134 void hideObjectBrowser();
136 void onFeatureTriggered();
137 void changeCurrentDocument(FeaturePtr thePart);
139 void activateLastPart();
142 //Event-loop processing methods:
143 void addFeature(const Config_FeatureMessage*);
144 void connectWithOperation(ModuleBase_Operation* theOperation);
145 void saveDocument(QString theName);
148 /// SLOT, that is called after the operation is started. Update workshop state according to
149 /// the started operation, e.g. visualizes the property panel and connect to it.
150 void onOperationStarted();
151 /// SLOT, that is called after the operation is stopped. Update workshop state, e.g.
152 /// hides the property panel and udpate the command status.
153 /// \param theOpertion a stopped operation
154 void onOperationStopped(ModuleBase_Operation* theOperation);
156 void onContextMenuCommand(const QString& theId, bool isChecked);
161 XGUI_Module* loadModule(const QString& theModule);
162 bool activateModule();
164 QDockWidget* createObjectBrowser(QWidget* theParent);
165 QDockWidget* createPropertyPanel(QWidget* theParent);
167 // Creates Dock widgets: Object browser and Property panel
168 void createDockWidgets();
170 XGUI_MainWindow* myMainWindow;
171 XGUI_Module* myPartSetModule;
172 XGUI_ObjectsBrowser* myObjectBrowser;
173 XGUI_PropertyPanel* myPropertyPanel;
174 XGUI_SelectionMgr* mySelector;
175 XGUI_Displayer* myDisplayer;
176 XGUI_OperationMgr* myOperationMgr; ///< manager to manipulate through the operations
177 XGUI_ActionsMgr* myActionsMgr;
178 XGUI_SalomeConnector* mySalomeConnector;
179 XGUI_ErrorDialog* myErrorDlg;
180 XGUI_ViewerProxy* myViewerProxy;
181 XGUI_ContextMenuMgr* myContextMenuMgr;
182 XGUI_ModuleConnector* myModuleConnector;
184 QString myCurrentDir;
185 static QMap<QString, QString> myIcons;