summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoainputcontext.h
blob: 5fc64678f7f8d1e4c707d90c638b453cca9170a3 (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) 2016 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
// Qt-Security score:significant reason:default

#ifndef QCOCOAINPUTCONTEXT_H
#define QCOCOAINPUTCONTEXT_H

#include <qpa/qplatforminputcontext.h>
#include <QtCore/QLocale>
#include <QtCore/QPointer>

#include <QtCore/private/qcore_mac_p.h>

QT_BEGIN_NAMESPACE

class QCocoaInputContext : public QPlatformInputContext
{
    Q_OBJECT
public:
    explicit QCocoaInputContext();
    ~QCocoaInputContext();

    bool isValid() const override { return true; }

    void setFocusObject(QObject *object) override;

    void commit() override;
    void reset() override;

    QLocale locale() const override { return m_locale; }
    void updateLocale();

private:
    QPointer<QWindow> m_focusWindow;
    QLocale m_locale;
    QMacNotificationObserver m_inputSourceObserver;
};

QT_END_NAMESPACE

#endif // QCOCOAINPUTCONTEXT_H