src/lineending.h Source File

· · ·
lineending.h
1 /***************************************************************************
2 ** **
3 ** QCustomPlot, an easy to use, modern plotting widget for Qt **
4 ** Copyright (C) 2011, 2012, 2013 Emanuel Eichhammer **
5 ** **
6 ** This program is free software: you can redistribute it and/or modify **
7 ** it under the terms of the GNU General Public License as published by **
8 ** the Free Software Foundation, either version 3 of the License, or **
9 ** (at your option) any later version. **
10 ** **
11 ** This program is distributed in the hope that it will be useful, **
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of **
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
14 ** GNU General Public License for more details. **
15 ** **
16 ** You should have received a copy of the GNU General Public License **
17 ** along with this program. If not, see http://www.gnu.org/licenses/. **
18 ** **
19 ****************************************************************************
20 ** Author: Emanuel Eichhammer **
21 ** Website/Contact: http://www.qcustomplot.com/ **
22 ** Date: 04.11.13 **
23 ** Version: 1.1.0 **
24 ****************************************************************************/
25
26 #ifndef QCP_LINEENDING_H
27 #define QCP_LINEENDING_H
28
29 #include "global.h"
30
31 class QCPPainter;
32
33 class QCP_LIB_DECL QCPLineEnding
34 {
35 Q_GADGET
36 public:
48 Q_ENUMS(EndingStyle)
49 enum EndingStyle { esNone
50 ,esFlatArrow
51 ,esSpikeArrow
52 ,esLineArrow
53 ,esDisc
54 ,esSquare
55 ,esDiamond
56 ,esBar
57 ,esHalfBar
58 ,esSkewedBar
59 };
60
61 QCPLineEnding();
62 QCPLineEnding(EndingStyle style, double width=8, double length=10, bool inverted=false);
63
64 // getters:
65 EndingStyle style() const { return mStyle; }
66 double width() const { return mWidth; }
67 double length() const { return mLength; }
68 bool inverted() const { return mInverted; }
69
70 // setters:
71 void setStyle(EndingStyle style);
72 void setWidth(double width);
73 void setLength(double length);
74 void setInverted(bool inverted);
75
76 // non-property methods:
77 double boundingDistance() const;
78 double realLength() const;
79 void draw(QCPPainter *painter, const QVector2D &pos, const QVector2D &dir) const;
80 void draw(QCPPainter *painter, const QVector2D &pos, double angle) const;
81
82 protected:
83 // property members:
84 EndingStyle mStyle;
85 double mWidth, mLength;
86 bool mInverted;
87 };
88 Q_DECLARE_TYPEINFO(QCPLineEnding, Q_MOVABLE_TYPE);
89
90 #endif // QCP_LINEENDING_H
Generated with Doxygen 1.8.1.2