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;
29 class ModuleBase_Operation;
31 class Config_FeatureMessage;
32 class Config_PointerMessage;
37 /**\class XGUI_Workshop
39 * \brief Class which defines a configuration of the application (Workshop) and launches it.
41 class XGUI_EXPORT XGUI_Workshop: public QObject, public Events_Listener
46 XGUI_Workshop(XGUI_SalomeConnector* theConnector = 0);
47 virtual ~XGUI_Workshop();
49 //! Starting of the application
50 void startApplication();
52 //! Returns main window (Desktop) of the application
53 XGUI_MainWindow* mainWindow() const
58 //! Returns selection manager object
59 XGUI_SelectionMgr* selector() const { return mySelector; }
62 XGUI_Displayer* displayer() const { return myDisplayer; }
64 //! ! Returns operation manager.
65 XGUI_OperationMgr* operationMgr() const { return myOperationMgr; }
67 //! ! Returns an actions manager
68 XGUI_ActionsMgr* actionsMgr() const { return myActionsMgr; };
70 //! Returns property panel widget
71 XGUI_PropertyPanel* propertyPanel() const { return myPropertyPanel; }
73 //! Returns context menu manager object
74 XGUI_ContextMenuMgr* contextMenuMgr() const { return myContextMenuMgr; }
76 //! Creates and adds a new workbench (menu group) with the given name and returns it
77 XGUI_Workbench* addWorkbench(const QString& theName);
79 //! Redefinition of Events_Listener method
80 virtual void processEvent(const Events_Message* theMessage);
82 //! Returns an object which provides interface to Salome Module (LightApp_Module)
83 XGUI_SalomeConnector* salomeConnector() const { return mySalomeConnector; }
85 //! Provides an object which provides interface to Salome Viewer
86 XGUI_SalomeViewer* salomeViewer() const;
88 //! Returns true if the application works as SALOME module
89 bool isSalomeMode() const { return mySalomeConnector != 0; }
91 //! Returns Object browser
92 XGUI_ObjectsBrowser* objectBrowser() const { return myObjectBrowser; }
94 void salomeViewerSelectionChanged();
96 XGUI_ViewerProxy* viewer() const { return myViewerProxy; }
98 //! Returns icon name according to feature Id
99 static QString featureIcon(const std::string& theId);
101 //! Activates or deactivates a part
102 //! If PartPtr is Null pointer then PartSet will be activated
103 void activatePart(FeaturePtr theFeature);
105 void deleteFeatures(QFeatureList theList);
108 void salomeViewerSelection();
109 void errorOccurred(const QString&);
112 void updateCommandStatus();
122 void showPropertyPanel();
123 void hidePropertyPanel();
124 void showObjectBrowser();
125 void hideObjectBrowser();
127 void onFeatureTriggered();
128 void changeCurrentDocument(FeaturePtr thePart);
130 void activateLastPart();
133 //Event-loop processing methods:
134 void addFeature(const Config_FeatureMessage*);
135 void connectWithOperation(ModuleBase_Operation* theOperation);
136 void saveDocument(QString theName);
139 /// SLOT, that is called after the operation is started. Update workshop state according to
140 /// the started operation, e.g. visualizes the property panel and connect to it.
141 void onOperationStarted();
142 /// SLOT, that is called after the operation is stopped. Update workshop state, e.g.
143 /// hides the property panel and udpate the command status.
144 /// \param theOpertion a stopped operation
145 void onOperationStopped(ModuleBase_Operation* theOperation);
147 void onContextMenuCommand(const QString& theId, bool isChecked);
152 XGUI_Module* loadModule(const QString& theModule);
153 bool activateModule();
155 QDockWidget* createObjectBrowser(QWidget* theParent);
156 QDockWidget* createPropertyPanel(QWidget* theParent);
158 // Creates Dock widgets: Object browser and Property panel
159 void createDockWidgets();
161 XGUI_MainWindow* myMainWindow;
162 XGUI_Module* myPartSetModule;
163 XGUI_ObjectsBrowser* myObjectBrowser;
164 XGUI_PropertyPanel* myPropertyPanel;
165 XGUI_SelectionMgr* mySelector;
166 XGUI_Displayer* myDisplayer;
167 XGUI_OperationMgr* myOperationMgr; ///< manager to manipulate through the operations
168 XGUI_ActionsMgr* myActionsMgr;
169 XGUI_SalomeConnector* mySalomeConnector;
170 XGUI_ErrorDialog* myErrorDlg;
171 XGUI_ViewerProxy* myViewerProxy;
172 XGUI_ContextMenuMgr* myContextMenuMgr;
174 QString myCurrentDir;
175 static QMap<QString, QString> myIcons;