| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QPLATFORMINPUTCONTEXT_H |
| 5 | #define QPLATFORMINPUTCONTEXT_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is part of the QPA API and is not meant to be used |
| 12 | // in applications. Usage of this API may make your code |
| 13 | // source and binary incompatible with future versions of Qt. |
| 14 | // |
| 15 | |
| 16 | #include <QtGui/qtguiglobal.h> |
| 17 | #include <QtGui/qinputmethod.h> |
| 18 | |
| 19 | QT_BEGIN_NAMESPACE |
| 20 | |
| 21 | class QPlatformInputContextPrivate; |
| 22 | |
| 23 | class Q_GUI_EXPORT QPlatformInputContext : public QObject |
| 24 | { |
| 25 | Q_OBJECT |
| 26 | Q_DECLARE_PRIVATE(QPlatformInputContext) |
| 27 | |
| 28 | public: |
| 29 | enum Capability { |
| 30 | HiddenTextCapability = 0x1 |
| 31 | }; |
| 32 | |
| 33 | QPlatformInputContext(); |
| 34 | ~QPlatformInputContext(); |
| 35 | |
| 36 | virtual bool isValid() const; |
| 37 | virtual bool hasCapability(Capability capability) const; |
| 38 | |
| 39 | virtual void reset(); |
| 40 | virtual void commit(); |
| 41 | virtual void update(Qt::InputMethodQueries); |
| 42 | virtual void invokeAction(QInputMethod::Action, int cursorPosition); |
| 43 | virtual bool filterEvent(const QEvent *event); |
| 44 | virtual QRectF keyboardRect() const; |
| 45 | void emitKeyboardRectChanged(); |
| 46 | |
| 47 | virtual bool isAnimating() const; |
| 48 | void emitAnimatingChanged(); |
| 49 | |
| 50 | virtual void showInputPanel(); |
| 51 | virtual void hideInputPanel(); |
| 52 | virtual bool isInputPanelVisible() const; |
| 53 | void emitInputPanelVisibleChanged(); |
| 54 | |
| 55 | virtual QLocale locale() const; |
| 56 | void emitLocaleChanged(); |
| 57 | virtual Qt::LayoutDirection inputDirection() const; |
| 58 | void emitInputDirectionChanged(Qt::LayoutDirection newDirection); |
| 59 | |
| 60 | virtual void setFocusObject(QObject *object); |
| 61 | bool inputMethodAccepted() const; |
| 62 | |
| 63 | static void setSelectionOnFocusObject(const QPointF &anchorPos, const QPointF &cursorPos); |
| 64 | static QVariant queryFocusObject(Qt::InputMethodQuery query, QPointF position); |
| 65 | static QRectF inputItemRectangle(); |
| 66 | static QRectF inputItemClipRectangle(); |
| 67 | static QRectF cursorRectangle(); |
| 68 | static QRectF anchorRectangle(); |
| 69 | static QRectF keyboardRectangle(); |
| 70 | |
| 71 | private: |
| 72 | friend class QGuiApplication; |
| 73 | friend class QGuiApplicationPrivate; |
| 74 | friend class QInputMethod; |
| 75 | |
| 76 | Qt::LayoutDirection m_inputDirection; |
| 77 | }; |
| 78 | |
| 79 | QT_END_NAMESPACE |
| 80 | |
| 81 | #endif // QPLATFORMINPUTCONTEXT_H |
| 82 | |