1 #ifndef __DISPATCHER_H__
2 #define __DISPATCHER_H__
15 class AbstractBoxItem;
29 Dispatcher(Parameters* _params,
32 GroupWidget* loadProject(const QString& filename);
34 inline int getNumberOfScenes() { return groupList.length(); }
35 bool connect(InterfaceItem *iface1, InterfaceItem *iface2);
36 void checkSelection();
37 void unselectAllItems(int direction=0);
38 void setCurrentGroupWidget(GroupWidget *win);
39 void changeConnectionMode(int mode = -1);
42 GroupWidget* createTopScene();
43 GroupWidget* createChildScene(GroupWidget* parentWidget, BoxItem* upperItemOfGroupItem = NULL);
44 void destroyScene(GroupScene* scene);
45 void showRaiseWindow(BoxItem *item);
46 void showRstClkInter(AbstractBoxItem *item);
47 void addNewEmptyGroup(GroupScene *scene);
48 void addNewFullGroup();
50 inline GroupWidget* getCurrentGroup() { return currentGroup; }
52 bool isCurrentProject;
55 QMap<int, QString> getAllGroupNames();
56 GroupScene* searchSceneById(int id);
57 GroupScene* searchSceneByName(QString name);
58 BoxItem* searchBlockItemById(int id);
59 GroupItem* searchGroupItemById(int id);
60 InterfaceItem* searchInterfaceItemById(int id);
63 void addBlock(int idCategory, int idBlock, int idScene);
64 void removeBlock(BoxItem* item);
65 void duplicateBlock(BoxItem* item);
66 void renameBlockOrGroup(AbstractBoxItem* item);
70 * \brief connectInterToGroup
71 * \param item item is always owned by a BoxItem
73 * This method is called only when the user right clicks on an InterfaceItem (that belongs
74 * to a BoxItem and if it is NOT connected to an InterfaceItem of the GroupItem) and chooses
75 * connect to group in the contextual menu.
76 * Thus, parameter item is always owned by a BoxItem
78 void connectInterToGroup(InterfaceItem* item);
80 * \brief disconnectInterFromGroup
81 * \param item item is always owned by a BoxItem
83 * This method is called only when the user right clicks on an InterfaceItem (that belongs
84 * to a BoxItem and if it IS connected to an InterfaceItem of the GroupItem) and chooses
85 * disconnect from group in the contextual menu.
86 * Thus, parameter item is always owned by a BoxItem
88 void disconnectInterFromGroup(InterfaceItem* item);
90 * \brief removeBlockInterface
91 * \param item item is always owned by a BoxItem
93 * This method is called only when the user right clicks on an InterfaceItem (that belongs
94 * to a BoxItem and has a multiplicity > 1) and chooses remove in the contextual menu.
95 * Thus, parameter item is always owned by a BoxItem
97 void removeBlockInterface(InterfaceItem* item);
99 * \brief removeGroupInterface
100 * \param item item is always owned by a GroupItem
102 * This method is called only when the user right clicks on an InterfaceItem (that belongs
103 * to a GroupItem and if it is connected only to an inner interface) and chooses remove in the contextual menu.
104 * Thus, parameter item is always owned by a GroupItem
106 void removeGroupInterface(InterfaceItem* item);
107 void duplicateInterface(InterfaceItem* item);
108 void showProperties(InterfaceItem *inter);
109 void renameInterface(InterfaceItem* item);
112 ConnectionItem *addConnection(InterfaceItem *input, InterfaceItem *output);
113 void removeAllBlockConnections(BoxItem *item);
114 void removeConnection(ConnectionItem *conn);
118 void showBlocksLibrary();
121 void closeCurrentProject();
128 // attributes that corresponds to the views
129 MainWindow* mainWindow;
130 QList<GroupWidget*> groupList;
131 GroupWidget* currentGroup;
132 GroupWidget *topGroup;
134 static int sceneCounter;
137 #endif // __DISPATCHER_H__