]> git.sven.stormbind.net Git - sven/vym.git/blob - src/xlink.h
Replace Pierre as the maintainer
[sven/vym.git] / src / xlink.h
1 #ifndef LINK_H
2 #define LINK_H
3
4 #include <QColor>
5 #include <QPen>
6
7 #include "xmlobj.h"
8
9 class QPointF;
10 class QGraphicsScene;
11 class QString;
12
13 class BranchItem;
14 class MapObj;
15 class LinkableMapObj;
16 class VymModel;
17 class XLinkItem;
18 class XLinkObj;
19
20 class Link : public XMLObj {
21   public:
22     enum XLinkState { undefinedXLink, initXLink, activeXLink, deleteXLink };
23     enum LinkType { Linear, Bezier };
24
25     Link(VymModel *m);
26     virtual ~Link();
27     virtual void init();
28     VymModel *getModel();
29     void setBeginBranch(BranchItem *);
30     BranchItem *getBeginBranch();
31     void setEndBranch(BranchItem *);
32     void setEndPoint(QPointF);
33     BranchItem *getEndBranch();
34     void setBeginLinkItem(XLinkItem *);
35     XLinkItem *getBeginLinkItem();
36     void setEndLinkItem(XLinkItem *);
37     XLinkItem *getEndLinkItem();
38     XLinkItem *getOtherEnd(XLinkItem *);
39     void setPen(const QPen &p);
40     QPen getPen();
41     void setLinkType(const QString &s);
42     void setStyleBegin(const QString &s);
43     QString getStyleBeginString();
44     void setStyleEnd(const QString &s);
45     QString getStyleEndString();
46     bool activate();
47     void deactivate();
48     XLinkState getState();
49     void removeXLinkItem(XLinkItem *xli);
50     void updateLink();
51     QString saveToDir();
52     XLinkObj *getXLinkObj();
53     XLinkObj *createMapObj();
54     MapObj *getMO();
55
56   private:
57     XLinkState xLinkState; // init during drawing or active
58     LinkType type;
59     QPen pen;
60
61     XLinkObj *xlo;
62     VymModel *model;
63
64     BranchItem *beginBranch;
65     BranchItem *endBranch;
66     XLinkItem *beginLinkItem;
67     XLinkItem *endLinkItem;
68 };
69
70 #endif