]> SALOME platform Git repositories - modules/med.git/blob - src/MEDCalc/gui/MEDModule.hxx
Salome HOME
[MEDCalc] selecting a presentation activates the proper view.
[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
36 #include <SALOMEconfig.h>
37 #include CORBA_CLIENT_HEADER(MED_Gen)
38 #include CORBA_SERVER_HEADER(MEDPresentationManager)
39
40 #include <QModelIndex>
41
42 class SalomeApp_Application;
43 class PVViewer_GUIElements;
44 class MEDPresentationManager_i;
45
46 /*!
47  * This class defines the gui of the MED module.
48  */
49 class MEDCALCGUI_EXPORT MEDModule: public SalomeApp_Module
50 {
51   Q_OBJECT
52
53   // ===========================================================
54   // This part implements the standard interface of a SALOME gui
55   // ===========================================================
56
57 public:
58   MEDModule();
59   ~MEDModule();
60
61   static MED_ORB::MED_Gen_var engine();
62
63   virtual void initialize(CAM_Application* app);
64   virtual QString engineIOR() const;
65
66   virtual QString iconName() const;
67
68   virtual void windows(QMap<int, int>& theMap) const;
69   virtual void viewManagers(QStringList& theList) const;
70
71   virtual void createPreferences();
72
73   int createStandardAction(const QString& label,
74                            QObject* slotobject,
75                            const char* slotmember,
76                            const QString& iconName,
77                            const QString& tooltip=QString());
78   void addActionInPopupMenu(int actionId,
79                             const QString& menus="",
80                             const QString& rule="client='ObjectBrowser'");
81
82   MEDCALC::MEDPresentationViewMode getSelectedViewMode();
83   MEDCALC::MEDPresentationColorMap getSelectedColorMap();
84
85   inline SALOME_AppStudyEditor* getStudyEditor() { return _studyEditor; }
86
87 public slots:
88   virtual bool activateModule(SUIT_Study* theStudy);
89   virtual bool deactivateModule(SUIT_Study* theStudy);
90   virtual void onDblClick(const QModelIndex& index);
91   virtual void onClick(const QModelIndex& index);
92
93
94
95 private:
96   void createModuleWidgets();
97   void createModuleActions();
98   void initToolbars();
99   bool itemClickGeneric(const QModelIndex & index, std::string & name, int & fieldId, int & presId) const;
100
101   static void init();
102
103 private:
104   SALOME_AppStudyEditor* _studyEditor;
105   DatasourceController* _datasourceController;
106   WorkspaceController* _workspaceController;
107   XmedDataModel* _xmedDataModel;
108   PresentationController* _presentationController;
109   ProcessingController* _processingController;
110   PVViewer_GUIElements*   _pvGuiElements;
111
112   static MED_ORB::MED_Gen_var _MED_engine;
113
114   // GUI needs to talk directly to the pres manager to activate a view, get some params, etc ...:
115   static MEDCALC::MEDPresentationManager_ptr _presManager;
116 };
117
118 #endif