]> git.sven.stormbind.net Git - sven/vym.git/blob - src/arrowobj.h
New upstream version 2.9.22
[sven/vym.git] / src / arrowobj.h
1 #ifndef ARROWOBJ_H
2 #define ARROWOBJ_H
3
4 #include "mapobj.h"
5
6 #include <QPen>
7
8 /*! \brief arrows are used to indicate partially hidden ends of xlinks and
9     also the ends of xlinks.
10 */
11
12 /////////////////////////////////////////////////////////////////////////////
13
14 class ArrowObj : public MapObj {
15   public:
16     enum OrnamentStyle { None, HeadFull, Foot };
17     ArrowObj(MapObj *parent);
18     virtual ~ArrowObj();
19     virtual void init();
20     void setPen(QPen pen);
21     QPen getPen();
22     void setArrowSize(qreal r);
23     qreal getArrowSize();
24     void setFixedLength(int i);
25     int getFixedLength();
26     void setUseFixedLength(bool b);
27     bool getUseFixedLength();
28     void show();
29     void hide();
30     void setVisibility(bool b);
31     void setEndPoint(QPointF p);
32     QPointF getEndPoint();
33     void setStyleBegin(OrnamentStyle os);
34     void setStyleBegin(const QString &s);
35     OrnamentStyle getStyleBegin();
36     void setStyleEnd(const QString &s);
37     void setStyleEnd(OrnamentStyle os);
38     OrnamentStyle getStyleEnd();
39     static QString styleToString(const OrnamentStyle &os);
40
41   private:
42     QPolygonF getArrowHead();
43     QPen pen;
44     qreal arrowSize;
45     int fixedLength;
46     bool useFixedLength;
47     QGraphicsPolygonItem *arrowEnd;
48     QGraphicsPolygonItem *arrowBegin;
49     QGraphicsLineItem *line;
50     QPointF endPoint;
51
52     OrnamentStyle styleBegin;
53     OrnamentStyle styleEnd;
54 };
55
56 #endif