1 #ifndef XGUI_WORKSHOP_H
2 #define XGUI_WORKSHOP_H
5 #include <Events_Listener.h>
10 #include <QKeySequence>
12 class XGUI_MainWindow;
16 class XGUI_SelectionMgr;
18 class XGUI_OperationMgr;
19 class XGUI_SalomeConnector;
20 class XGUI_ObjectsBrowser;
21 class XGUI_ActionsMgr;
22 class XGUI_ErrorDialog;
23 class XGUI_SalomeViewer;
25 class ModuleBase_Operation;
26 class ModuleBase_PropPanelOperation;
28 class Config_FeatureMessage;
29 class Config_PointerMessage;
34 /**\class XGUI_Workshop
36 * \brief Class which defines a configuration of the application (Workshop) and launches it.
38 class XGUI_EXPORT XGUI_Workshop: public QObject, public Events_Listener
43 XGUI_Workshop(XGUI_SalomeConnector* theConnector = 0);
44 virtual ~XGUI_Workshop();
46 //! Starting of the application
47 void startApplication();
49 //! Returns main window (Desktop) of the application
50 XGUI_MainWindow* mainWindow() const
55 //! Returns selection manager object
56 XGUI_SelectionMgr* selector() const { return mySelector; }
59 XGUI_Displayer* displayer() const;
61 //! ! Returns operation manager.
62 XGUI_OperationMgr* operationMgr() const { return myOperationMgr; }
64 //! ! Returns an actions manager
65 XGUI_ActionsMgr* actionsMgr() const { return myActionsMgr; };
67 //! Creates and adds a new workbench (menu group) with the given name and returns it
68 XGUI_Workbench* addWorkbench(const QString& theName);
70 //! Redefinition of Events_Listener method
71 virtual void processEvent(const Events_Message* theMessage);
73 //! Returns an object which provides interface to Salome Module (LightApp_Module)
74 XGUI_SalomeConnector* salomeConnector() const { return mySalomeConnector; }
76 //! Provides an object which provides interface to Salome Viewer
77 XGUI_SalomeViewer* salomeViewer() const;
79 //! Returns true if the application works as SALOME module
80 bool isSalomeMode() const { return mySalomeConnector != 0; }
82 //! Returns Object browser
83 XGUI_ObjectsBrowser* objectBrowser() const { return myObjectBrowser; }
85 void salomeViewerSelectionChanged();
88 void salomeViewerSelection();
91 void updateCommandStatus();
101 void showPropertyPanel();
102 void hidePropertyPanel();
103 void showObjectBrowser();
104 void hideObjectBrowser();
106 void onFeatureTriggered();
107 void changeCurrentDocument();
110 void errorOccurred(const QString&);
113 //Event-loop processing methods:
114 void addFeature(const Config_FeatureMessage*);
115 void connectWithOperation(ModuleBase_Operation* theOperation);
116 void saveDocument(QString theName);
119 /// SLOT, that is called after the operation is started. Update workshop state according to
120 /// the started operation, e.g. visualizes the property panel and connect to it.
121 void onOperationStarted();
122 /// SLOT, that is called after the operation is stopped. Update workshop state, e.g.
123 /// hides the property panel and udpate the command status.
124 /// \param theOpertion a stopped operation
125 void onOperationStopped(ModuleBase_Operation* theOperation);
130 XGUI_Module* loadModule(const QString& theModule);
131 bool activateModule();
133 QDockWidget* createObjectBrowser(QWidget* theParent);
134 QDockWidget* createPropertyPanel(QWidget* theParent);
136 // Creates Dock widgets: Object browser and Property panel
137 void createDockWidgets();
138 void setPropertyPannelTitle(const QString& theTitle);
140 QString myCurrentFile;
141 XGUI_MainWindow* myMainWindow;
142 XGUI_Module* myPartSetModule;
143 XGUI_ObjectsBrowser* myObjectBrowser;
144 QDockWidget* myPropertyPanelDock;
145 XGUI_SelectionMgr* mySelector;
146 XGUI_Displayer* myDisplayer;
147 XGUI_OperationMgr* myOperationMgr; ///< manager to manipulate through the operations
148 XGUI_ActionsMgr* myActionsMgr;
149 XGUI_SalomeConnector* mySalomeConnector;
150 XGUI_ErrorDialog* myErrorDlg;