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.widgets.rubberband;
13 extern(C++):
14 
15 import qt.config;
16 import qt.core.coreevent;
17 import qt.core.point;
18 import qt.core.rect;
19 import qt.core.size;
20 import qt.gui.event;
21 import qt.helpers;
22 import qt.widgets.styleoption;
23 import qt.widgets.widget;
24 
25 /+ QT_REQUIRE_CONFIG(rubberband); +/
26 
27 
28 extern(C++, class) struct QRubberBandPrivate;
29 
30 /// Binding for C++ class [QRubberBand](https://doc.qt.io/qt-6/qrubberband.html).
31 class /+ Q_WIDGETS_EXPORT +/ QRubberBand : QWidget
32 {
33     mixin(Q_OBJECT);
34 
35 public:
36     enum Shape { Line, Rectangle }
37     /+ explicit +/this(Shape, QWidget  /+ = nullptr +/);
38     ~this();
39 
40     final Shape shape() const;
41 
42 //    final void setGeometry(ref const(QRect) r);
43 
44 /+    pragma(inline, true) final void setGeometry(int ax, int ay, int aw, int ah)
45     { auto tmp = QRect(ax, ay, aw, ah); setGeometry(tmp); }
46     pragma(inline, true) final void move(int ax, int ay)
47     { setGeometry(ax, ay, width(), height()); }
48     pragma(inline, true) final void move(ref const(QPoint) p)
49     { move(p.x(), p.y()); }
50     pragma(inline, true) final void resize(int w, int h)
51     { setGeometry(geometry().x(), geometry().y(), w, h); }
52     pragma(inline, true) final void resize(ref const(QSize) s)
53     { resize(s.width(), s.height()); }+/
54 
55 protected:
56     override bool event(QEvent e);
57     override void paintEvent(QPaintEvent );
58     override void changeEvent(QEvent );
59     override void showEvent(QShowEvent );
60     override void resizeEvent(QResizeEvent );
61     override void moveEvent(QMoveEvent );
62     /+ virtual +/ void initStyleOption(QStyleOptionRubberBand* option) const;
63 
64 private:
65     /+ Q_DECLARE_PRIVATE(QRubberBand) +/
66     mixin(CREATE_CONVENIENCE_WRAPPERS);
67 }
68