| 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 QINPUTMETHOD_H |
| 5 | #define QINPUTMETHOD_H |
| 6 | |
| 7 | #include <QtGui/qtguiglobal.h> |
| 8 | #include <QtCore/qobject.h> |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | class QInputMethodPrivate; |
| 13 | class QWindow; |
| 14 | class QRectF; |
| 15 | class QTransform; |
| 16 | class QInputMethodQueryEvent; |
| 17 | |
| 18 | class Q_GUI_EXPORT QInputMethod : public QObject |
| 19 | { |
| 20 | Q_OBJECT |
| 21 | Q_DECLARE_PRIVATE(QInputMethod) |
| 22 | Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged) |
| 23 | Q_PROPERTY(QRectF anchorRectangle READ anchorRectangle NOTIFY anchorRectangleChanged) |
| 24 | Q_PROPERTY(QRectF keyboardRectangle READ keyboardRectangle NOTIFY keyboardRectangleChanged) |
| 25 | Q_PROPERTY(QRectF inputItemClipRectangle READ inputItemClipRectangle |
| 26 | NOTIFY inputItemClipRectangleChanged) |
| 27 | Q_PROPERTY(bool visible READ isVisible NOTIFY visibleChanged) |
| 28 | Q_PROPERTY(bool animating READ isAnimating NOTIFY animatingChanged) |
| 29 | Q_PROPERTY(QLocale locale READ locale NOTIFY localeChanged) |
| 30 | Q_PROPERTY(Qt::LayoutDirection inputDirection READ inputDirection NOTIFY inputDirectionChanged) |
| 31 | |
| 32 | public: |
| 33 | QTransform inputItemTransform() const; |
| 34 | void setInputItemTransform(const QTransform &transform); |
| 35 | |
| 36 | QRectF inputItemRectangle() const; |
| 37 | void setInputItemRectangle(const QRectF &rect); |
| 38 | |
| 39 | // in window coordinates |
| 40 | QRectF cursorRectangle() const; // ### what if we have rotations for the item? |
| 41 | QRectF anchorRectangle() const; // ### ditto |
| 42 | |
| 43 | // keyboard geometry in window coords |
| 44 | QRectF keyboardRectangle() const; |
| 45 | |
| 46 | QRectF inputItemClipRectangle() const; |
| 47 | |
| 48 | enum Action { |
| 49 | Click, |
| 50 | |
| 51 | }; |
| 52 | Q_ENUM(Action) |
| 53 | |
| 54 | bool isVisible() const; |
| 55 | void setVisible(bool visible); |
| 56 | |
| 57 | bool isAnimating() const; |
| 58 | |
| 59 | QLocale locale() const; |
| 60 | Qt::LayoutDirection inputDirection() const; |
| 61 | |
| 62 | static QVariant queryFocusObject(Qt::InputMethodQuery query, const QVariant &argument); |
| 63 | |
| 64 | public Q_SLOTS: |
| 65 | void show(); |
| 66 | void hide(); |
| 67 | |
| 68 | void update(Qt::InputMethodQueries queries); |
| 69 | void reset(); |
| 70 | void commit(); |
| 71 | |
| 72 | void invokeAction(Action a, int cursorPosition); |
| 73 | |
| 74 | Q_SIGNALS: |
| 75 | void cursorRectangleChanged(); |
| 76 | void anchorRectangleChanged(); |
| 77 | void keyboardRectangleChanged(); |
| 78 | void inputItemClipRectangleChanged(); |
| 79 | void visibleChanged(); |
| 80 | void animatingChanged(); |
| 81 | void localeChanged(); |
| 82 | void inputDirectionChanged(Qt::LayoutDirection newDirection); |
| 83 | |
| 84 | private: |
| 85 | friend class QGuiApplication; |
| 86 | friend class QGuiApplicationPrivate; |
| 87 | friend class QPlatformInputContext; |
| 88 | QInputMethod(); |
| 89 | ~QInputMethod(); |
| 90 | }; |
| 91 | |
| 92 | QT_END_NAMESPACE |
| 93 | |
| 94 | #endif |
| 95 | |