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