• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

rocs/RocsCore

  • sources
  • kde-4.12
  • kdeedu
  • rocs
  • RocsCore
Data.h
Go to the documentation of this file.
1 /*
2  This file is part of Rocs.
3  Copyright 2004-2011 Tomaz Canabrava <tomaz.canabrava@gmail.com>
4  Copyright 2012 Andreas Cord-Landwehr <cola@uni-paderborn.de>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef DATA_H
21 #define DATA_H
22 
23 #include "RocsCoreExport.h"
24 #include "CoreTypes.h"
25 #include "DataStructure.h"
26 #include "DataType.h"
27 
28 #include <QObject>
29 #include <QString>
30 #include <QtScript>
31 #include <QColor>
32 
33 class DataItem;
34 class Pointer;
35 class DataPrivate;
36 
40 class ROCSLIB_EXPORT Data : public QObject
41 {
42  Q_OBJECT
43  Q_PROPERTY(qreal x READ x WRITE setX)
44  Q_PROPERTY(qreal y READ y WRITE setY)
45  Q_PROPERTY(qreal width READ width WRITE setWidth)
46  Q_PROPERTY(int id READ identifier)
47  Q_PROPERTY(QVariant color READ color WRITE setColor)
48 
49 public:
58  static DataPtr create(DataStructurePtr dataStructure, int uniqueIdentifier, int dataType);
59 
63  virtual DataPtr getData() const;
64 
69  virtual ~Data();
70 
78  PointerPtr createPointer(DataPtr to);
79 
87  void addPointer(PointerPtr pointer);
88 
94  void remove(PointerPtr e);
95 
99  DataStructurePtr dataStructure() const;
100 
104  QScriptValue scriptValue() const;
105 
109  virtual void setEngine(QScriptEngine *_engine);
110 
114  QScriptEngine * engine() const;
115 
119  qreal x() const;
120 
124  qreal y() const;
125 
129  qreal width() const;
130 
134  QVariant color() const;
135 
139  QString icon() const;
140 
141  QList<QString> properties() const;
142 
146  bool isVisible() const;
147 
151  int identifier() const;
152 
156  int dataType() const;
157 
161  DataList adjacentDataList() const;
162 
166  PointerList pointerList() const;
167 
171  PointerList pointerList(DataPtr to) const;
172 
176  PointerList& inPointerList() const;
177 
181  PointerList& outPointerList() const;
182 
183 public Q_SLOTS:
184  void remove();
185 
190  void self_remove();
191  void setX(int x);
192  void setY(int y);
193  void setWidth(double w);
194  void setPos(qreal x, qreal y);
195  void setColor(const QVariant& s);
196  void setVisible(bool visible);
197  void setDataType(int dataType);
198 
206  void addDynamicProperty(const QString &property, const QVariant& value);
207 
213  void removeDynamicProperty(const QString &property);
214 
215  void updateDynamicProperty(const QString &property);
216 
217  void renameDynamicProperty(const QString &oldName, const QString &newName);
218 
226  void updatePointerList();
227 
228  QScriptValue type();
229  QScriptValue set_type(int type);
230  void add_property(const QString &name, const QString& value);
231  void remove_property(const QString &name);
232  QScriptValue adj_data();
233  QScriptValue adj_pointers();
234  QScriptValue adj_pointers(int pointerType);
235  QScriptValue input_pointers();
236  QScriptValue input_pointers(int pointerType);
237  QScriptValue output_pointers();
238  QScriptValue output_pointers(int pointerType);
239  QScriptValue connected_pointers(Data *n);
240 
241 Q_SIGNALS:
242  void removed();
243  void posChanged(const QPointF &p);
244  void widthChanged(double w);
245  void colorChanged(const QColor &c);
246  void visibilityChanged(bool visible);
247  void useColorChanged(bool b);
248  void dataTypeChanged(int dataType);
249  void pointerListChanged();
250  void propertyAdded(const QString &name);
251  void propertyRemoved(const QString &name);
252  void propertyChanged(const QString &name);
253 
254 protected:
258  Data(DataStructurePtr dataStructure, int uniqueIdentifer, int dataType);
259 
263  template<typename T>
264  static DataPtr create(DataStructurePtr parent, int uniqueIdentifier, int dataType) {
265  DataPtr pi(new T(parent, uniqueIdentifier, dataType));
266  pi->setQpointer(pi);
267  pi->initialize();
268  return pi;
269  }
270 
271  bool eventFilter(QObject *obj, QEvent *event);
272 
273 private:
278  const QScopedPointer<DataPrivate> d;
279 
284  void setQpointer(DataPtr q);
285 
286  void initialize();
287  Data(const Data&);
288  Data& operator=(const Data&);
289 };
290 
291 #endif
DataType.h
DataStructurePtr
boost::shared_ptr< DataStructure > DataStructurePtr
Definition: CoreTypes.h:38
DataList
QList< boost::shared_ptr< Data > > DataList
Definition: CoreTypes.h:30
CoreTypes.h
RocsCoreExport.h
QObject
PointerPtr
boost::shared_ptr< Pointer > PointerPtr
Definition: CoreTypes.h:35
DataStructure.h
ROCSLIB_EXPORT
#define ROCSLIB_EXPORT
Definition: RocsCoreExport.h:32
DataPtr
boost::shared_ptr< Data > DataPtr
Definition: CoreTypes.h:34
DataItem
Pointer
Pointers are connections between two nodes in the data structure.
Definition: Pointer.h:48
Data
Definition: Data.h:40
PointerList
QList< boost::shared_ptr< Pointer > > PointerList
Definition: CoreTypes.h:33
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:42:25 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

rocs/RocsCore

Skip menu "rocs/RocsCore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal