| 1 |
/* |
| 2 |
* Copyright (C) 2020 The HIME team, Taiwan |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU General Public License as published by |
| 6 |
* the Free Software Foundation; version 2 of the License. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU General Public License along |
| 14 |
* with this program; if not, write to the Free Software Foundation, Inc., |
| 15 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 16 |
*/ |
| 17 |
|
| 18 |
#ifndef HIME_QT5_IM_H |
| 19 |
#define HIME_QT5_IM_H |
| 20 |
|
| 21 |
#include <QtGui/qpa/qplatforminputcontext.h> |
| 22 |
|
| 23 |
class QInputMethodEvent; |
| 24 |
struct HIME_client_handle_S; |
| 25 |
|
| 26 |
class QHimePlatformInputContext : public QPlatformInputContext { |
| 27 |
Q_OBJECT |
| 28 |
public: |
| 29 |
QHimePlatformInputContext (); |
| 30 |
virtual ~QHimePlatformInputContext (); |
| 31 |
|
| 32 |
virtual bool filterEvent (const QEvent *event); |
| 33 |
virtual bool isValid () const; |
| 34 |
virtual void invokeAction (QInputMethod::Action, int cursorPosition); |
| 35 |
virtual void reset (); |
| 36 |
virtual void commit (); |
| 37 |
virtual void update (Qt::InputMethodQueries quries); |
| 38 |
virtual void setFocusObject (QObject *object); |
| 39 |
|
| 40 |
private: |
| 41 |
HIME_client_handle_S *hime_ch; |
| 42 |
void send_event (QInputMethodEvent &e); |
| 43 |
void update_preedit (); |
| 44 |
void cursorMoved (); |
| 45 |
bool send_key_press (quint32 keysym, quint32 state); |
| 46 |
void commitPreedit (); |
| 47 |
void send_str (char *s); |
| 48 |
}; |
| 49 |
|
| 50 |
#endif /* HIME_QT5_IM_H */ |