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.polygon;
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.point;
20 import qt.core.rect;
21 import qt.core.typeinfo;
22 import qt.core.variant;
23 import qt.helpers;
24 
25 
26 // We export each out-of-line method individually to prevent MSVC from
27 // exporting the whole QList class.
28 /// Binding for C++ class [QPolygon](https://doc.qt.io/qt-6/qpolygon.html).
29 @Q_RELOCATABLE_TYPE extern(C++, class) struct QPolygon
30 {
31     public QList!(QPoint) base0;
32     alias base0 this;
33 public:
34     /+ using QList<QPoint>::QList; +/
35     /+ QPolygon() = default; +/
36     /+ Q_IMPLICIT +/ this(ref QList!(QPoint) v)
37     {
38         this.base0 = v;
39     }
40     /+ Q_IMPLICIT +/ /+ QPolygon(QList<QPoint> &&v) noexcept : QList<QPoint>(std::move(v)) { } +/
41     /+ Q_IMPLICIT +/ /+ Q_GUI_EXPORT +/this(ref const(QRect) r, bool closed=false);
42     /+ Q_GUI_EXPORT +/this(int nPoints, const(int)* points);
43     /+ void swap(QPolygon &other) noexcept { QList<QPoint>::swap(other); } +/ // prevent QList<QPoint><->QPolygon swaps
44 
45     /+/+ Q_GUI_EXPORT +/ auto opCast(T : QVariant)() const;+/
46 
47     /+ Q_GUI_EXPORT +/ void translate(int dx, int dy);
48     pragma(inline, true) void translate(ref const(QPoint) offset)
49     { translate(offset.x(), offset.y()); }
50 
51     /+ [[nodiscard]] +/ /+ Q_GUI_EXPORT +/ QPolygon translated(int dx, int dy) const;
52     /+ [[nodiscard]] +/ pragma(inline, true) QPolygon translated(ref const(QPoint) offset) const
53     { return translated(offset.x(), offset.y()); }
54 
55     /+ Q_GUI_EXPORT +/ QRect boundingRect() const;
56 
57     /+ Q_GUI_EXPORT +/ void point(int i, int* x, int* y) const;
58     pragma(inline, true) QPoint point(int index) const
59     { return at(index); }
60     pragma(inline, true) void setPoint(int index, int x, int y)
61     { (this)[index] = QPoint(x, y); }
62     pragma(inline, true) void setPoint(int index, ref const(QPoint) pt)
63     { (this)[index] = pt; }
64     /+ Q_GUI_EXPORT +/ void setPoints(int nPoints, const(int)* points);
65     /+ Q_GUI_EXPORT +/ void setPoints(int nPoints, int firstx, int firsty, ...);
66     /+ Q_GUI_EXPORT +/ void putPoints(int index, int nPoints, const(int)* points);
67     /+ Q_GUI_EXPORT +/ void putPoints(int index, int nPoints, int firstx, int firsty, ...);
68     /+ Q_GUI_EXPORT +/ void putPoints(int index, int nPoints, ref const(QPolygon)  from, int fromIndex=0);
69 
70     /+ Q_GUI_EXPORT +/ bool containsPoint(ref const(QPoint) pt, /+ Qt:: +/qt.core.namespace.FillRule fillRule) const;
71 
72     /+ [[nodiscard]] +/ /+ Q_GUI_EXPORT +/ QPolygon united(ref const(QPolygon) r) const;
73     /+ [[nodiscard]] +/ /+ Q_GUI_EXPORT +/ QPolygon intersected(ref const(QPolygon) r) const;
74     /+ [[nodiscard]] +/ /+ Q_GUI_EXPORT +/ QPolygon subtracted(ref const(QPolygon) r) const;
75 
76     /+ Q_GUI_EXPORT +/ bool intersects(ref const(QPolygon) r) const;
77     mixin(CREATE_CONVENIENCE_WRAPPERS);
78 }
79 /+ Q_DECLARE_SHARED(QPolygon)
80 
81 #ifndef QT_NO_DEBUG_STREAM
82 Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygon &);
83 #endif
84 
85 /*****************************************************************************
86   QPolygon stream functions
87  *****************************************************************************/
88 #ifndef QT_NO_DATASTREAM
89 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QPolygon &polygon);
90 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QPolygon &polygon);
91 #endif +/
92 
93 /*****************************************************************************
94   Misc. QPolygon functions
95  *****************************************************************************/
96 
97 
98 /// Binding for C++ class [QPolygonF](https://doc.qt.io/qt-6/qpolygonf.html).
99 @Q_RELOCATABLE_TYPE extern(C++, class) struct QPolygonF
100 {
101     public QList!(QPointF) base0;
102     alias base0 this;
103 public:
104     /+ using QList<QPointF>::QList; +/
105     /+ QPolygonF() = default; +/
106     /+ Q_IMPLICIT +/ this(ref QList!(QPointF) v)
107     {
108         this.base0 = v;
109     }
110     /+ Q_IMPLICIT +/ /+ QPolygonF(QList<QPointF> &&v) noexcept : QList<QPointF>(std::move(v)) { } +/
111     /+ Q_IMPLICIT +/ /+ Q_GUI_EXPORT +/this(ref const(QRectF) r);
112     /+ Q_IMPLICIT +/ /+ Q_GUI_EXPORT +/this(ref const(QPolygon) a);
113     /+ inline void swap(QPolygonF &other) { QList<QPointF>::swap(other); } +/ // prevent QList<QPointF><->QPolygonF swaps
114 
115     /+/+ Q_GUI_EXPORT +/ auto opCast(T : QVariant)() const;+/
116 
117     pragma(inline, true) void translate(qreal dx, qreal dy)
118     { auto tmp = QPointF(dx, dy); translate(tmp); }
119     void /+ Q_GUI_EXPORT +/ translate(ref const(QPointF) offset);
120 
121     pragma(inline, true) QPolygonF translated(qreal dx, qreal dy) const
122     { auto tmp = QPointF(dx, dy); return translated(tmp); }
123     /+ [[nodiscard]] +/ /+ Q_GUI_EXPORT +/ QPolygonF translated(ref const(QPointF) offset) const;
124 
125     QPolygon /+ Q_GUI_EXPORT +/ toPolygon() const;
126 
127     //bool isClosed() const { return !isEmpty() && first() == last(); }
128 
129     QRectF /+ Q_GUI_EXPORT +/ boundingRect() const;
130 
131     /+ Q_GUI_EXPORT +/ bool containsPoint(ref const(QPointF) pt, /+ Qt:: +/qt.core.namespace.FillRule fillRule) const;
132 
133     /+ [[nodiscard]] +/ /+ Q_GUI_EXPORT +/ QPolygonF united(ref const(QPolygonF) r) const;
134     /+ [[nodiscard]] +/ /+ Q_GUI_EXPORT +/ QPolygonF intersected(ref const(QPolygonF) r) const;
135     /+ [[nodiscard]] +/ /+ Q_GUI_EXPORT +/ QPolygonF subtracted(ref const(QPolygonF) r) const;
136 
137     /+ Q_GUI_EXPORT +/ bool intersects(ref const(QPolygonF) r) const;
138     mixin(CREATE_CONVENIENCE_WRAPPERS);
139 }
140 /+ Q_DECLARE_SHARED(QPolygonF)
141 
142 #ifndef QT_NO_DEBUG_STREAM
143 Q_GUI_EXPORT QDebug operator<<(QDebug, const QPolygonF &);
144 #endif
145 
146 /*****************************************************************************
147   QPolygonF stream functions
148  *****************************************************************************/
149 #ifndef QT_NO_DATASTREAM
150 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QPolygonF &array);
151 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QPolygonF &array);
152 #endif +/
153