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