Salome HOME
updated copyright message
[modules/med.git] / src / MEDCalc / gui / MEDModule.hxx
1 // Copyright (C) 2007-2023  CEA, EDF
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 class LightApp_Displayer;
48
49 /*!
50  * This class defines the gui of the MED module.
51  */
52 class MEDCALCGUI_EXPORT MEDModule: public SalomeApp_Module
53 {
54   Q_OBJECT
55
56   // ===========================================================
57   // This part implements the standard interface of a SALOME gui
58   // ===========================================================
59
60 public:
61   MEDModule();
62   ~MEDModule();
63
64   static MED_ORB::MED_Gen_var engine();
65
66   virtual void initialize(CAM_Application* app);
67   virtual QString engineIOR() const;
68
69   virtual QString iconName() const;
70
71   virtual void windows(QMap<int, int>& theMap) const;
72   virtual void viewManagers(QStringList& theList) const;
73
74   virtual void createPreferences();
75
76   int createStandardAction(const QString& label,
77                            QObject* slotobject,
78                            const char* slotmember,
79                            const QString& iconName,
80                            const QString& tooltip=QString(),
81                            int actionid=-1);
82   void addActionInPopupMenu(int actionId,
83                             const QString& menus="",
84                             const QString& rule="client='ObjectBrowser'");
85
86 //  MEDCALC::ViewModeType getSelectedViewMode() const;
87 //  MEDCALC::ColorMapType getSelectedColorMap() const;
88 //  MEDCALC::ScalarBarRangeType getSelectedScalarBarRange() const;
89
90   inline SALOME_AppStudyEditor* getStudyEditor() { return _studyEditor; }
91   void requestSALOMETermination() const;
92
93   bool itemClickGeneric(std::string& name, std::string& type, int& presId) const;
94
95   int getIntParamFromStudyEditor(SALOMEDS::SObject_var obj, const char* name);
96
97   double getCurrentAnimationTimestamp();
98
99   virtual LightApp_Displayer* displayer() override;
100
101   void updateVisibilityState(const bool all=true, const QStringList& entries = QStringList());
102
103   void visibilityStateUpdateOff();
104   void visibilityStateUpdateOn();
105
106 signals:
107   void presentationSelected(int presId, const QString& presType, const QString& presName);
108
109 public slots:
110   virtual bool activateModule(SUIT_Study* theStudy);
111   virtual bool deactivateModule(SUIT_Study* theStudy);
112   virtual void studyClosed( SUIT_Study* theStudy);
113   virtual void onDblClick(const QModelIndex& index);
114   virtual void onClick(const QModelIndex& index);
115
116 private:
117   void createModuleWidgets();
118   void createModuleActions();
119   void initToolbars();
120
121   static void init();
122
123 private:
124   SALOME_AppStudyEditor* _studyEditor;
125   DatasourceController* _datasourceController;
126   WorkspaceController* _workspaceController;
127   XmedDataModel* _xmedDataModel;
128   PresentationController* _presentationController;
129   ProcessingController* _processingController;
130
131   PVViewer_GUIElements*   _pvGuiElements;
132
133   static MED_ORB::MED_Gen_var _MED_engine;
134   
135   LightApp_Displayer*          _displayer;
136
137   bool _enableVisibilityStateUpdate;
138
139 #ifdef MED_HAS_QTTESTING
140   TestController * _testController;
141 #endif
142 };
143
144 #endif