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 {
34 enum Position { Left = 1, Right, Top, Bottom, Center};
35 enum SpanType { NoSpan = 0, HSpan = 1, VSpan = 2 };
37 BoxItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params, GroupItem* parent, LockType _lock = NoLock, SpanType _span = NoSpan, Position _hPos = Center, Position _vPos = Center) throw(Exception);
38 BoxItem(Dispatcher *_dispatcher, Parameters *_params, GroupItem* parent, LockType _lock = NoLock, SpanType _span = NoSpan, Position _hPos = Center, Position _vPos = Center) throw(Exception);
41 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
44 inline GroupItem *getChildGroupItem() { return childGroupItem; }
47 inline void setChildGroupItem(GroupItem* item) { childGroupItem = item; }
54 void moveTo(QPointF dest);
55 void loadFunctional(QDomElement funcElement) throw(Exception);
56 void save(QXmlStreamWriter& writer);
64 void updateMinimumSize(); // modify the minimum size
65 bool updateGeometry(ChangeType type); // modify the originPoint and the total dimension
67 void mousePressEvent(QGraphicsSceneMouseEvent *event);
68 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
69 void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
70 void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
71 void hoverMoveEvent( QGraphicsSceneHoverEvent *event);
76 A BoxItem is always graphically within a GroupItem, inside the same scene.
78 A BoxItem may also be the graphical view of a GroupBlock. In this case, there exists a child scene
79 containing a GroupItem. insideGroup atribute refers to this GroupItem and thus, may be NULL if the current
80 blockItem represents a functional block
82 GroupItem *childGroupItem;
85 friend QDataStream &operator<<(QDataStream &out, BoxItem &b);
86 friend QDataStream &operator>>(QDataStream &in, BoxItem &b);
90 void itemMustBeDeleted(QGraphicsItem*);
95 QDataStream & operator <<(QDataStream &out, BoxItem &b);
96 QDataStream & operator >>(QDataStream &in, BoxItem &b);
98 #endif // __BLOCKITEM_H__