1 /*
2  * DQt - D bindings for the Qt Toolkit
3  *
4  * GNU Lesser General Public License Usage
5  * This file may be used under the terms of the GNU Lesser
6  * General Public License version 3 as published by the Free Software
7  * Foundation and appearing in the file LICENSE.LGPL3 included in the
8  * packaging of this file. Please review the following information to
9  * ensure the GNU Lesser General Public License version 3 requirements
10  * will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
11  */
12 module qt.core.easingcurve;
13 extern(C++):
14 
15 import qt.config;
16 import qt.core.global;
17 import qt.core.list;
18 import qt.core.metamacros;
19 import qt.core.point;
20 import qt.core.typeinfo;
21 import qt.helpers;
22 
23 /+ QT_REQUIRE_CONFIG(easingcurve); +/
24 
25 
26 extern(C++, class) struct QEasingCurvePrivate;
27 /// Binding for C++ class [QEasingCurve](https://doc.qt.io/qt-6/qeasingcurve.html).
28 @Q_RELOCATABLE_TYPE extern(C++, class) struct /+ Q_CORE_EXPORT +/ QEasingCurve
29 {
30     mixin(Q_GADGET);
31 public:
32     enum Type {
33         Linear,
34         InQuad, OutQuad, InOutQuad, OutInQuad,
35         InCubic, OutCubic, InOutCubic, OutInCubic,
36         InQuart, OutQuart, InOutQuart, OutInQuart,
37         InQuint, OutQuint, InOutQuint, OutInQuint,
38         InSine, OutSine, InOutSine, OutInSine,
39         InExpo, OutExpo, InOutExpo, OutInExpo,
40         InCirc, OutCirc, InOutCirc, OutInCirc,
41         InElastic, OutElastic, InOutElastic, OutInElastic,
42         InBack, OutBack, InOutBack, OutInBack,
43         InBounce, OutBounce, InOutBounce, OutInBounce,
44         InCurve, OutCurve, SineCurve, CosineCurve,
45         BezierSpline, TCBSpline, Custom, NCurveTypes
46     }
47     /+ Q_ENUM(Type) +/
48 
49     @disable this();
50     this(Type type/+ = Type.Linear+/);
51     @disable this(this);
52     this(ref const(QEasingCurve) other);
53     ~this();
54 
55     /+ref QEasingCurve operator =(ref const(QEasingCurve) other)
56     { if ( &this != &other ) { auto copy = QEasingCurve(other); swap(copy); } return this; }+/
57     /+ QEasingCurve(QEasingCurve &&other) noexcept : d_ptr(other.d_ptr) { other.d_ptr = nullptr; } +/
58     /+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QEasingCurve) +/
59 
60     /+ void swap(QEasingCurve &other) noexcept { qSwap(d_ptr, other.d_ptr); } +/
61 
62     /+bool operator ==(ref const(QEasingCurve) other) const;+/
63     /+pragma(inline, true) bool operator !=(ref const(QEasingCurve) other) const
64     { return !(this.operator==(other)); }+/
65 
66     qreal amplitude() const;
67     void setAmplitude(qreal amplitude);
68 
69     qreal period() const;
70     void setPeriod(qreal period);
71 
72     qreal overshoot() const;
73     void setOvershoot(qreal overshoot);
74 
75     void addCubicBezierSegment(ref const(QPointF) c1, ref const(QPointF) c2, ref const(QPointF) endPoint);
76     void addTCBSegment(ref const(QPointF) nextPoint, qreal t, qreal c, qreal b);
77     QList!(QPointF) toCubicSpline() const;
78 
79     Type type() const;
80     void setType(Type type);
81     alias EasingFunction = ExternCPPFunc!(qreal function(qreal progress));
82     void setCustomType(EasingFunction func);
83     EasingFunction customType() const;
84 
85     qreal valueForProgress(qreal progress) const;
86 
87 private:
88     QEasingCurvePrivate* d_ptr;
89 /+ #ifndef QT_NO_DEBUG_STREAM
90     friend Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item);
91 #endif
92 #ifndef QT_NO_DATASTREAM +/
93     version(QT_NO_DATASTREAM){}else
94     {
95         /+ friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QEasingCurve &); +/
96         /+ friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &); +/
97     }
98 /+ #endif +/
99     mixin(CREATE_CONVENIENCE_WRAPPERS);
100 }
101 /+ Q_DECLARE_SHARED(QEasingCurve)
102 
103 #ifndef QT_NO_DEBUG_STREAM
104 Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item);
105 #endif
106 
107 #ifndef QT_NO_DATASTREAM
108 Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QEasingCurve &);
109 Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &);
110 #endif +/
111