X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/abbc64cf04a35ab3549d5c516f44c7c5921baa63..2bdaa0aa3fab52f0808f60d9bbdabcd56d0efae9:/BoxItem.h?ds=sidebyside diff --git a/BoxItem.h b/BoxItem.h index 74eb36a..ee4070a 100644 --- a/BoxItem.h +++ b/BoxItem.h @@ -5,6 +5,8 @@ #include #include +#include +#include #include "AbstractBoxItem.h" @@ -28,29 +30,43 @@ using namespace Qt; class BoxItem : public AbstractBoxItem { public: - BoxItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params, GroupItem* parent) throw(Exception); + + enum Position { Free = 0, Left , Right, Top, Bottom, TopLeft, BottomLeft, TopRight, BottomRight }; // if not Free, glue the box to the desired border + enum SpanType { NoSpan = 0, HSpan = 1, VSpan = 2 }; + + BoxItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params, GroupItem* parent, int _lock = NoLock, SpanType _span = NoSpan, Position _position = Free) throw(Exception); + BoxItem(Dispatcher *_dispatcher, Parameters *_params, GroupItem* parent, int _lock = NoLock, SpanType _span = NoSpan, Position _position = Free) throw(Exception); ~BoxItem(); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); // getters inline GroupItem *getChildGroupItem() { return childGroupItem; } + inline Position getPosition() { return position; } + inline SpanType getSpan() { return span; } // setters inline void setChildGroupItem(GroupItem* item) { childGroupItem = item; } + inline void setPosition(Position _position) { position = _position; } + inline void setSpan(SpanType _span) { span = _span; } // testers bool isBoxItem(); // others + void nameChanged(); void moveTo(QPointF dest); + void loadFunctional(QDomElement funcElement) throw(Exception); void save(QXmlStreamWriter& writer); -protected: - void updateMinimumSize(); // modify the minimum size bool updateGeometry(ChangeType type); // modify the originPoint and the total dimension +protected: + + SpanType span; + Position position; + void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event); @@ -60,9 +76,9 @@ protected: private: /* NOTE : - A BlockItem is always graphically within a GroupItem, inside the same scene. + A BoxItem is always graphically within a GroupItem, inside the same scene. - A BlockItem may also be the graphical view of a GroupBlock. In this case, there exists a child scene + A BoxItem may also be the graphical view of a GroupBlock. In this case, there exists a child scene containing a GroupItem. insideGroup atribute refers to this GroupItem and thus, may be NULL if the current blockItem represents a functional block */ @@ -72,9 +88,11 @@ private: friend QDataStream &operator<<(QDataStream &out, BoxItem &b); friend QDataStream &operator>>(QDataStream &in, BoxItem &b); +/* signals: void itemMustBeDeleted(QGraphicsItem*); - +*/ + }; QDataStream & operator <<(QDataStream &out, BoxItem &b);