enum ChangeType { Resize = 0, InterfaceMove };
AbstractBoxItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params, QGraphicsItem* parent = Q_NULLPTR);
+ AbstractBoxItem(Dispatcher *_dispatcher, Parameters *_params, QGraphicsItem* parent = Q_NULLPTR);
virtual ~AbstractBoxItem();
inline QPointF getOriginPoint() { return originPoint; }
// setters
- inline void setId(int id){ this->id = id; }
+ void setRefBlock(AbstractBlock* _refBlock);
+ inline void setId(int _id){ id = _id; }
inline void setSelected(bool _selected) { selected = _selected; }
- inline void setRstClkVisible(bool b){ rstClkVisible = b;}
+ void setRstClkVisible(bool b);
+ void setWishboneVisible(bool b);
void setDimension(int x, int y);
inline void setCurrentInterface(InterfaceItem* iface) { currentInterface = iface; }
virtual bool isGroupItem();
inline bool isSelected() { return selected; }
inline bool isRstClkVisible(){ return rstClkVisible;}
+ inline bool isWishboneVisible(){ return wishboneVisible;}
bool isInterfaces(int orientation) const;
// others
+ virtual void interfaceRenamed() = 0;
void addInterface(InterfaceItem* i, bool resetPosition = false);
void removeInterface(InterfaceItem* i);
void resetInterfacesPosition();
- void deplaceInterface(QPointF pos);
+ /*!
+ * \brief moveInterfaceTo
+ * \param pos the new position (in scene) of the interface
+ *
+ * This method is called when user moves an InterfaceItem.
+ * see BoxItem::mouseMoveEvent() and GroupItem::mouseMoveEvent()
+ */
+ void moveInterfaceTo(QPointF pos);
+ /*!
+ * \brief updateInterfacesAndConnections
+ *
+ * This method allows to recompute the absolute position of the interfaces of this box
+ * taking into account their relative position (see positionRatio atribute) in the width/height
+ * of the box border they are located on. It allows update the shape of all ConnectionItem
+ * connected to this box.
+ *
+ * CAUTION: this method supposes that before its call, a call to prepareGeometryChange() hase been
+ * done for the BoxItem that owns this InterfaceItem, so that the scene will readraw automatically
+ * the BoxItem. For the connections, the call to prepareGeometryChange() is done within setPath()
+ * that is called in this method. Thus, there is no need to call update() after the termination of
+ * this method.
+ */
void updateInterfacesAndConnections();
InterfaceItem *searchInterfaceByName(QString name);
QPointF originPoint; // the left-top point that is the origin of the bounding box
bool selected;
- bool rstClkVisible;
+ bool rstClkVisible; //! true if clock/reset interfaces are visible
+ bool wishboneVisible; //! true if wishbone interfaces are visible
QPointF currentPosition; // the start point for resize