Salome HOME
[MEDCalc] Multiple slices + other minor imps:
[modules/med.git] / src / MEDCalc / gui / MEDWidgetHelper.hxx
1 // Copyright (C) 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 #ifndef SRC_MEDCALC_GUI_MEDWIDGETHELPER_HXX_
21 #define SRC_MEDCALC_GUI_MEDWIDGETHELPER_HXX_
22
23 #include "WidgetPresentationParameters.hxx"
24 #include "PresentationEvent.hxx"
25
26 #include <SALOMEconfig.h>
27 #include CORBA_SERVER_HEADER(MEDPresentationManager)
28
29 class WidgetPresentationParameters;
30 class PresentationController;
31
32 /*!
33  * The widget helper hierarchy is in charge of seting up the WidgetPresentationParameters
34  * to display the Qt widgets relevant to the underlying presentation on the component side.
35  */
36 class MEDWidgetHelper : public QObject
37 {
38   Q_OBJECT
39
40 public:
41   virtual ~MEDWidgetHelper();
42
43   virtual void updateWidget(bool connect);
44   virtual void releaseWidget();
45
46   ///! Returns the string X in the Python command "Update<X>" or "Get<X>Parameters"
47   virtual std::string getPythonTag() const = 0;
48
49 signals:
50   void presentationUpdateSignal(const PresentationEvent *);
51
52 protected:
53   // Only child classes to be instanciated:
54   MEDWidgetHelper(const PresentationController* presController,
55                   MEDCALC::MEDPresentationManager_ptr presManager, int presId, const std::string & presName,
56                   WidgetPresentationParameters * paramWidget);
57   virtual void loadParametersFromEngine();
58
59 protected slots:
60   void onComponentChanged(int idx);
61   void onColorMapChanged(int idx);
62   void onScalarBarRangeChanged(int idx);
63
64 protected:
65   ///! GUI needs to talk directly to the pres manager to activate a view, get some params, etc ...:
66   MEDCALC::MEDPresentationManager_ptr _presManager;
67   const PresentationController * _presController  ;
68   const int _presId;
69   const std::string _presName;
70
71   WidgetPresentationParameters* _paramWidget;
72
73   // Component related members
74   int _selectedCompo;                  // Selected field component
75   int _nbCompos;                       // Total number of available components
76   std::vector<std::string> _allCompos; // All available components
77
78   // Color map
79   MEDCALC::ColorMapType _colorMap;
80
81   // Scalar bar range
82   MEDCALC::ScalarBarRangeType _scalarBarRange;
83 };
84
85 #endif