-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelementfactory.h
37 lines (30 loc) · 1012 Bytes
/
elementfactory.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef ELEMENTFACTORY_H
#define ELEMENTFACTORY_H
#include "graphicelement.h"
#include <deque>
#include <QObject>
class Editor;
class ElementFactory : public QObject {
Q_OBJECT
size_t _lastId;
public:
static ElementFactory *instance;
QMap< size_t, ItemWithId *> map;
static ElementType textToType( QString text );
static QString typeToText( ElementType type );
static QString translatedName(ElementType type);
static QPixmap getPixmap( ElementType type );
static GraphicElement* buildElement( ElementType type, Editor *editor, QGraphicsItem *parent = 0 );
static QNEConnection* buildConnection( QGraphicsItem *parent = 0 );
static ItemWithId * getItemById(size_t id);
static bool contains( size_t id );
static void updateItemId(ItemWithId * item, size_t newId );
static void removeItem(ItemWithId * item);
static void addItem(ItemWithId * item);
size_t getLastId( ) const;
size_t next_id( );
void clear();
private:
ElementFactory( );
};
#endif /* ELEMENTFACTORY_H */