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; }
49 void moveTo(QPointF dest);
50 void loadFunctional(QDomElement funcElement) throw(Exception);
51 void save(QXmlStreamWriter& writer);
55 void updateMinimumSize(); // modify the minimum size
56 bool updateGeometry(ChangeType type); // modify the originPoint and the total dimension
58 void mousePressEvent(QGraphicsSceneMouseEvent *event);
59 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
60 void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
61 void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
62 void hoverMoveEvent( QGraphicsSceneHoverEvent *event);
67 A BlockItem is always graphically within a GroupItem, inside the same scene.
69 A BlockItem may also be the graphical view of a GroupBlock. In this case, there exists a child scene
70 containing a GroupItem. insideGroup atribute refers to this GroupItem and thus, may be NULL if the current
71 blockItem represents a functional block
73 GroupItem *childGroupItem;
76 friend QDataStream &operator<<(QDataStream &out, BoxItem &b);
77 friend QDataStream &operator>>(QDataStream &in, BoxItem &b);
80 void itemMustBeDeleted(QGraphicsItem*);
84 QDataStream & operator <<(QDataStream &out, BoxItem &b);
85 QDataStream & operator >>(QDataStream &in, BoxItem &b);
87 #endif // __BLOCKITEM_H__