Salome HOME
59beda3f265060733b88533b8bf3c20fab91a7ab
[modules/med.git] / src / MEDCalc / gui / MEDModule.hxx
1 // Copyright (C) 2007-2020  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                            int actionid=-1);
81   void addActionInPopupMenu(int actionId,
82                             const QString& menus="",
83                             const QString& rule="client='ObjectBrowser'");
84
85 //  MEDCALC::ViewModeType getSelectedViewMode() const;
86 //  MEDCALC::ColorMapType getSelectedColorMap() const;
87 //  MEDCALC::ScalarBarRangeType getSelectedScalarBarRange() const;
88
89   inline SALOME_AppStudyEditor* getStudyEditor() { return _studyEditor; }
90   void requestSALOMETermination() const;
91
92   bool itemClickGeneric(std::string& name, std::string& type, int& presId) const;
93
94   int getIntParamFromStudyEditor(SALOMEDS::SObject_var obj, const char* name);
95
96   double getCurrentAnimationTimestamp();
97
98 signals:
99   void presentationSelected(int presId, const QString& presType, const QString& presName);
100
101 public slots:
102   virtual bool activateModule(SUIT_Study* theStudy);
103   virtual bool deactivateModule(SUIT_Study* theStudy);
104   virtual void onDblClick(const QModelIndex& index);
105   virtual void onClick(const QModelIndex& index);
106
107 private:
108   void createModuleWidgets();
109   void createModuleActions();
110   void initToolbars();
111
112   static void init();
113
114 private:
115   SALOME_AppStudyEditor* _studyEditor;
116   DatasourceController* _datasourceController;
117   WorkspaceController* _workspaceController;
118   XmedDataModel* _xmedDataModel;
119   PresentationController* _presentationController;
120   ProcessingController* _processingController;
121
122   PVViewer_GUIElements*   _pvGuiElements;
123
124   static MED_ORB::MED_Gen_var _MED_engine;
125
126 #ifdef MED_HAS_QTTESTING
127   TestController * _testController;
128 #endif
129 };
130
131 #endif