summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qiosfontdialog.h
blob: f0a92d0d6f30b957188161c57768b1d3f1b5d59b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QIOSFONTDIALOG_H
#define QIOSFONTDIALOG_H

#include <QtCore/qeventloop.h>
#include <qpa/qplatformdialoghelper.h>

@interface QIOSFontDialogController : UIFontPickerViewController <UIFontPickerViewControllerDelegate,
                                                                    UIAdaptivePresentationControllerDelegate>
@end

QT_BEGIN_NAMESPACE

class QIOSFontDialog : public QPlatformFontDialogHelper
{
public:
    QIOSFontDialog();
    ~QIOSFontDialog();

    void exec() override;

    bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) override;
    void hide() override;

    void setCurrentFont(const QFont &) override;
    QFont currentFont() const override;

    void updateCurrentFont(const QFont &);

private:
    QEventLoop m_eventLoop;
    QIOSFontDialogController *m_viewController;
    QFont m_currentFont;

};

QT_END_NAMESPACE

#endif // QIOSFONTDIALOG_H