1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // Author : Guillaume Boulant (EDF)
25 #include "MEDOPModule.hxx"
26 #include "QtHelper.hxx"
28 #include <SALOMEconfig.h>
29 #include CORBA_CLIENT_HEADER(SALOMEDS)
31 #include "MEDOPFactoryClient.hxx"
33 MEDOPModule::MEDOPModule() :
35 LightApp_Module("MED")
37 // Note that the explicit call to the constructor of LightApp_Module
38 // is needed because the class LightApp_Module does not have
39 // canonical constructor (with no arguments).
41 // Note also that we can't use the getApp() function here because
42 // the initialize(...) function has not been called yet.
44 this->setModuleName("MED");
48 // =====================================================================
49 // This part implements the mandatory interface
50 // =====================================================================
54 * Returns the engine of the XMED module, i.e. the SALOME component
55 * associated to the study root of the module.
57 Engines::EngineComponent_ptr MEDOPModule::getEngine() const {
58 return MEDOPFactoryClient::getFactory();
62 * Returns the base file name of the image used for the icon's
63 * module. The file is supposed to be located in the resource
64 * directory of the module.
66 QString MEDOPModule::studyIconName() {
67 return QString("MEDOP_small.png");
71 // =====================================================================
72 // This part add custom widgets (a dockwidget containing a tree view
73 // in this example) and add special actions in the toolbox of the
75 // =====================================================================
79 * This function implements the interface StandardApp_Module. It
80 * creates the widgets specific for this module, in particular the
81 * workspace widget and the dataspace widget.
83 void MEDOPModule::createModuleWidgets() {
84 _datasourceController = new DatasourceController(this);
85 _workspaceController = new WorkspaceController(this);
86 _xmedDataModel = new XmedDataModel();
87 _workspaceController->setDataModel(_xmedDataModel);
89 connect(_datasourceController, SIGNAL(datasourceSignal(const DatasourceEvent *)),
90 _workspaceController, SLOT(processDatasourceEvent(const DatasourceEvent *)));
93 bool MEDOPModule::activateModule( SUIT_Study* theStudy )
95 bool bOk = StandardApp_Module::activateModule( theStudy );
96 _workspaceController->showDockWidgets(true);
97 this->setDockLayout(StandardApp_Module::DOCKLAYOUT_LEFT_VLARGE);
100 bool MEDOPModule::deactivateModule( SUIT_Study* theStudy )
102 _workspaceController->showDockWidgets(false);
103 this->unsetDockLayout();
104 return StandardApp_Module::deactivateModule( theStudy );
107 void MEDOPModule::createModuleActions() {
108 // Creating actions concerning the dataspace
109 _datasourceController->createActions();
110 // Creating actions concerning the workspace
111 _workspaceController->createActions();