• 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
Pointer.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 2010-2011 Wagner Reck <wagner.reck@gmail.com>
5  Copyright 2012 Andreas Cord-Landwehr <cola@uni-paderborn.de>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef POINTER_H
22 #define POINTER_H
23 
24 #include "PointerType.h"
25 #include <QObject>
26 #include <QtScript>
27 #include <QString>
28 #include <QColor>
29 #include <QScriptValue>
30 
31 #include "RocsCoreExport.h"
32 #include "CoreTypes.h"
33 
34 class Data;
35 class PointerPrivate;
36 class DataStructure;
37 class QtScriptBackend;
38 
39 
48 class ROCSLIB_EXPORT Pointer : public QObject
49 {
50  Q_OBJECT
51 
52  Q_PROPERTY(QScriptValue from READ start)
53  Q_PROPERTY(QScriptValue to READ end)
54  Q_PROPERTY(bool directed READ isDirected)
55  Q_PROPERTY(QColor color READ color WRITE setColor)
56  Q_PROPERTY(qreal width READ width WRITE setWidth)
57  Q_PROPERTY(int type READ pointerType)
58 
59 public:
69  static PointerPtr create(DataStructurePtr dataStructure, DataPtr from, DataPtr to, int pointerType);
70 
74  PointerPtr getPointer() const;
75 
80  virtual ~Pointer();
81 
85  PointerType::Direction direction() const;
86 
90  bool isDirected() const;
91 
95  DataStructurePtr dataStructure() const;
96 
106  int relativeIndex() const;
107 
112  QScriptValue scriptValue() const;
113 
117  void setEngine(QScriptEngine *engine);
118 
122  DataPtr from() const;
123 
127  DataPtr to() const;
128 
132  Q_INVOKABLE QScriptValue start() const;
133 
137  Q_INVOKABLE QScriptValue end() const;
138 
142  bool isVisible() const;
143 
147  QColor color() const;
148 
152  qreal width() const;
153 
157  int pointerType() const;
158 
162  Q_INVOKABLE void remove();
163 
168  Q_INVOKABLE void self_remove();
169 
177  Q_INVOKABLE QScriptValue set_type(int type);
178 
185  Q_INVOKABLE void add_property(const QString& name, const QString& value);
186 
191  Q_INVOKABLE void remove_property(const QString& name);
192 
193 Q_SIGNALS:
197  void removed();
198 
202  void changed();
203 
207  void posChanged();
208 
212  void pointerTypeChanged(int pointerType);
213 
217  void directionChanged(PointerType::Direction direction);
218 
219  void propertyAdded(const QString &name);
220  void propertyRemoved(const QString &name);
221  void propertyChanged(const QString &name);
222 
223 public Q_SLOTS:
228  void setPointerType(int pointerType);
229 
236  void setColor(const QColor &color);
237 
243  void setWidth(qreal width);
244 
248  Qt::PenStyle style() const;
249 
257  void addDynamicProperty(const QString& property, const QVariant& value);
258 
264  void removeDynamicProperty(const QString& property);
265 
266  void updateDynamicProperty(const QString& property);
267 
268  void renameDynamicProperty(const QString& oldName, const QString& newName);
269 
273  void updateRelativeIndex();
274 
275  QList<QString> properties() const;
276 
277  void setVisible(bool visible);
278 
282  QScriptValue type() const;
283 
284 protected:
293  Pointer(DataStructurePtr parent, DataPtr from, DataPtr to, int pointerType);
294 
298  template<typename T>
299  static PointerPtr create(DataStructurePtr parent, DataPtr from, DataPtr to, int pointerType) {
300  PointerPtr pi(new T(parent, from, to, pointerType));
301  pi->setQpointer(pi);
302  pi->initialize();
303  return pi;
304  }
305 
306  bool eventFilter(QObject *obj, QEvent *event);
307 
308 private:
313  const QScopedPointer<PointerPrivate> d;
314 
319  void setQpointer(PointerPtr q);
320 
321  void initialize();
322  Pointer(const Pointer&);
323  Pointer& operator=(const Pointer&);
324 };
325 
326 #endif
DataStructure
Definition: DataStructure.h:43
DataStructurePtr
boost::shared_ptr< DataStructure > DataStructurePtr
Definition: CoreTypes.h:38
CoreTypes.h
RocsCoreExport.h
QObject
PointerType
A pointer type groups a set of pointers and gives them a common appearance.
Definition: PointerType.h:41
PointerPtr
boost::shared_ptr< Pointer > PointerPtr
Definition: CoreTypes.h:35
QtScriptBackend
This class provides the script backend for script executions.
Definition: QtScriptBackend.h:40
ROCSLIB_EXPORT
#define ROCSLIB_EXPORT
Definition: RocsCoreExport.h:32
DataPtr
boost::shared_ptr< Data > DataPtr
Definition: CoreTypes.h:34
PointerType.h
Pointer
Pointers are connections between two nodes in the data structure.
Definition: Pointer.h:48
Data
Definition: Data.h:40
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:42:26 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