X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/abbc64cf04a35ab3549d5c516f44c7c5921baa63..e5af659f87bcb199d6a5f10f09b311138351d0f3:/AbstractBoxItem.h diff --git a/AbstractBoxItem.h b/AbstractBoxItem.h index 6eeb46c..ed3e1ee 100644 --- a/AbstractBoxItem.h +++ b/AbstractBoxItem.h @@ -22,6 +22,7 @@ public: 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(); @@ -40,9 +41,11 @@ public: 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; } @@ -51,14 +54,37 @@ public: 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); @@ -93,7 +119,8 @@ protected: 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