1 // Copyright (C) 2006-2012 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
20 #include "SchemaLinkItem.hxx"
22 #include "DataStreamPort.hxx"
27 #include "YacsTrace.hxx"
30 using namespace YACS::HMI;
32 SchemaLinkItem::SchemaLinkItem(SchemaItem *parent, QString label, Subject* subject)
33 : SchemaItem(parent, label, subject)
35 switch (subject->getType())
37 case YACS::HMI::CONTROLLINK:
38 _itemDeco.replace(YLabel, QIcon("icons:control_link.png"));
40 case YACS::HMI::DATALINK:
41 _itemDeco.replace(YLabel, QIcon("icons:data_link.png"));
42 if (SubjectLink *slink = dynamic_cast<SubjectLink*>(subject))
44 if (dynamic_cast<YACS::ENGINE::DataStreamPort*>(slink->getSubjectOutPort()->getPort()))
45 _itemDeco.replace(YLabel, QIcon("icons:stream_link.png"));
49 _itemDeco.replace(YLabel, QIcon("icons:new_link.png"));
53 void SchemaLinkItem::update(GuiEvent event, int type, Subject* son)
55 DEBTRACE("SchemaLinkItem::update");
56 SchemaItem::update(event, type, son);
59 void SchemaLinkItem::popupMenu(QWidget *caller, const QPoint &globalPos)
62 m.popupMenu(caller, globalPos);
66 QVariant SchemaLinkItem::editionWhatsThis(int column) const
68 return "<p>Links between ports or nodes under that block level appears in this folder.\n" \
69 "You can add data links (between ports) and control links (between nodes) " \
70 "by drag from origin (out node or out port) to destination (in node or in port) " \
71 "either in 2D graphic view or tree view. <a href=\"modification.html#create-a-link\">More...</a></p>";