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.gui.pen;
13 extern(C++):
14 
15 import qt.config;
16 import qt.core.global;
17 import qt.core.list;
18 import qt.core.namespace;
19 import qt.core.typeinfo;
20 import qt.core.variant;
21 import qt.gui.brush;
22 import qt.gui.color;
23 import qt.helpers;
24 
25 extern(C++, class) struct QPenPrivate;
26 
27 /+ #ifndef QT_NO_DATASTREAM
28 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPen &);
29 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPen &);
30 #endif +/
31 
32 /// Binding for C++ class [QPen](https://doc.qt.io/qt-6/qpen.html).
33 @Q_RELOCATABLE_TYPE extern(C++, class) struct /+ Q_GUI_EXPORT +/ QPen
34 {
35 public:
36     @disable this();
37     pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this))))
38     ref typeof(this) rawConstructor();
39     static typeof(this) create()
40     {
41         typeof(this) r = typeof(this).init;
42         r.rawConstructor();
43         return r;
44     }
45 
46     this(/+ Qt:: +/qt.core.namespace.PenStyle);
47     this(ref const(QColor) color);
48     this(ref const(QBrush) brush, qreal width, /+ Qt:: +/qt.core.namespace.PenStyle s = /+ Qt:: +/qt.core.namespace.PenStyle.SolidLine,
49              /+ Qt:: +/qt.core.namespace.PenCapStyle c = /+ Qt:: +/qt.core.namespace.PenCapStyle.SquareCap, /+ Qt:: +/qt.core.namespace.PenJoinStyle j = /+ Qt:: +/qt.core.namespace.PenJoinStyle.BevelJoin);
50     @disable this(this);
51     this(ref const(QPen) pen)/+ noexcept+/;
52 
53     ~this();
54 
55     /+ref QPen operator =(ref const(QPen) pen)/+ noexcept+/;+/
56     /+ QPen(QPen &&other) noexcept
57         : d(qExchange(other.d, nullptr)) {} +/
58     /+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPen) +/
59     /+ void swap(QPen &other) noexcept { qSwap(d, other.d); } +/
60 
61     /+ Qt:: +/qt.core.namespace.PenStyle style() const;
62     void setStyle(/+ Qt:: +/qt.core.namespace.PenStyle);
63 
64     QList!(qreal) dashPattern() const;
65     void setDashPattern(ref const(QList!(qreal)) pattern);
66 
67     qreal dashOffset() const;
68     void setDashOffset(qreal doffset);
69 
70     qreal miterLimit() const;
71     void setMiterLimit(qreal limit);
72 
73     qreal widthF() const;
74     void setWidthF(qreal width);
75 
76     int width() const;
77     void setWidth(int width);
78 
79     QColor color() const;
80     void setColor(ref const(QColor) color);
81 
82     QBrush brush() const;
83     void setBrush(ref const(QBrush) brush);
84 
85     bool isSolid() const;
86 
87     /+ Qt:: +/qt.core.namespace.PenCapStyle capStyle() const;
88     void setCapStyle(/+ Qt:: +/qt.core.namespace.PenCapStyle pcs);
89 
90     /+ Qt:: +/qt.core.namespace.PenJoinStyle joinStyle() const;
91     void setJoinStyle(/+ Qt:: +/qt.core.namespace.PenJoinStyle pcs);
92 
93     bool isCosmetic() const;
94     void setCosmetic(bool cosmetic);
95 
96     /+bool operator ==(ref const(QPen) p) const;+/
97     /+pragma(inline, true) bool operator !=(ref const(QPen) p) const { return !(operator==(p)); }+/
98     /+auto opCast(T : QVariant)() const;+/
99 
100     bool isDetached();
101 private:
102     /+ friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPen &); +/
103     /+ friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPen &); +/
104 
105     void detach();
106     QPenPrivate* d;
107 
108 public:
109     alias DataPtr = QPenPrivate*;
110     pragma(inline, true) ref DataPtr data_ptr() return { return d; }
111     mixin(CREATE_CONVENIENCE_WRAPPERS);
112 }
113 
114 /+ Q_DECLARE_SHARED(QPen)
115 
116 #ifndef QT_NO_DEBUG_STREAM
117 Q_GUI_EXPORT QDebug operator<<(QDebug, const QPen &);
118 #endif +/
119