X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/e5af659f87bcb199d6a5f10f09b311138351d0f3..14cd6d834ab531525a51c6a6992583b3e9143e02:/AbstractBoxItem.h?ds=sidebyside diff --git a/AbstractBoxItem.h b/AbstractBoxItem.h index ed3e1ee..fb2bdcc 100644 --- a/AbstractBoxItem.h +++ b/AbstractBoxItem.h @@ -14,6 +14,10 @@ class AbstractBlock; class GroupScene; class ConnectedInterface; +#define ABI_TO_BI(ptr) ((BoxItem*)ptr) +#define ABI_TO_GI(ptr) ((GroupItem*)ptr) +#define ABI_TO_SI(ptr) ((SourceItem*)ptr) + class AbstractBoxItem : public QGraphicsItem { public: @@ -51,18 +55,19 @@ public: // testers virtual bool isBoxItem(); - virtual bool isGroupItem(); + virtual bool isGroupItem(); + virtual bool isSourceItem(); 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(); + QRectF boundingRectInScene(); + virtual void nameChanged() = 0; // called when an interface or box name have changed + void addInterfaceItem(InterfaceItem* i, bool resetPosition = false); + void removeInterfaceItem(InterfaceItem* i); + void resetInterfaceItemsPosition(); /*! * \brief moveInterfaceTo * \param pos the new position (in scene) of the interface @@ -70,7 +75,7 @@ public: * This method is called when user moves an InterfaceItem. * see BoxItem::mouseMoveEvent() and GroupItem::mouseMoveEvent() */ - void moveInterfaceTo(QPointF pos); + void moveInterfaceItemTo(QPointF pos); /*! * \brief updateInterfacesAndConnections * @@ -85,11 +90,11 @@ public: * that is called in this method. Thus, there is no need to call update() after the termination of * this method. */ - void updateInterfacesAndConnections(); + void updateInterfaceAndConnectionItems(); - InterfaceItem *searchInterfaceByName(QString name); - InterfaceItem *searchInterfaceByRef(ConnectedInterface* ref); - InterfaceItem* getInterfaceFromCursor(qreal x, qreal y); + InterfaceItem *searchInterfaceItemByName(QString name); + InterfaceItem *searchInterfaceItemByRef(ConnectedInterface* ref); + InterfaceItem* getInterfaceItemFromCursor(qreal x, qreal y); protected: Dispatcher *dispatcher; @@ -116,13 +121,13 @@ protected: int nameHeight; // the height of the name in Arial 10 int nameMargin; // the margin around each side of the name int ifaceMargin; // the margin around each side of interfaces' name - QPointF originPoint; // the left-top point that is the origin of the bounding box + QPointF originPoint; // the left-top point that is the origin of the bounding box, in the item coordinates bool selected; bool rstClkVisible; //! true if clock/reset interfaces are visible bool wishboneVisible; //! true if wishbone interfaces are visible - QPointF currentPosition; // the start point for resize + QPointF currentPosition; // the start point for resize, i.e. the position of the lef-top corner of the box, in the scene coordinates virtual void updateMinimumSize() = 0; // modify the minimum size virtual bool updateGeometry(ChangeType type) = 0; // modify the originPoint and the total dimension @@ -131,8 +136,9 @@ protected: /* pure virtual method inherited from QGraphicsItem : virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) =0; virtual QRectF boundingRect() const =0; - */ - void initInterfaces(); + */ + + void initInterfaceItems(); int nbInterfacesByOrientation(int orientation); };