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.gui.actiongroup;
13 extern(C++):
14 
15 import qt.config;
16 import qt.core.list;
17 import qt.core.object;
18 import qt.core.string;
19 import qt.gui.action;
20 import qt.gui.icon;
21 import qt.helpers;
22 
23 /+ QT_REQUIRE_CONFIG(action); +/
24 
25 
26 extern(C++, class) struct QActionGroupPrivate;
27 
28 /// Binding for C++ class [QActionGroup](https://doc.qt.io/qt-6/qactiongroup.html).
29 class /+ Q_GUI_EXPORT +/ QActionGroup : QObject
30 {
31     mixin(Q_OBJECT);
32     /+ Q_DECLARE_PRIVATE(QActionGroup) +/
33 
34     /+ Q_PROPERTY(QActionGroup::ExclusionPolicy exclusionPolicy READ exclusionPolicy WRITE setExclusionPolicy)
35     Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
36     Q_PROPERTY(bool visible READ isVisible WRITE setVisible) +/
37 
38 public:
39     enum /+ class +/ ExclusionPolicy {
40         None,
41         Exclusive,
42         ExclusiveOptional
43     }
44     /+ Q_ENUM(ExclusionPolicy) +/
45 
46     /+ explicit +/this(QObject parent);
47     ~this();
48 
49     final QAction addAction(QAction a);
50     final QAction addAction(ref const(QString) text);
51     final QAction addAction(ref const(QIcon) icon, ref const(QString) text);
52     final void removeAction(QAction a);
53     final QList!(QAction) actions() const;
54     final QAction checkedAction() const;
55 
56     final bool isExclusive() const;
57     final bool isEnabled() const;
58     final bool isVisible() const;
59     final ExclusionPolicy exclusionPolicy() const;
60 
61 
62 public /+ Q_SLOTS +/:
63     @QSlot final void setEnabled(bool);
64     pragma(inline, true) @QSlot final void setDisabled(bool b) { setEnabled(!b); }
65     @QSlot final void setVisible(bool);
66     @QSlot final void setExclusive(bool);
67     @QSlot final void setExclusionPolicy(ExclusionPolicy policy);
68 
69 /+ Q_SIGNALS +/public:
70     @QSignal final void triggered(QAction );
71     @QSignal final void hovered(QAction );
72 
73 private /+ Q_SLOTS +/:
74     @QSlot final void _q_actionTriggered();
75     @QSlot final void _q_actionHovered();
76     @QSlot final void _q_actionChanged();
77 
78 protected:
79      this(ref QActionGroupPrivate dd, QObject parent);
80 
81 private:
82     /+ Q_DISABLE_COPY(QActionGroup) +/
83     mixin(CREATE_CONVENIENCE_WRAPPERS);
84 }
85