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; }
33 inline QString getName() { return name; }
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 setName(QString name){ this->name = name; }
48 inline void setPositionRatio(double ratio) { positionRatio = ratio; }
49 inline void setOrientation(int _orientation){ orientation = _orientation; }
52 void addConnectionItem(ConnectionItem* item);
53 void removeConnectionItem(ConnectionItem* item);
54 bool canConnectWith(InterfaceItem* iface);
55 bool connectWith(InterfaceItem* iface);
56 void unconnectTo(InterfaceItem *iface);
57 void updatePosition();
59 AbstractBoxItem* owner;
60 ConnectedInterface* refInter;
67 QList<ConnectionItem*> connections; // the connection items that are bounded to this interface item
74 int position; // position in pixels on the "orientation side" of the owner
75 int orientation; // north, south, east, west
76 QPointF originPoint; // the point where starts the drawing (along the box border) NB : in the owner coordinates
77 int nameWidth; // the graphical width of the name, computed from default font metrics
78 int nameHeight; // the graphical height of the name, computed from default font metrics
80 friend QDataStream &operator<<(QDataStream &out, InterfaceItem *b);
81 friend QDataStream &operator>>(QDataStream &in, InterfaceItem &b);
85 QDataStream & operator <<(QDataStream &out, InterfaceItem *b);
86 QDataStream & operator >>(QDataStream &in, InterfaceItem &b);