Salome HOME
29964f79c3d920c35135dba897648bf19516d0b7
[modules/yacs.git] / src / genericgui / GuiEditor.hxx
1 // Copyright (C) 2006-2020  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 _GUIEDITOR_HXX_
21 #define _GUIEDITOR_HXX_
22
23
24 #include <QWidget>
25 #include <QString>
26 #include <string>
27
28 namespace YACS
29 {
30   namespace ENGINE
31   {
32     class Catalog;
33   };
34
35   namespace HMI
36   {
37     class Subject;
38     class SubjectNode;
39     class SubjectElementaryNode;
40     class SubjectComposedNode;
41     class SubjectDataPort;
42     class ItemMimeData;
43
44     class GuiEditor
45     {
46     public:
47       GuiEditor();
48       virtual ~GuiEditor();
49
50       void CreateNodeFromCatalog(const ItemMimeData* myData,
51                                  SubjectComposedNode *cnode,
52                                  bool createNewComponentInstance);
53       void AddTypeFromCatalog(const ItemMimeData* myData);
54       SubjectNode* CreateNode(std::string typeNode);
55       void CreateBloc();
56       void CreateForLoop();
57       void CreateForEachLoop(std::string type );
58       void CreateWhileLoop();
59       void CreateSwitch();
60       void CreateOptimizerLoop();
61       void CreateContainer();
62       void CreateHPContainer();
63       void CreateComponentInstance();
64
65       SubjectDataPort* CreateInputPort(SubjectElementaryNode* seNode,
66                                        std::string name,
67                                        YACS::ENGINE::Catalog *catalog,
68                                        std::string type = "double",
69                                        SubjectDataPort* before = 0);
70
71       SubjectDataPort* CreateOutputPort(SubjectElementaryNode* seNode, 
72                                         std::string name,
73                                         YACS::ENGINE::Catalog *catalog,
74                                         std::string type = "double",
75                                         SubjectDataPort* before = 0);
76       void DeleteSubject();
77       void DeleteSubject(Subject* parent,
78                          Subject* toRemove);
79
80       void CutSubject();
81       void CopySubject();
82       void PasteSubject();
83       void PutSubjectInBloc();
84       std::string PutGraphInBloc();
85       void PutGraphInNode(std::string typeNode);
86       void shrinkExpand(Qt::KeyboardModifiers kbModifiers = Qt::NoModifier);
87       void rebuildLinks();
88       void arrangeNodes(bool isRecursive);
89       void arrangeProc();
90       void showUndo(QWidget *parent = 0);
91       void showRedo(QWidget *parent = 0);
92       QString asciiFilter(const QString & name);
93
94     protected:
95       SubjectNode* _createNode(YACS::ENGINE::Catalog* catalog,
96                        SubjectComposedNode *cnode,
97                        std::string service,
98                        std::string compoName,
99                        bool createNewComponentInstance);
100       std::string _table;
101     };
102   }
103 }
104
105 #endif