1 #ifndef __BLOCKITEM_H__
2 #define __BLOCKITEM_H__
9 #include <QtXmlPatterns>
12 #include "AbstractBoxItem.h"
13 class AbstractBoxItem;
19 #include "Exception.h"
26 A BoxItem may represent a functional block or a group block within a group item, itslef
27 within a scene. What says what it represents is refBlock, i.e. if refBlock->isFunctionalBlock()
28 or refBlock->isGroupBlock() returns true.
30 class BoxItem : public AbstractBoxItem {
33 BoxItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params, GroupItem* parent) throw(Exception);
34 BoxItem(Dispatcher *_dispatcher, Parameters *_params, GroupItem* parent) throw(Exception);
37 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
40 inline GroupItem *getChildGroupItem() { return childGroupItem; }
43 inline void setChildGroupItem(GroupItem* item) { childGroupItem = item; }
50 void moveTo(QPointF dest);
51 void loadFunctional(QDomElement funcElement) throw(Exception);
52 void save(QXmlStreamWriter& writer);
56 void updateMinimumSize(); // modify the minimum size
57 bool updateGeometry(ChangeType type); // modify the originPoint and the total dimension
59 void mousePressEvent(QGraphicsSceneMouseEvent *event);
60 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
61 void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
62 void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
63 void hoverMoveEvent( QGraphicsSceneHoverEvent *event);
68 A BlockItem is always graphically within a GroupItem, inside the same scene.
70 A BlockItem may also be the graphical view of a GroupBlock. In this case, there exists a child scene
71 containing a GroupItem. insideGroup atribute refers to this GroupItem and thus, may be NULL if the current
72 blockItem represents a functional block
74 GroupItem *childGroupItem;
77 friend QDataStream &operator<<(QDataStream &out, BoxItem &b);
78 friend QDataStream &operator>>(QDataStream &in, BoxItem &b);
82 void itemMustBeDeleted(QGraphicsItem*);
87 QDataStream & operator <<(QDataStream &out, BoxItem &b);
88 QDataStream & operator >>(QDataStream &in, BoxItem &b);
90 #endif // __BLOCKITEM_H__