Salome HOME
9cbfc070cec9909deabb0bc6ce23b03617529bbc
[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 <Python.h>
26 #include "MEDCALCGUI.hxx"
27
28 #include <SalomeApp_Module.h>
29 #include <SALOME_AppStudyEditor.hxx>
30
31 #include "WorkspaceController.hxx"
32 #include "XmedDataModel.hxx"
33 #include "DatasourceController.hxx"
34 #include "PresentationController.hxx"
35 #include "ProcessingController.hxx"
36 #include "TestController.hxx"
37
38 #include <SALOMEconfig.h>
39 #include CORBA_CLIENT_HEADER(MED_Gen)
40 #include CORBA_SERVER_HEADER(MEDPresentationManager)
41
42 #include <QModelIndex>
43
44 class SalomeApp_Application;
45 class PVViewer_GUIElements;
46 class MEDPresentationManager_i;
47
48 /*!
49  * This class defines the gui of the MED module.
50  */
51 class MEDCALCGUI_EXPORT MEDModule: public SalomeApp_Module
52 {
53   Q_OBJECT
54
55   // ===========================================================
56   // This part implements the standard interface of a SALOME gui
57   // ===========================================================
58
59 public:
60   MEDModule();
61   ~MEDModule();
62
63   static MED_ORB::MED_Gen_var engine();
64
65   virtual void initialize(CAM_Application* app);
66   virtual QString engineIOR() const;
67
68   virtual QString iconName() const;
69
70   virtual void windows(QMap<int, int>& theMap) const;
71   virtual void viewManagers(QStringList& theList) const;
72
73   virtual void createPreferences();
74
75   int createStandardAction(const QString& label,
76                            QObject* slotobject,
77                            const char* slotmember,
78                            const QString& iconName,
79                            const QString& tooltip=QString());
80   void addActionInPopupMenu(int actionId,
81                             const QString& menus="",
82                             const QString& rule="client='ObjectBrowser'");
83
84 //  MEDCALC::ViewModeType getSelectedViewMode() const;
85 //  MEDCALC::ColorMapType getSelectedColorMap() const;
86 //  MEDCALC::ScalarBarRangeType getSelectedScalarBarRange() const;
87
88   inline SALOME_AppStudyEditor* getStudyEditor() { return _studyEditor; }
89   void requestSALOMETermination() const;
90
91   bool itemClickGeneric(std::string& name, std::string& type, int& presId) const;
92
93   int getIntParamFromStudyEditor(SALOMEDS::SObject_var obj, const char* name);
94
95 signals:
96   void presentationSelected(int presId, const QString& presType, const QString& presName);
97
98 public slots:
99   virtual bool activateModule(SUIT_Study* theStudy);
100   virtual bool deactivateModule(SUIT_Study* theStudy);
101   virtual void onDblClick(const QModelIndex& index);
102   virtual void onClick(const QModelIndex& index);
103
104 private:
105   void createModuleWidgets();
106   void createModuleActions();
107   void initToolbars();
108
109   static void init();
110
111 private:
112   SALOME_AppStudyEditor* _studyEditor;
113   DatasourceController* _datasourceController;
114   WorkspaceController* _workspaceController;
115   XmedDataModel* _xmedDataModel;
116   PresentationController* _presentationController;
117   ProcessingController* _processingController;
118
119   PVViewer_GUIElements*   _pvGuiElements;
120
121   static MED_ORB::MED_Gen_var _MED_engine;
122
123 #ifdef MED_HAS_QTTESTING
124   TestController * _testController;
125 #endif
126 };
127
128 #endif