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 int numProps() const;
00044 void updateLinksPos();
00045 QString propName(int point) const;
00046 int propPoint(QString name, bool in) const;
00047 int propType(int point) const;
00048 void insertProperty(int pos, QString name, int type, bool input, bool output);
00049 void insertProperty(QString name, int type, bool input, bool output);
00050 void removeProperty(QString name);
00051
00052 protected:
00053 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event);
00054 void mousePressEvent(QGraphicsSceneMouseEvent * event);
00055 void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
00056 void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
00057 QVariant itemChange(GraphicsItemChange change, const QVariant &value);
00058
00059 void markPoint(int point, bool validity);
00060 void unmarkPoint();
00061 bool isValidLink(ItemNode *fromNode, int fromPoint, ItemNode *toNode, int toPoint) const;
00062 void deleteProperty(int pos);
00063
00064 void delLastProp();
00065
00066 QRectF outlineRect() const;
00067 int roundness(double size) const;
00068 int pointAt(QPointF pos) const;
00069 virtual int insertPos() const;
00070
00071 ItemProperties itemProp;
00072 int numProp;
00073 SlateWindow *window;
00074 QRectF outlinerect;
00075
00076 int clickedPoint;
00077 QGraphicsLineItem *line;
00078 int externalMarkedPoint;
00079 ItemNode *externalMarkedItem;
00080 int markedPoint;
00081 bool markedValidity;
00082
00083 double lineSpacing;
00084 };
00085
00086 #endif
00087 #endif