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.pushbutton;
13 extern(C++):
14 
15 import qt.config;
16 import qt.core.coreevent;
17 import qt.core.point;
18 import qt.core.size;
19 import qt.core.string;
20 import qt.gui.event;
21 import qt.gui.icon;
22 import qt.helpers;
23 import qt.widgets.abstractbutton;
24 import qt.widgets.menu;
25 import qt.widgets.styleoption;
26 import qt.widgets.widget;
27 
28 /+ QT_REQUIRE_CONFIG(pushbutton); +/
29 
30 
31 
32 extern(C++, class) struct QPushButtonPrivate;
33 
34 /// Binding for C++ class [QPushButton](https://doc.qt.io/qt-6/qpushbutton.html).
35 class /+ Q_WIDGETS_EXPORT +/ QPushButton : QAbstractButton
36 {
37     mixin(Q_OBJECT);
38 
39     /+ Q_PROPERTY(bool autoDefault READ autoDefault WRITE setAutoDefault)
40     Q_PROPERTY(bool default READ isDefault WRITE setDefault)
41     Q_PROPERTY(bool flat READ isFlat WRITE setFlat) +/
42 
43 public:
44     /+ explicit +/this(QWidget parent = null);
45     /+ explicit +/this(ref const(QString) text, QWidget parent = null);
46     this(ref const(QIcon) icon, ref const(QString) text, QWidget parent = null);
47     ~this();
48 
49     override QSize sizeHint() const;
50     override QSize minimumSizeHint() const;
51 
52     final bool autoDefault() const;
53     final void setAutoDefault(bool);
54     final bool isDefault() const;
55     final void setDefault(bool);
56 
57 /+ #if QT_CONFIG(menu) +/
58     final void setMenu(QMenu menu);
59     final QMenu menu() const;
60 /+ #endif +/
61 
62     final void setFlat(bool);
63     final bool isFlat() const;
64 
65 public /+ Q_SLOTS +/:
66 /+ #if QT_CONFIG(menu) +/
67     @QSlot final void showMenu();
68 /+ #endif +/
69 
70 protected:
71     override bool event(QEvent e);
72     override void paintEvent(QPaintEvent );
73     override void keyPressEvent(QKeyEvent );
74     override void focusInEvent(QFocusEvent );
75     override void focusOutEvent(QFocusEvent );
76     override void mouseMoveEvent(QMouseEvent );
77     /+ virtual +/ void initStyleOption(QStyleOptionButton* option) const;
78     override bool hitButton(ref const(QPoint) pos) const;
79     this(ref QPushButtonPrivate dd, QWidget parent = null);
80 
81 public:
82 
83 private:
84     /+ Q_DISABLE_COPY(QPushButton) +/
85     /+ Q_DECLARE_PRIVATE(QPushButton) +/
86 /+ #if QT_CONFIG(menu)
87     Q_PRIVATE_SLOT(d_func(), void _q_popupPressed())
88 #endif +/
89     mixin(CREATE_CONVENIENCE_WRAPPERS);
90 }
91