1 #ifndef XGUI_WORKSHOP_H
2 #define XGUI_WORKSHOP_H
5 #include "XGUI_Constants.h"
6 #include <Events_Listener.h>
7 #include <ModuleBase_Definitions.h>
12 #include <QKeySequence>
15 class XGUI_MainWindow;
18 class XGUI_SelectionMgr;
20 class XGUI_OperationMgr;
21 class XGUI_SalomeConnector;
22 class XGUI_ObjectsBrowser;
23 class XGUI_ActionsMgr;
24 class XGUI_ErrorDialog;
25 class XGUI_SalomeViewer;
26 class XGUI_ViewerProxy;
27 class XGUI_PropertyPanel;
28 class XGUI_ContextMenuMgr;
29 class XGUI_ModuleConnector;
31 class ModuleBase_Operation;
32 class ModuleBase_IModule;
34 class Config_FeatureMessage;
35 class Config_PointerMessage;
40 /**\class XGUI_Workshop
42 * \brief Class which defines a configuration of the application (Workshop) and launches it.
44 class XGUI_EXPORT XGUI_Workshop: public QObject, public Events_Listener
49 XGUI_Workshop(XGUI_SalomeConnector* theConnector = 0);
50 virtual ~XGUI_Workshop();
52 //! Starting of the application
53 void startApplication();
55 //! Returns main window (Desktop) of the application
56 XGUI_MainWindow* mainWindow() const
61 //! Returns selection manager object
62 XGUI_SelectionMgr* selector() const { return mySelector; }
65 XGUI_Displayer* displayer() const { return myDisplayer; }
67 //! ! Returns operation manager.
68 XGUI_OperationMgr* operationMgr() const { return myOperationMgr; }
70 //! ! Returns an actions manager
71 XGUI_ActionsMgr* actionsMgr() const { return myActionsMgr; };
73 //! Returns property panel widget
74 XGUI_PropertyPanel* propertyPanel() const { return myPropertyPanel; }
76 //! Returns context menu manager object
77 XGUI_ContextMenuMgr* contextMenuMgr() const { return myContextMenuMgr; }
79 //! Creates and adds a new workbench (menu group) with the given name and returns it
80 XGUI_Workbench* addWorkbench(const QString& theName);
82 //! Redefinition of Events_Listener method
83 virtual void processEvent(const Events_Message* theMessage);
85 //! Returns an object which provides interface to Salome Module (LightApp_Module)
86 XGUI_SalomeConnector* salomeConnector() const { return mySalomeConnector; }
88 //! Provides an object which provides interface to Salome Viewer
89 XGUI_SalomeViewer* salomeViewer() const;
91 //! Returns true if the application works as SALOME module
92 bool isSalomeMode() const { return mySalomeConnector != 0; }
94 //! Returns Object browser
95 XGUI_ObjectsBrowser* objectBrowser() const { return myObjectBrowser; }
97 void salomeViewerSelectionChanged();
99 XGUI_ViewerProxy* viewer() const { return myViewerProxy; }
101 /// Returns the module connectory
102 /// \returns the instance of connector
103 XGUI_ModuleConnector* moduleConnector() const { return myModuleConnector; }
105 //! Returns icon name according to feature Id
106 static QString featureIcon(const std::string& theId);
108 //! Activates or deactivates a part
109 //! If PartPtr is Null pointer then PartSet will be activated
110 void activatePart(FeaturePtr theFeature);
113 void deleteFeatures(QFeatureList theList);
115 //! Show the given features in 3d Viewer
116 void showFeatures(QFeatureList theList, bool isVisible);
119 void salomeViewerSelection();
120 void errorOccurred(const QString&);
123 void updateCommandStatus();
124 void updateModuleCommands();
134 void showPropertyPanel();
135 void hidePropertyPanel();
136 void showObjectBrowser();
137 void hideObjectBrowser();
139 void onFeatureTriggered();
140 void changeCurrentDocument(FeaturePtr thePart);
142 void activateLastPart();
145 //Event-loop processing methods:
146 void addFeature(const Config_FeatureMessage*);
147 void connectWithOperation(ModuleBase_Operation* theOperation);
148 void saveDocument(QString theName);
151 /// SLOT, that is called after the operation is started. Update workshop state according to
152 /// the started operation, e.g. visualizes the property panel and connect to it.
153 void onOperationStarted();
154 /// SLOT, that is called after the operation is stopped. Update workshop state, e.g.
155 /// hides the property panel and udpate the command status.
156 /// \param theOpertion a stopped operation
157 void onOperationStopped(ModuleBase_Operation* theOperation);
159 void onContextMenuCommand(const QString& theId, bool isChecked);
161 void onWidgetValuesChanged();
166 ModuleBase_IModule* loadModule(const QString& theModule);
167 bool activateModule();
169 QDockWidget* createObjectBrowser(QWidget* theParent);
170 QDockWidget* createPropertyPanel(QWidget* theParent);
172 // Creates Dock widgets: Object browser and Property panel
173 void createDockWidgets();
175 XGUI_MainWindow* myMainWindow;
176 ModuleBase_IModule* myPartSetModule;
177 XGUI_ObjectsBrowser* myObjectBrowser;
178 XGUI_PropertyPanel* myPropertyPanel;
179 XGUI_SelectionMgr* mySelector;
180 XGUI_Displayer* myDisplayer;
181 XGUI_OperationMgr* myOperationMgr; ///< manager to manipulate through the operations
182 XGUI_ActionsMgr* myActionsMgr;
183 XGUI_SalomeConnector* mySalomeConnector;
184 XGUI_ErrorDialog* myErrorDlg;
185 XGUI_ViewerProxy* myViewerProxy;
186 XGUI_ContextMenuMgr* myContextMenuMgr;
187 XGUI_ModuleConnector* myModuleConnector;
189 QString myCurrentDir;
190 static QMap<QString, QString> myIcons;