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