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.fontdialog;
15 extern(C++):
16 
17 import qt.config;
18 import qt.core.coreevent;
19 import qt.core.flags;
20 import qt.core.object;
21 import qt.core.string;
22 import qt.gui.font;
23 import qt.helpers;
24 import qt.widgets.dialog;
25 import qt.widgets.widget;
26 
27 /+ QT_REQUIRE_CONFIG(fontdialog); +/
28 
29 
30 extern(C++, class) struct QFontDialogPrivate;
31 
32 class /+ Q_WIDGETS_EXPORT +/ QFontDialog : QDialog
33 {
34     mixin(Q_OBJECT);
35     /+ Q_DECLARE_PRIVATE(QFontDialog) +/
36     /+ Q_PROPERTY(QFont currentFont READ currentFont WRITE setCurrentFont NOTIFY currentFontChanged)
37     Q_PROPERTY(FontDialogOptions options READ options WRITE setOptions) +/
38 
39 public:
40     enum FontDialogOption {
41         NoButtons           = 0x00000001,
42         DontUseNativeDialog = 0x00000002,
43         ScalableFonts       = 0x00000004,
44         NonScalableFonts    = 0x00000008,
45         MonospacedFonts     = 0x00000010,
46         ProportionalFonts   = 0x00000020
47     }
48     /+ Q_ENUM(FontDialogOption) +/
49 
50     /+ Q_DECLARE_FLAGS(FontDialogOptions, FontDialogOption) +/
51 alias FontDialogOptions = QFlags!(FontDialogOption);
52     /+ explicit +/this(QWidget parent = null);
53     /+ explicit +/this(ref const(QFont) initial, QWidget parent = null);
54     ~this();
55 
56     final void setCurrentFont(ref const(QFont) font);
57     final QFont currentFont() const;
58 
59     final QFont selectedFont() const;
60 
61     final void setOption(FontDialogOption option, bool on = true);
62     final bool testOption(FontDialogOption option) const;
63     final void setOptions(FontDialogOptions options);
64     final FontDialogOptions 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 QFont getFont(bool* ok, QWidget parent = null);
72     static QFont getFont(bool* ok, ref const(QFont) initial, QWidget parent = null, ref const(QString) title = globalInitVar!QString,
73                              FontDialogOptions options = FontDialogOptions());
74 
75 /+ Q_SIGNALS +/public:
76     @QSignal final void currentFontChanged(ref const(QFont) font);
77     @QSignal final void fontSelected(ref const(QFont) font);
78 
79 protected:
80     override void changeEvent(QEvent event);
81     override void done(int result);
82     override bool eventFilter(QObject object, QEvent event);
83 
84 private:
85     /+ Q_DISABLE_COPY(QFontDialog) +/
86 
87     /+ Q_PRIVATE_SLOT(d_func(), void _q_sizeChanged(const QString &))
88     Q_PRIVATE_SLOT(d_func(), void _q_familyHighlighted(int))
89     Q_PRIVATE_SLOT(d_func(), void _q_writingSystemHighlighted(int))
90     Q_PRIVATE_SLOT(d_func(), void _q_styleHighlighted(int))
91     Q_PRIVATE_SLOT(d_func(), void _q_sizeHighlighted(int))
92     Q_PRIVATE_SLOT(d_func(), void _q_updateSample()) +/
93 }
94 /+pragma(inline, true) QFlags!(QFontDialog.FontDialogOptions.enum_type) operator |(QFontDialog.FontDialogOptions.enum_type f1, QFontDialog.FontDialogOptions.enum_type f2)/+noexcept+/{return QFlags!(QFontDialog.FontDialogOptions.enum_type)(f1)|f2;}+/
95 /+pragma(inline, true) QFlags!(QFontDialog.FontDialogOptions.enum_type) operator |(QFontDialog.FontDialogOptions.enum_type f1, QFlags!(QFontDialog.FontDialogOptions.enum_type) f2)/+noexcept+/{return f2|f1;}+/
96 /+pragma(inline, true) QIncompatibleFlag operator |(QFontDialog.FontDialogOptions.enum_type f1, int f2)/+noexcept+/{return QIncompatibleFlag(int(f1)|f2);}+/
97 
98 /+ Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions) +/