1*4882a593Smuzhiyun /**************************************************************************** 2*4882a593Smuzhiyun ** 3*4882a593Smuzhiyun ** Copyright (C) 2016 The Qt Company Ltd. 4*4882a593Smuzhiyun ** Contact: https://www.qt.io/licensing/ 5*4882a593Smuzhiyun ** 6*4882a593Smuzhiyun ** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit. 7*4882a593Smuzhiyun ** 8*4882a593Smuzhiyun ** $QT_BEGIN_LICENSE:GPL$ 9*4882a593Smuzhiyun ** Commercial License Usage 10*4882a593Smuzhiyun ** Licensees holding valid commercial Qt licenses may use this file in 11*4882a593Smuzhiyun ** accordance with the commercial license agreement provided with the 12*4882a593Smuzhiyun ** Software or, alternatively, in accordance with the terms contained in 13*4882a593Smuzhiyun ** a written agreement between you and The Qt Company. For licensing terms 14*4882a593Smuzhiyun ** and conditions see https://www.qt.io/terms-conditions. For further 15*4882a593Smuzhiyun ** information use the contact form at https://www.qt.io/contact-us. 16*4882a593Smuzhiyun ** 17*4882a593Smuzhiyun ** GNU General Public License Usage 18*4882a593Smuzhiyun ** Alternatively, this file may be used under the terms of the GNU 19*4882a593Smuzhiyun ** General Public License version 3 or (at your option) any later version 20*4882a593Smuzhiyun ** approved by the KDE Free Qt Foundation. The licenses are as published by 21*4882a593Smuzhiyun ** the Free Software Foundation and appearing in the file LICENSE.GPL3 22*4882a593Smuzhiyun ** included in the packaging of this file. Please review the following 23*4882a593Smuzhiyun ** information to ensure the GNU General Public License requirements will 24*4882a593Smuzhiyun ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 25*4882a593Smuzhiyun ** 26*4882a593Smuzhiyun ** $QT_END_LICENSE$ 27*4882a593Smuzhiyun ** 28*4882a593Smuzhiyun ****************************************************************************/ 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun #ifndef PLATFORMINPUTCONTEXT_H 31*4882a593Smuzhiyun #define PLATFORMINPUTCONTEXT_H 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun #include "dwkeyboard_global.h" 34*4882a593Smuzhiyun #include <qevent.h> 35*4882a593Smuzhiyun #include <QPointer> 36*4882a593Smuzhiyun #include <QLocale> 37*4882a593Smuzhiyun 38*4882a593Smuzhiyun namespace QtVirtualKeyboard { 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun class InputContext; 41*4882a593Smuzhiyun class AbstractInputPanel; 42*4882a593Smuzhiyun class DWKEYBOARDSHARED_EXPORT PlatformInputContext : public QObject 43*4882a593Smuzhiyun { 44*4882a593Smuzhiyun Q_OBJECT 45*4882a593Smuzhiyun public: 46*4882a593Smuzhiyun explicit PlatformInputContext(); 47*4882a593Smuzhiyun ~PlatformInputContext(); 48*4882a593Smuzhiyun 49*4882a593Smuzhiyun virtual bool isValid() const; 50*4882a593Smuzhiyun 51*4882a593Smuzhiyun virtual void reset(); 52*4882a593Smuzhiyun virtual void commit(); 53*4882a593Smuzhiyun virtual void update(Qt::InputMethodQueries queries); 54*4882a593Smuzhiyun virtual QRectF keyboardRect() const; 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun virtual bool isAnimating() const; 57*4882a593Smuzhiyun 58*4882a593Smuzhiyun virtual void showInputPanel(); 59*4882a593Smuzhiyun virtual void hideInputPanel(); 60*4882a593Smuzhiyun virtual bool isInputPanelVisible() const; 61*4882a593Smuzhiyun 62*4882a593Smuzhiyun virtual QLocale locale() const; 63*4882a593Smuzhiyun void setLocale(QLocale locale); 64*4882a593Smuzhiyun virtual Qt::LayoutDirection inputDirection() const; 65*4882a593Smuzhiyun void setInputDirection(Qt::LayoutDirection direction); 66*4882a593Smuzhiyun 67*4882a593Smuzhiyun QObject *focusObject(); 68*4882a593Smuzhiyun virtual void setFocusObject(QObject *object); 69*4882a593Smuzhiyun 70*4882a593Smuzhiyun InputContext *inputContext() const; 71*4882a593Smuzhiyun 72*4882a593Smuzhiyun virtual bool eventFilter(QObject *object, QEvent *event); 73*4882a593Smuzhiyun signals: 74*4882a593Smuzhiyun void focusObjectChanged(); 75*4882a593Smuzhiyun protected: 76*4882a593Smuzhiyun void sendEvent(QEvent *event); 77*4882a593Smuzhiyun void sendKeyEvent(QKeyEvent *event); 78*4882a593Smuzhiyun QVariant inputMethodQuery(Qt::InputMethodQuery query); 79*4882a593Smuzhiyun void setInputContext(InputContext *context); 80*4882a593Smuzhiyun public slots: 81*4882a593Smuzhiyun void FocusIn(QObject* obj, QPoint pos); 82*4882a593Smuzhiyun void FocusOut(QObject* obj); 83*4882a593Smuzhiyun private slots: 84*4882a593Smuzhiyun void keyboardRectangleChanged(); 85*4882a593Smuzhiyun void updateInputPanelVisible(); 86*4882a593Smuzhiyun bool virtualKeyPress(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers, bool isAutoRepeat);// 控件点击 87*4882a593Smuzhiyun bool virtualKeyRelease(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers);// 控件点击 88*4882a593Smuzhiyun private: 89*4882a593Smuzhiyun friend class InputContext; 90*4882a593Smuzhiyun QPointer<InputContext> m_inputContext; 91*4882a593Smuzhiyun QPointer<AbstractInputPanel> m_inputPanel; 92*4882a593Smuzhiyun QPointer<QObject> m_focusObject; 93*4882a593Smuzhiyun QLocale m_locale; 94*4882a593Smuzhiyun Qt::LayoutDirection m_inputDirection; 95*4882a593Smuzhiyun QEvent *m_filterEvent; 96*4882a593Smuzhiyun bool m_visible; 97*4882a593Smuzhiyun QPoint m_show_pos; 98*4882a593Smuzhiyun }; 99*4882a593Smuzhiyun 100*4882a593Smuzhiyun } // namespace QtVirtualKeyboard 101*4882a593Smuzhiyun 102*4882a593Smuzhiyun #endif 103