Salome HOME
[MEDCalc] Manage color maps
[modules/med.git] / src / MEDCalc / gui / WorkspaceController.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 _WORKSPACE_CONTROLLER_HXX
23 #define _WORKSPACE_CONTROLLER_HXX
24
25 #include "TreeGuiManager.hxx"
26 #include "MEDEventListener_i.hxx"
27 #include "XmedConsoleDriver.hxx"
28 #include "DatasourceController.hxx"
29 #include "PresentationController.hxx"
30 #include "MEDCALCGUI.hxx"
31
32 #include <SALOMEconfig.h>
33 #include CORBA_CLIENT_HEADER(MEDDataManager)
34 #include <SalomeApp_Module.h>
35
36 #include <vector>
37
38 class MEDModule;
39
40 /*!
41  * This class defines a DockWidget plugged in the SALOME application,
42  * and containing a tree view for rendering a hierarchical data
43  * model. This datamodel contains the objects used in the workspace.
44  */
45 class MEDCALCGUI_EXPORT WorkspaceController: public TreeGuiManager {
46
47   Q_OBJECT
48
49 public:
50   WorkspaceController(MEDModule* salomeModule);
51   ~WorkspaceController();
52
53   void createActions();
54
55 public slots:
56   // Slots overiding TreeGuiManager
57   void processItemList(QStringList itemNameIdList, int actionId);
58
59   // Internal slots
60   void processMedEvent(const MEDCALC::MedEvent* event);
61   void processDatasourceEvent(const DatasourceEvent* event);
62   void processPresentationEvent(const PresentationEvent* event);
63   void OnSaveWorkspace();
64   void OnCleanWorkspace();
65
66 signals:
67   void workspaceSignal(const MEDCALC::MedEvent* event);
68
69 private:
70   void _importItem(QString itemNameId);
71   void _importItemList(QStringList itemNameIdList);
72   void _importFieldIntoConsole(MEDCALC::FieldHandler* fieldHandler,
73                                bool askForOptions,
74                                const char* alias=NULL);
75
76   void _exportItemList(QStringList itemNameIdList);
77   void _saveItemList(QStringList itemNameIdList);
78   void _removeItemList(QStringList itemNameIdList);
79   void _viewItemList(QStringList itemNameIdList);
80   QString _getViewMode();
81   QString _getColorMap();
82
83 private:
84   XmedConsoleDriver* _consoleDriver;
85   MEDModule* _salomeModule;
86   MEDEventListener_i* _medEventListener;
87
88   // This structure is intended to memorized in a bundle the whole set
89   // of integers identifying the actions of the popup menu associated
90   // to the TreeView embedded in this TreeGuiManager
91   typedef struct {
92     int display;
93     int useInTui;
94     int exportToPv;
95     int remove;
96     int save;
97   } ActionIdentifiers;
98
99   ActionIdentifiers _actionIds;
100
101 };
102
103 #endif // _WORKSPACE_CONTROLLER_HXX