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);
103 void salomeViewerSelection();
106 void updateCommandStatus();
116 void showPropertyPanel();
117 void hidePropertyPanel();
118 void showObjectBrowser();
119 void hideObjectBrowser();
121 void onFeatureTriggered();
122 void changeCurrentDocument(FeaturePtr thePart);
125 void errorOccurred(const QString&);
128 //Event-loop processing methods:
129 void addFeature(const Config_FeatureMessage*);
130 void connectWithOperation(ModuleBase_Operation* theOperation);
131 void saveDocument(QString theName);
134 /// SLOT, that is called after the operation is started. Update workshop state according to
135 /// the started operation, e.g. visualizes the property panel and connect to it.
136 void onOperationStarted();
137 /// SLOT, that is called after the operation is stopped. Update workshop state, e.g.
138 /// hides the property panel and udpate the command status.
139 /// \param theOpertion a stopped operation
140 void onOperationStopped(ModuleBase_Operation* theOperation);
142 void onContextMenuCommand(const QString& theId, bool isChecked);
147 XGUI_Module* loadModule(const QString& theModule);
148 bool activateModule();
150 QDockWidget* createObjectBrowser(QWidget* theParent);
151 QDockWidget* createPropertyPanel(QWidget* theParent);
153 // Creates Dock widgets: Object browser and Property panel
154 void createDockWidgets();
156 //! Activates or deactivates currently selected part
157 void activatePart(bool toActivate);
159 QString myCurrentFile;
160 XGUI_MainWindow* myMainWindow;
161 XGUI_Module* myPartSetModule;
162 XGUI_ObjectsBrowser* myObjectBrowser;
163 XGUI_PropertyPanel* myPropertyPanel;
164 XGUI_SelectionMgr* mySelector;
165 XGUI_Displayer* myDisplayer;
166 XGUI_OperationMgr* myOperationMgr; ///< manager to manipulate through the operations
167 XGUI_ActionsMgr* myActionsMgr;
168 XGUI_SalomeConnector* mySalomeConnector;
169 XGUI_ErrorDialog* myErrorDlg;
170 XGUI_ViewerProxy* myViewerProxy;
171 XGUI_ContextMenuMgr* myContextMenuMgr;
173 static QMap<QString, QString> myIcons;