1 // Copyright (C) 2006-2008 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include "guiObservers.hxx"
24 #include "wiedittree.h"
25 #include <qlistview.h>
40 class ViewItem: public QListViewItem, public GuiObserver
43 ViewItem(QListView *parent, QString label, Subject* subject);
44 ViewItem(ViewItem *parent, QString label, Subject* subject);
46 void setState(int state);
47 virtual void paintCell( QPainter *p, const QColorGroup &cg,
48 int column, int width, int alignment );
49 virtual QListView *getParent();
50 virtual void select(bool isSelected);
51 virtual void update(GuiEvent event, int type, Subject* son);
52 virtual Subject* getSubject();
60 class editTree: public wiEditTree, public GuiObserver
66 void newNode(int key);
67 void newNode(YACS::ENGINE::Catalog* catalog,
69 std::pair<std::string,std::string> compoServ);
70 void newDataType(YACS::ENGINE::Catalog* catalog,
72 std::string typeName);
73 void newInputPort(int key);
74 void newOutputPort(int key);
75 void newDFInputPort();
76 void newDFOutputPort();
77 void newDSInputPort();
78 void newDSOutputPort();
79 void newDFInputPort(YACS::ENGINE::Catalog* catalog,
81 std::string typeName);
82 void newDFOutputPort(YACS::ENGINE::Catalog* catalog,
84 std::string typeName);
85 void newDSInputPort(YACS::ENGINE::Catalog* catalog,
87 std::string typeName);
88 void newDSOutputPort(YACS::ENGINE::Catalog* catalog,
90 std::string typeName);
92 void select(QListViewItem *it);
95 void editPortProperties();
97 void associateServiceToComponent();
99 void associateComponentToContainer();
100 void editContainerProperties();
101 void catalog(int cataType);
102 void setCatalog(int isproc);
104 editTree(YACS::HMI::Subject *context,
106 const char* name = 0,
109 virtual void update(GuiEvent event, int type, Subject* son);
110 void setNewRoot(YACS::HMI::Subject *root);
111 void addViewItemInMap(YACS::HMI::ViewItem* item, YACS::HMI::Subject* subject);
112 YACS::HMI::ViewItem* getViewItem(YACS::HMI::Subject* subject);
113 YACS::HMI::Subject* getSelectedSubject();
115 void contextMenuEvent ( QContextMenuEvent * );
116 void ComposedNodeContextMenu();
117 void NodeContextMenu();
118 void PortContextMenu();
119 void LinkContextMenu();
120 void ComponentContextMenu();
121 void ContainerContextMenu();
122 void resetTreeNode(QListView *lv);
126 QListViewItem *_previousSelected;
127 SubjectDataPort *_selectedSubjectOutPort;
128 SubjectNode *_selectedSubjectNode;
129 SubjectComponent *_selectedSubjectComponent;
130 SubjectServiceNode *_selectedSubjectService;
131 std::map<YACS::HMI::Subject*,YACS::HMI::ViewItem*> _viewItemsMap;
132 std::map<int, std::pair<YACS::ENGINE::Catalog*, std::string> > _catalogItemsMap;
136 class NodeViewItem: public ViewItem
139 NodeViewItem(ViewItem *parent, QString label, Subject* subject);
140 virtual void update(GuiEvent event, int type, Subject* son);
145 class ComposedNodeViewItem: public ViewItem
148 ComposedNodeViewItem(QListView *parent, QString label, Subject* subject);
149 ComposedNodeViewItem(ViewItem *parent, QString label, Subject* subject);
150 virtual void update(GuiEvent event, int type, Subject* son);
154 class PortViewItem: public ViewItem
157 PortViewItem(ViewItem *parent, QString label, Subject* subject);
158 virtual void update(GuiEvent event, int type, Subject* son);
162 class LinkViewItem: public ViewItem
165 LinkViewItem(ViewItem *parent, QString label, Subject* subject);
166 virtual void update(GuiEvent event, int type, Subject* son);
170 class ComponentViewItem: public ViewItem
173 ComponentViewItem(ViewItem *parent, QString label, Subject* subject);
174 virtual void update(GuiEvent event, int type, Subject* son);
178 class ContainerViewItem: public ViewItem
181 ContainerViewItem(ViewItem *parent, QString label, Subject* subject);
182 virtual void update(GuiEvent event, int type, Subject* son);
186 class DataTypeViewItem: public ViewItem
189 DataTypeViewItem(ViewItem *parent, QString label, Subject* subject);
190 virtual void update(GuiEvent event, int type, Subject* son);
194 class ReferenceViewItem: public ViewItem
197 ReferenceViewItem(ViewItem *parent, QString label, Subject* subject);
198 virtual void update(GuiEvent event, int type, Subject* son);