1 /**************************************************************************** 2 ** 3 ** DQt - D bindings for the Qt Toolkit 4 ** 5 ** GNU Lesser General Public License Usage 6 ** This file may be used under the terms of the GNU Lesser 7 ** General Public License version 3 as published by the Free Software 8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the 9 ** packaging of this file. Please review the following information to 10 ** ensure the GNU Lesser General Public License version 3 requirements 11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 12 ** 13 ****************************************************************************/ 14 module qt.widgets.rubberband; 15 extern(C++): 16 17 import qt.config; 18 import qt.core.coreevent; 19 import qt.core.point; 20 import qt.core.rect; 21 import qt.core.size; 22 import qt.gui.event; 23 import qt.helpers; 24 import qt.widgets.styleoption; 25 import qt.widgets.widget; 26 27 /+ QT_REQUIRE_CONFIG(rubberband); +/ 28 29 30 extern(C++, class) struct QRubberBandPrivate; 31 /+ class QStyleOptionRubberBand; +/ 32 33 class /+ Q_WIDGETS_EXPORT +/ QRubberBand : QWidget 34 { 35 mixin(Q_OBJECT); 36 37 public: 38 enum Shape { Line, Rectangle } 39 /+ explicit +/this(Shape, QWidget /+ = nullptr +/); 40 ~this(); 41 42 final Shape shape() const; 43 44 // final void setGeometry(ref const(QRect) r); 45 46 /+ pragma(inline, true) final void setGeometry(int ax, int ay, int aw, int ah) 47 { auto tmp = QRect(ax, ay, aw, ah); setGeometry(tmp); } 48 pragma(inline, true) final void move(int ax, int ay) 49 { setGeometry(ax, ay, width(), height()); } 50 pragma(inline, true) final void move(ref const(QPoint) p) 51 { move(p.x(), p.y()); } 52 pragma(inline, true) final void resize(int w, int h) 53 { setGeometry(geometry().x(), geometry().y(), w, h); } 54 pragma(inline, true) final void resize(ref const(QSize) s) 55 { resize(s.width(), s.height()); }+/ 56 57 protected: 58 override bool event(QEvent e); 59 override void paintEvent(QPaintEvent ); 60 override void changeEvent(QEvent ); 61 override void showEvent(QShowEvent ); 62 override void resizeEvent(QResizeEvent ); 63 override void moveEvent(QMoveEvent ); 64 final void initStyleOption(QStyleOptionRubberBand* option) const; 65 66 private: 67 /+ Q_DECLARE_PRIVATE(QRubberBand) +/ 68 } 69