]> SALOME platform Git repositories - modules/yacs.git/blob - src/genericgui/SchemaDirLinksItem.cxx
Salome HOME
mergefrom branch BR_V511_PR tag mergeto_trunk_03feb09
[modules/yacs.git] / src / genericgui / SchemaDirLinksItem.cxx
1 //  Copyright (C) 2006-2008  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.
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 #include "SchemaDirLinksItem.hxx"
20 #include "SchemaLinkItem.hxx"
21 #include "SchemaModel.hxx"
22 #include "QtGuiContext.hxx"
23 #include "GuiEditor.hxx"
24
25 #include <QIcon>
26 #include <cassert>
27
28 //#define _DEVDEBUG_
29 #include "YacsTrace.hxx"
30
31 using namespace std;
32 using namespace YACS::ENGINE;
33 using namespace YACS::HMI;
34
35 SchemaDirLinksItem::SchemaDirLinksItem(SchemaItem *parent, QString label, Subject* subject)
36   : SchemaItem::SchemaItem(parent, label, subject)
37 {
38   _itemDeco.replace(YLabel, QIcon("icons:folder_cyan.png"));
39 }
40
41 void SchemaDirLinksItem::addLinkItem(Subject* subject)
42 {
43   DEBTRACE("SchemaDirLinksItem::addTypeItem");
44   SchemaModel *model = QtGuiContext::getQtCurrent()->getSchemaModel();
45   int nbsons = childCount();
46   model->beginInsertRows(modelIndex(), nbsons, nbsons);
47   SchemaItem *item = new SchemaLinkItem(this,
48                                         subject->getName().c_str(),
49                                         subject);
50   model->endInsertRows();
51 }
52
53 Qt::ItemFlags SchemaDirLinksItem::flags(const QModelIndex &index)
54 {
55   //DEBTRACE("SchemaDirLinksItem::flags");
56   return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
57 }
58
59 QVariant SchemaDirLinksItem::editionWhatsThis(int column) const
60 {
61 return "Links between ports or nodes under that block level appears in this folder.\n" \
62   "You can add data links (between ports) and control links (between nodes) " \
63   "by drag from origin (out node or out port) to destination (in node or in port) " \
64   "either in 2D graphic view or tree view.";
65 }
66