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.toolbox;
13 extern(C++):
14 
15 import qt.config;
16 import qt.core.coreevent;
17 import qt.core.namespace;
18 import qt.core.string;
19 import qt.gui.event;
20 import qt.gui.icon;
21 import qt.helpers;
22 import qt.widgets.frame;
23 import qt.widgets.widget;
24 
25 /+ QT_REQUIRE_CONFIG(toolbox); +/
26 
27 
28 extern(C++, class) struct QToolBoxPrivate;
29 
30 /// Binding for C++ class [QToolBox](https://doc.qt.io/qt-6/qtoolbox.html).
31 class /+ Q_WIDGETS_EXPORT +/ QToolBox : QFrame
32 {
33     mixin(Q_OBJECT);
34     /+ Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged)
35     Q_PROPERTY(int count READ count) +/
36 
37 public:
38     /+ explicit +/this(QWidget parent = null, /+ Qt:: +/qt.core.namespace.WindowFlags f = /+ Qt:: +/qt.core.namespace.WindowFlags());
39     ~this();
40 
41     pragma(inline, true) final int addItem(QWidget item, ref const(QString) text)
42     { auto tmp = QIcon(); return insertItem(-1, item, tmp, text); }
43     pragma(inline, true) final int addItem(QWidget item, ref const(QIcon) iconSet, ref const(QString) text)
44     { return insertItem(-1, item, iconSet, text); }
45     pragma(inline, true) final int insertItem(int index, QWidget item, ref const(QString) text)
46     { auto tmp = QIcon(); return insertItem(index, item, tmp, text); }
47     final int insertItem(int index, QWidget widget, ref const(QIcon) icon, ref const(QString) text);
48 
49     final void removeItem(int index);
50 
51     final void setItemEnabled(int index, bool enabled);
52     final bool isItemEnabled(int index) const;
53 
54     final void setItemText(int index, ref const(QString) text);
55     final QString itemText(int index) const;
56 
57     final void setItemIcon(int index, ref const(QIcon) icon);
58     final QIcon itemIcon(int index) const;
59 
60 /+ #if QT_CONFIG(tooltip) +/
61     final void setItemToolTip(int index, ref const(QString) toolTip);
62     final QString itemToolTip(int index) const;
63 /+ #endif +/
64 
65     final int currentIndex() const;
66     final QWidget currentWidget() const;
67     final QWidget widget(int index) const;
68     mixin(changeWindowsMangling(q{mangleClassesTailConst}, q{
69     final int indexOf(const(QWidget) widget) const;
70     }));
71     final int count() const;
72 
73 public /+ Q_SLOTS +/:
74     @QSlot final void setCurrentIndex(int index);
75     @QSlot final void setCurrentWidget(QWidget widget);
76 
77 /+ Q_SIGNALS +/public:
78     @QSignal final void currentChanged(int index);
79 
80 protected:
81     override bool event(QEvent e);
82     /+ virtual +/ void itemInserted(int index);
83     /+ virtual +/ void itemRemoved(int index);
84     override void showEvent(QShowEvent e);
85     override void changeEvent(QEvent );
86 
87 
88 private:
89     /+ Q_DECLARE_PRIVATE(QToolBox) +/
90     /+ Q_DISABLE_COPY(QToolBox) +/
91     /+ Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked())
92     Q_PRIVATE_SLOT(d_func(), void _q_widgetDestroyed(QObject*)) +/
93     mixin(CREATE_CONVENIENCE_WRAPPERS);
94 }
95 
96