Version: 8.3.0
ItemMimeData.cxx
Go to the documentation of this file.
1 // Copyright (C) 2006-2016 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 #include "ItemMimeData.hxx"
21 #include "guiObservers.hxx"
22 #include "Catalog.hxx"
23 
24 #include <QStringList>
25 
26 //#define _DEVDEBUG_
27 #include "YacsTrace.hxx"
28 
29 using namespace std;
30 using namespace YACS::ENGINE;
31 using namespace YACS::HMI;
32 
33 ItemMimeData::ItemMimeData(): QMimeData()
34 {
35  _sub.clear();
36  _catalog.clear();
37  _cataName.clear();
38  _compoName.clear();
39  _typeName.clear();
40  _swCase=0;
41  _control=false;
42 }
43 
45 {
46 }
47 
49 {
50  _sub.push_back(sub);
51 }
52 
54 {
55  _catalog.push_back(cata);
56 }
57 
58 void ItemMimeData::setCataName(std::string cataName)
59 {
60  _cataName.push_back(cataName);
61 }
62 
63 void ItemMimeData::setCompo(std::string compo)
64 {
65  _compoName.push_back(compo);
66 }
67 
68 void ItemMimeData::setType(std::string aType)
69 {
70  _typeName.push_back(aType);
71 }
72 
73 void ItemMimeData::setCase(int aCase)
74 {
75  _swCase = aCase;
76 }
77 
79 {
80  YASSERT(i < _sub.size());
81  return _sub[i];
82 }
83 
85 {
86  YASSERT(i < _catalog.size());
87  return _catalog[i];
88 }
89 
90 std::string ItemMimeData::getCataName(int i) const
91 {
92  YASSERT(i < _cataName.size());
93  return _cataName[i];
94 }
95 
96 std::string ItemMimeData::getCompo(int i) const
97 {
98  YASSERT(i < _compoName.size());
99  return _compoName[i];
100 }
101 
102 std::string ItemMimeData::getType(int i) const
103 {
104  YASSERT(i < _typeName.size());
105  return _typeName[i];
106 }
107 
109 {
110  return _swCase;
111 }
112 void ItemMimeData::setControl(bool control)
113 {
114  _control=control;
115 }
117 {
118  return _control;
119 }
120 
122 {
123  int lg=0;
124  QStringList myFormats = formats();
125  for (int i=0; i<myFormats.size(); i++)
126  {
127  if (myFormats[i].contains("yacs/cata"))
128  {
129  lg = _cataName.size();
130  break;
131  }
132  else
133  {
134  lg = _sub.size();
135  break;
136  }
137  }
138  return lg;
139 }