00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef ITEMNODE_H
00023 #define ITEMNODE_H
00024
00025 #include "node.h"
00026 #include "../facade/itemproperties.h"
00027
00028 #ifndef DOXYGEN_IGNORE_THIS
00029
00030 class ItemProperties;
00031 class SlateWindow;
00032
00033 class ItemNode : public Node
00034 {
00035
00036 public:
00037 ItemNode(ItemProperties item, QString _name, SlateWindow *wind, QGraphicsItem * parent = 0, QGraphicsScene * scene = 0);
00038 ~ItemNode();
00039
00040 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
00041 QPointF scenePointPos(int point) const;
00042 QPointF scenePointPos(QString name, bool in) const;
00043 void updateLinksPos();
00044 QString propName(int point) const;
00045 int propPoint(QString name, bool in) const;
00046 int propType(int point) const;
00047 void insertProperty(int pos, QString name, int type, bool input, bool output);
00048 void insertProperty(QString name, int type, bool input, bool output);
00049 void removeProperty(QString name);
00050
00051 protected:
00052 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event);
00053 void mousePressEvent(QGraphicsSceneMouseEvent * event);
00054 void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
00055 void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
00056 QVariant itemChange(GraphicsItemChange change, const QVariant &value);
00057
00058 void markPoint(int point, bool validity);
00059 void unmarkPoint();
00060 bool isValidLink(ItemNode *fromNode, int fromPoint, ItemNode *toNode, int toPoint) const;
00061 void deleteProperty(int pos);
00062
00063 void delLastProp();
00064
00065 QRectF outlineRect() const;
00066 int roundness(double size) const;
00067 int pointAt(QPointF pos) const;
00068 virtual int insertPos() const;
00069
00070 ItemProperties itemProp;
00071 int numProp;
00072 SlateWindow *window;
00073 QRectF outlinerect;
00074
00075 int clickedPoint;
00076 QGraphicsLineItem *line;
00077 int externalMarkedPoint;
00078 ItemNode *externalMarkedItem;
00079 int markedPoint;
00080 bool markedValidity;
00081 };
00082
00083 #endif
00084 #endif