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