1 #ifndef __INTERFACEITEM_H__
2 #define __INTERFACEITEM_H__
8 class ConnectedInterface;
22 InterfaceItem(double _position,
24 ConnectedInterface* _refInter,
25 AbstractBoxItem* _owner,
28 QRectF boundingRect() const;
29 void paint(QPainter *painter);
32 inline int getId() { return id; }
34 inline double getPositionRatio() { return positionRatio; }
35 inline double getPosition() { return position; }
36 inline int getOrientation() { return orientation; }
37 inline AbstractBoxItem *getOwner() { return owner; }
38 inline int getNameWidth() { return nameWidth; }
39 inline int getNameHeight() { return nameHeight; }
40 QString getStrOrientation();
41 static int getIntOrientation(QString str);
42 QPointF getEndPointInGroup();
45 void setOriginPoint();
46 inline void setId(int id){ this->id = id; }
47 inline void setPositionRatio(double ratio) { positionRatio = ratio; }
48 inline void setOrientation(int _orientation){ orientation = _orientation; }
51 void addConnectionItem(ConnectionItem* item);
52 void removeConnectionItem(ConnectionItem* item);
53 bool canConnectWith(InterfaceItem* iface);
54 bool connectWith(InterfaceItem* iface);
55 void unconnectTo(InterfaceItem *iface);
56 void updatePosition();
58 AbstractBoxItem* owner;
59 ConnectedInterface* refInter;
66 QList<ConnectionItem*> connections; // the connection items that are bounded to this interface item
72 int position; // position in pixels on the "orientation side" of the owner
73 int orientation; // north, south, east, west
74 QPointF originPoint; // the point where starts the drawing (along the box border) NB : in the owner coordinates
75 int nameWidth; // the graphical width of the name, computed from default font metrics
76 int nameHeight; // the graphical height of the name, computed from default font metrics
78 friend QDataStream &operator<<(QDataStream &out, InterfaceItem *b);
79 friend QDataStream &operator>>(QDataStream &in, InterfaceItem &b);
83 QDataStream & operator <<(QDataStream &out, InterfaceItem *b);
84 QDataStream & operator >>(QDataStream &in, InterfaceItem &b);