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.colordialog;
15 extern(C++):
16 
17 import qt.config;
18 import qt.core.coreevent;
19 import qt.core.flags;
20 import qt.core.namespace;
21 import qt.core.object;
22 import qt.core.string;
23 import qt.gui.color;
24 import qt.gui.rgb;
25 import qt.helpers;
26 import qt.widgets.dialog;
27 import qt.widgets.widget;
28 
29 /+ QT_REQUIRE_CONFIG(colordialog); +/
30 
31 
32 extern(C++, class) struct QColorDialogPrivate;
33 
34 class /+ Q_WIDGETS_EXPORT +/ QColorDialog : QDialog
35 {
36     mixin(Q_OBJECT);
37     /+ Q_DECLARE_PRIVATE(QColorDialog) +/
38     /+ Q_PROPERTY(QColor currentColor READ currentColor WRITE setCurrentColor
39                NOTIFY currentColorChanged)
40     Q_PROPERTY(ColorDialogOptions options READ options WRITE setOptions) +/
41 
42 public:
43     enum ColorDialogOption {
44         ShowAlphaChannel    = 0x00000001,
45         NoButtons           = 0x00000002,
46         DontUseNativeDialog = 0x00000004
47     }
48     /+ Q_ENUM(ColorDialogOption) +/
49 
50     /+ Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption) +/
51 alias ColorDialogOptions = QFlags!(ColorDialogOption);
52     /+ explicit +/this(QWidget parent = null);
53     /+ explicit +/this(ref const(QColor) initial, QWidget parent = null);
54     ~this();
55 
56     final void setCurrentColor(ref const(QColor) color);
57     final QColor currentColor() const;
58 
59     final QColor selectedColor() const;
60 
61     final void setOption(ColorDialogOption option, bool on = true);
62     final bool testOption(ColorDialogOption option) const;
63     final void setOptions(ColorDialogOptions options);
64     final ColorDialogOptions options() const;
65 
66     /+ using QDialog::open; +/
67     final void open(QObject receiver, const(char)* member);
68 
69     override void setVisible(bool visible);
70 
71     static QColor getColor(ref const(QColor) initial /+ = Qt::white +/,
72                                QWidget parent = null,
73                                ref const(QString) title = globalInitVar!QString,
74                                ColorDialogOptions options = ColorDialogOptions());
75 
76 /+ #if QT_DEPRECATED_SINCE(5, 12) +/
77     /+ QT_DEPRECATED_X("Use getColor()") +/ static QRgb getRgba(QRgb rgba = 0xffffffff, bool* ok = null, QWidget parent = null);
78 /+ #endif +/
79 
80     static int customCount();
81     static QColor customColor(int index);
82     static void setCustomColor(int index, QColor color);
83     static QColor standardColor(int index);
84     static void setStandardColor(int index, QColor color);
85 
86 /+ Q_SIGNALS +/public:
87     @QSignal final void currentColorChanged(ref const(QColor) color);
88     @QSignal final void colorSelected(ref const(QColor) color);
89 
90 protected:
91     override void changeEvent(QEvent event);
92     override void done(int result);
93 
94 private:
95     /+ Q_DISABLE_COPY(QColorDialog) +/
96 
97     /+ Q_PRIVATE_SLOT(d_func(), void _q_addCustom())
98     Q_PRIVATE_SLOT(d_func(), void _q_newHsv(int h, int s, int v))
99     Q_PRIVATE_SLOT(d_func(), void _q_newColorTypedIn(QRgb rgb))
100     Q_PRIVATE_SLOT(d_func(), void _q_nextCustom(int, int))
101     Q_PRIVATE_SLOT(d_func(), void _q_newCustom(int, int))
102     Q_PRIVATE_SLOT(d_func(), void _q_newStandard(int, int))
103     Q_PRIVATE_SLOT(d_func(), void _q_pickScreenColor())
104     Q_PRIVATE_SLOT(d_func(), void _q_updateColorPicking()) +/
105 }
106 /+pragma(inline, true) QFlags!(QColorDialog.ColorDialogOptions.enum_type) operator |(QColorDialog.ColorDialogOptions.enum_type f1, QColorDialog.ColorDialogOptions.enum_type f2)/+noexcept+/{return QFlags!(QColorDialog.ColorDialogOptions.enum_type)(f1)|f2;}+/
107 /+pragma(inline, true) QFlags!(QColorDialog.ColorDialogOptions.enum_type) operator |(QColorDialog.ColorDialogOptions.enum_type f1, QFlags!(QColorDialog.ColorDialogOptions.enum_type) f2)/+noexcept+/{return f2|f1;}+/
108 /+pragma(inline, true) QIncompatibleFlag operator |(QColorDialog.ColorDialogOptions.enum_type f1, int f2)/+noexcept+/{return QIncompatibleFlag(int(f1)|f2);}+/
109 
110 /+ Q_DECLARE_OPERATORS_FOR_FLAGS(QColorDialog::ColorDialogOptions) +/