class AbstractBlock;
class GroupWidget;
class GroupItem;
+#include "BoxItem.h"
class BoxItem;
+class StimuliItem;
class AbstractBoxItem;
class ConnectionItem;
class InterfaceItem;
- AddGroup: while a new group (empty or from selected blocks) is created
- ItemEdtion: can move/resize blocks/interfaces, remove blocks/interface/group, ...
*/
- enum EditMode { InitState, AddBlock, AddConnection, AddGroup, ItemEdition };
+ enum EditMode { InitState, AddConnection, ItemEdition };
+
GroupScene(GroupScene* _parentScene, GroupWidget* _window, Dispatcher* _dispatcher, Parameters* _params, bool topScene = false, QObject *parent = 0);
~GroupScene();
+ //void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
+
// attributes getters
inline GroupItem* getGroupItem() {return groupItem;}
- inline QList<BoxItem*> getBlockItems() { return blockItems; }
+ inline QList<BoxItem*> getBoxItems() { return boxItems; }
+ inline QList<StimuliItem*> getSourceItems() { return stimuliItems; }
inline QList<ConnectionItem*> getConnectionItems() { return connectionItems; }
inline QList<GroupScene*> getChildrenScene() { return childrenScene; }
inline GroupScene* getParentScene() { return parentScene; }
// attributes testers
inline bool isTopScene() { return topScene; }
-
// others
- BoxItem* createBlockItem(AbstractBlock* block); //! create a new BoxItem and place it at the center of the scene
- void addBlockItem(BoxItem* item); //! add an already configured BoxItem in the scene.
- void removeBlockItem(BoxItem* item);
- void createConnectionItem(InterfaceItem* iface1, InterfaceItem* iface2);
+
+ // BoxItem related
+ BoxItem* createBoxItem(AbstractBlock* block, BoxItem::Position position = BoxItem::Free, int lock = AbstractBoxItem::NoLock, BoxItem::SpanType span = BoxItem::NoSpan); //! create a new BoxItem and place it at the center of the scene
+ void addBoxItem(BoxItem* item); //! add an already configured BoxItem in the scene.
+ void removeBoxItem(BoxItem* item);
+
+ // ConnectionItem related
+ void createConnectionItem(InterfaceItem* iface1, InterfaceItem* iface2, bool visible = true);
ConnectionItem* searchConnectionItem(InterfaceItem* iface1, InterfaceItem* iface2);
void addConnectionItem(ConnectionItem* item);
void removeConnectionItem(ConnectionItem* item);
+
+ // GroupItem related
void removeGroupItem();
+
+ // StimuliItem related
+ StimuliItem* createStimuliItem(AbstractBlock* block); //! create a new SourceItem and place it around the group item
+ void addStimuliItem(StimuliItem* item); //! add an already configured SourceItem in the scene.
+ void removeStimuliItem(StimuliItem* item);
+
+ // child scenes related
inline void addChildScene(GroupScene* child) { childrenScene.append(child); }
inline void removeChildScene(GroupScene* child) { childrenScene.removeAll(child); }
inline int getNbChildScene() { return childrenScene.size(); }
void unselecteInterfaces();
-
- QList<AbstractBoxItem*> getGroupAndBlocks();
- QList<BoxItem *> getSelectedBlocks();
-
- QList<ConnectionItem *> getInterfaceConnections(InterfaceItem *item);
+
+ QList<BoxItem *> getSelectedBlocks();
int setItemsId(int countInit=1);
int setInterfacesId(int countInit=1);
GroupScene* parentScene; // the parent scene, =NULL for top scene
GroupWidget* window; // the GroupWindow that contains that scene
int id;
- GroupItem *groupItem; // mandatory to be an instance of GroupItem.
- QList<ConnectionItem*> connectionItems;
- QList<BoxItem*> blockItems;
- QList<GroupScene*> childrenScene;
+ GroupItem *groupItem; //! for convenience, the group item is directly accessible via this attribute
+ QList<ConnectionItem*> connectionItems; //! for convenience, connections are directly accessible via this attribute
+ QList<BoxItem*> boxItems; //! for convenience, box items are directly accessible via this attribute
+ QList<StimuliItem*> stimuliItems; //! for convenience, box items are directly accessible via this attribute. Only usefull for top scene
+ QList<GroupScene*> childrenScene;//! for convenience, children scenes are directly accessible via this attribute
bool topScene;
EditMode editMode;
InterfaceItem* selectedInterfaces[2]; // selected iface 1 in AddConnection mode