Salome HOME
c53e6458a93e641367a016acdb9986db4143e8aa
[modules/med.git] / src / MEDCalc / gui / MEDModule.hxx
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // Author : Guillaume Boulant (EDF)
21
22 #ifndef _MED_MODULE_HXX_
23 #define _MED_MODULE_HXX_
24
25 #include "MEDCALCGUI.hxx"
26
27 #include <SalomeApp_Module.h>
28 #include <SALOME_AppStudyEditor.hxx>
29
30 #include "WorkspaceController.hxx"
31 #include "XmedDataModel.hxx"
32 #include "DatasourceController.hxx"
33 #include "PresentationController.hxx"
34 #include "ProcessingController.hxx"
35 #include "TestController.hxx"
36
37 #include <SALOMEconfig.h>
38 #include CORBA_CLIENT_HEADER(MED_Gen)
39 #include CORBA_SERVER_HEADER(MEDPresentationManager)
40
41 #include <QModelIndex>
42
43 class SalomeApp_Application;
44 class PVViewer_GUIElements;
45 class MEDPresentationManager_i;
46
47 /*!
48  * This class defines the gui of the MED module.
49  */
50 class MEDCALCGUI_EXPORT MEDModule: public SalomeApp_Module
51 {
52   Q_OBJECT
53
54   // ===========================================================
55   // This part implements the standard interface of a SALOME gui
56   // ===========================================================
57
58 public:
59   MEDModule();
60   ~MEDModule();
61
62   static MED_ORB::MED_Gen_var engine();
63
64   virtual void initialize(CAM_Application* app);
65   virtual QString engineIOR() const;
66
67   virtual QString iconName() const;
68
69   virtual void windows(QMap<int, int>& theMap) const;
70   virtual void viewManagers(QStringList& theList) const;
71
72   virtual void createPreferences();
73
74   int createStandardAction(const QString& label,
75                            QObject* slotobject,
76                            const char* slotmember,
77                            const QString& iconName,
78                            const QString& tooltip=QString());
79   void addActionInPopupMenu(int actionId,
80                             const QString& menus="",
81                             const QString& rule="client='ObjectBrowser'");
82
83 //  MEDCALC::ViewModeType getSelectedViewMode() const;
84 //  MEDCALC::ColorMapType getSelectedColorMap() const;
85 //  MEDCALC::ScalarBarRangeType getSelectedScalarBarRange() const;
86
87   inline SALOME_AppStudyEditor* getStudyEditor() { return _studyEditor; }
88   void requestSALOMETermination() const;
89
90 signals:
91   void presentationSelected(int presId, const QString& presType, const QString& presName);
92
93 public slots:
94   virtual bool activateModule(SUIT_Study* theStudy);
95   virtual bool deactivateModule(SUIT_Study* theStudy);
96   virtual void onDblClick(const QModelIndex& index);
97   virtual void onClick(const QModelIndex& index);
98
99 private:
100   void createModuleWidgets();
101   void createModuleActions();
102   void initToolbars();
103
104   bool itemClickGeneric(const QModelIndex & index, std::string & name,
105                         std::string & type, int & fieldId, int & presId) const;
106
107   static void init();
108
109 private:
110   SALOME_AppStudyEditor* _studyEditor;
111   DatasourceController* _datasourceController;
112   WorkspaceController* _workspaceController;
113   XmedDataModel* _xmedDataModel;
114   PresentationController* _presentationController;
115   ProcessingController* _processingController;
116
117   PVViewer_GUIElements*   _pvGuiElements;
118
119   static MED_ORB::MED_Gen_var _MED_engine;
120
121   // GUI needs to talk directly to the pres manager to activate a view, get some params, etc ...:
122   static MEDCALC::MEDPresentationManager_ptr _presManager;
123
124 #ifdef MED_HAS_QTTESTING
125   TestController * _testController;
126 #endif
127 };
128
129 #endif