X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/a7299f808c1906872b76aa62fb6d8276096c4ff5..1b7818e18ed7bcf3464e307b97c6e0e6d72cc69b:/AbstractBoxItem.h?ds=inline diff --git a/AbstractBoxItem.h b/AbstractBoxItem.h index fb2bdcc..84a4fbc 100644 --- a/AbstractBoxItem.h +++ b/AbstractBoxItem.h @@ -24,9 +24,10 @@ public: enum BorderType { NoBorder = 0, BorderEast, BorderNorth, BorderWest, BorderSouth, CornerSouthEast, Title}; enum ChangeType { Resize = 0, InterfaceMove }; + enum LockType { NoLock = 0, Position = 1, Dimension = 2, Interfaces = 4, Names = 8}; - AbstractBoxItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params, QGraphicsItem* parent = Q_NULLPTR); - AbstractBoxItem(Dispatcher *_dispatcher, Parameters *_params, QGraphicsItem* parent = Q_NULLPTR); + AbstractBoxItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params, LockType _lock = NoLock, QGraphicsItem* parent = Q_NULLPTR); + AbstractBoxItem(Dispatcher *_dispatcher, Parameters *_params, LockType _lock = NoLock, QGraphicsItem* parent = Q_NULLPTR); virtual ~AbstractBoxItem(); @@ -52,6 +53,15 @@ public: void setWishboneVisible(bool b); void setDimension(int x, int y); inline void setCurrentInterface(InterfaceItem* iface) { currentInterface = iface; } + inline void setLock(int _lock) { lock = _lock; } + inline void lockPosition() { lock = lock | Position; } + inline void unlockPosition() { lock = (lock&Position)^lock; } + inline void lockDimension() { lock = lock | Dimension; } + inline void unlockDimension() { lock = (lock&Dimension)^lock; } + inline void lockInterfaces() { lock = lock | Interfaces; } + inline void unlockInterfaces() { lock = (lock&Interfaces)^lock; } + inline void lockNames() { lock = lock | Names; } + inline void unlockNames() { lock = (lock&Names)^lock; } // testers virtual bool isBoxItem(); @@ -61,7 +71,10 @@ public: inline bool isRstClkVisible(){ return rstClkVisible;} inline bool isWishboneVisible(){ return wishboneVisible;} bool isInterfaces(int orientation) const; - + inline bool isPositionLock() { return (lock&Position)!=0?true:false; } + inline bool isDimensionLock() { return (lock&Dimension)!=0?true:false; } + inline bool isInterfacesLock() { return (lock&Interfaces)!=0?true:false; } + inline bool isNamesLock() { return (lock&Names)!=0?true:false; } // others QRectF boundingRectInScene(); virtual void nameChanged() = 0; // called when an interface or box name have changed @@ -123,6 +136,7 @@ protected: int ifaceMargin; // the margin around each side of interfaces' name QPointF originPoint; // the left-top point that is the origin of the bounding box, in the item coordinates + int lock; bool selected; bool rstClkVisible; //! true if clock/reset interfaces are visible bool wishboneVisible; //! true if wishbone interfaces are visible