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;
24 class XGUI_ViewerProxy;
26 class ModuleBase_Operation;
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 { return myDisplayer; }
61 //! ! Returns operation manager.
62 XGUI_OperationMgr* operationMgr() const { return myOperationMgr; }
64 //! ! Returns an actions manager
65 XGUI_ActionsMgr* actionsMgr() const { return myActionsMgr; };
67 //! Returns property panel widget
68 QDockWidget* propertyPanel() const { return myPropertyPanelDock; }
70 //! Creates and adds a new workbench (menu group) with the given name and returns it
71 XGUI_Workbench* addWorkbench(const QString& theName);
73 //! Redefinition of Events_Listener method
74 virtual void processEvent(const Events_Message* theMessage);
76 //! Returns an object which provides interface to Salome Module (LightApp_Module)
77 XGUI_SalomeConnector* salomeConnector() const { return mySalomeConnector; }
79 //! Provides an object which provides interface to Salome Viewer
80 XGUI_SalomeViewer* salomeViewer() const;
82 //! Returns true if the application works as SALOME module
83 bool isSalomeMode() const { return mySalomeConnector != 0; }
85 //! Returns Object browser
86 XGUI_ObjectsBrowser* objectBrowser() const { return myObjectBrowser; }
88 void salomeViewerSelectionChanged();
90 XGUI_ViewerProxy* viewer() const { return myViewerProxy; }
93 void salomeViewerSelection();
96 void updateCommandStatus();
106 void showPropertyPanel();
107 void hidePropertyPanel();
108 void showObjectBrowser();
109 void hideObjectBrowser();
111 void onFeatureTriggered();
112 void changeCurrentDocument();
115 void errorOccurred(const QString&);
118 //Event-loop processing methods:
119 void addFeature(const Config_FeatureMessage*);
120 void connectWithOperation(ModuleBase_Operation* theOperation);
121 void saveDocument(QString theName);
124 /// SLOT, that is called after the operation is started. Update workshop state according to
125 /// the started operation, e.g. visualizes the property panel and connect to it.
126 void onOperationStarted();
127 /// SLOT, that is called after the operation is stopped. Update workshop state, e.g.
128 /// hides the property panel and udpate the command status.
129 /// \param theOpertion a stopped operation
130 void onOperationStopped(ModuleBase_Operation* theOperation);
135 XGUI_Module* loadModule(const QString& theModule);
136 bool activateModule();
138 QDockWidget* createObjectBrowser(QWidget* theParent);
139 QDockWidget* createPropertyPanel(QWidget* theParent);
141 // Creates Dock widgets: Object browser and Property panel
142 void createDockWidgets();
143 void setPropertyPannelTitle(const QString& theTitle);
145 QString myCurrentFile;
146 XGUI_MainWindow* myMainWindow;
147 XGUI_Module* myPartSetModule;
148 XGUI_ObjectsBrowser* myObjectBrowser;
149 QDockWidget* myPropertyPanelDock;
150 XGUI_SelectionMgr* mySelector;
151 XGUI_Displayer* myDisplayer;
152 XGUI_OperationMgr* myOperationMgr; ///< manager to manipulate through the operations
153 XGUI_ActionsMgr* myActionsMgr;
154 XGUI_SalomeConnector* mySalomeConnector;
155 XGUI_ErrorDialog* myErrorDlg;
156 XGUI_ViewerProxy* myViewerProxy;