| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <[email protected]> |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: BSD-3-Clause |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef _DBUSADDONS_FCITXQTINPUTCONTEXTPROXY_H_ |
| 9 |
#define _DBUSADDONS_FCITXQTINPUTCONTEXTPROXY_H_ |
| 10 |
|
| 11 |
#include "fcitx5qt4dbusaddons_export.h" |
| 12 |
|
| 13 |
#include "fcitxqtdbustypes.h" |
| 14 |
#include <QDBusConnection> |
| 15 |
#include <QDBusPendingReply> |
| 16 |
#include <QDBusServiceWatcher> |
| 17 |
#include <QObject> |
| 18 |
|
| 19 |
class QDBusPendingCallWatcher; |
| 20 |
|
| 21 |
namespace fcitx { |
| 22 |
|
| 23 |
class FcitxQtWatcher; |
| 24 |
class FcitxQtInputContextProxyPrivate; |
| 25 |
|
| 26 |
class FCITX5QT4DBUSADDONS_EXPORT FcitxQtInputContextProxy : public QObject { |
| 27 |
Q_OBJECT |
| 28 |
public: |
| 29 |
FcitxQtInputContextProxy(FcitxQtWatcher *watcher, QObject *parent); |
| 30 |
~FcitxQtInputContextProxy(); |
| 31 |
|
| 32 |
bool isValid() const; |
| 33 |
void setDisplay(const QString &display); |
| 34 |
const QString &display() const; |
| 35 |
|
| 36 |
public Q_SLOTS: |
| 37 |
QDBusPendingReply<> focusIn(); |
| 38 |
QDBusPendingReply<> focusOut(); |
| 39 |
QDBusPendingReply<bool> processKeyEvent(unsigned int keyval, |
| 40 |
unsigned int keycode, |
| 41 |
unsigned int state, bool type, |
| 42 |
unsigned int time); |
| 43 |
QDBusPendingReply<> reset(); |
| 44 |
QDBusPendingReply<> setSupportedCapability(qulonglong caps); |
| 45 |
QDBusPendingReply<> setCapability(qulonglong caps); |
| 46 |
QDBusPendingReply<> setCursorRect(int x, int y, int w, int h); |
| 47 |
QDBusPendingReply<> setCursorRectV2(int x, int y, int w, int h, |
| 48 |
double scale); |
| 49 |
QDBusPendingReply<> setSurroundingText(const QString &text, |
| 50 |
unsigned int cursor, |
| 51 |
unsigned int anchor); |
| 52 |
QDBusPendingReply<> setSurroundingTextPosition(unsigned int cursor, |
| 53 |
unsigned int anchor); |
| 54 |
QDBusPendingReply<> prevPage(); |
| 55 |
QDBusPendingReply<> nextPage(); |
| 56 |
QDBusPendingReply<> selectCandidate(int i); |
| 57 |
QDBusPendingReply<> invokeAction(unsigned int action, int cursor); |
| 58 |
|
| 59 |
bool supportInvokeAction() const; |
| 60 |
|
| 61 |
Q_SIGNALS: |
| 62 |
void commitString(const QString &str); |
| 63 |
void currentIM(const QString &name, const QString &uniqueName, |
| 64 |
const QString &langCode); |
| 65 |
void deleteSurroundingText(int offset, unsigned int nchar); |
| 66 |
void forwardKey(unsigned int keyval, unsigned int state, bool isRelease); |
| 67 |
void updateFormattedPreedit(const FcitxQtFormattedPreeditList &str, |
| 68 |
int cursorpos); |
| 69 |
void updateClientSideUI(const FcitxQtFormattedPreeditList &preedit, |
| 70 |
int cursorpos, |
| 71 |
const FcitxQtFormattedPreeditList &auxUp, |
| 72 |
const FcitxQtFormattedPreeditList &auxDown, |
| 73 |
const FcitxQtStringKeyValueList &candidates, |
| 74 |
int candidateIndex, int layoutHint, bool hasPrev, |
| 75 |
bool hasNext); |
| 76 |
void inputContextCreated(const QByteArray &uuid); |
| 77 |
void notifyFocusOut(); |
| 78 |
|
| 79 |
private: |
| 80 |
Q_PRIVATE_SLOT(d_func(), void availabilityChanged()); |
| 81 |
Q_PRIVATE_SLOT(d_func(), void recheck()); |
| 82 |
Q_PRIVATE_SLOT(d_func(), void cleanUp()); |
| 83 |
Q_PRIVATE_SLOT(d_func(), void serviceUnregistered()); |
| 84 |
Q_PRIVATE_SLOT(d_func(), void createInputContextFinished()); |
| 85 |
Q_PRIVATE_SLOT(d_func(), void introspectFinished()); |
| 86 |
|
| 87 |
FcitxQtInputContextProxyPrivate *const d_ptr; |
| 88 |
Q_DECLARE_PRIVATE(FcitxQtInputContextProxy); |
| 89 |
}; |
| 90 |
|
| 91 |
} // namespace fcitx |
| 92 |
|
| 93 |
#endif // _DBUSADDONS_FCITXQTINPUTCONTEXTPROXY_H_ |