summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoainputcontext.h
blob: 58d1d7ec86addbc3b2f4cc2446b8ac194f1a6df7 (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
// 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

#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