IMEContext.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * IMEContext.h
  3. *
  4. * Created on: Oct 30, 2017
  5. * Author: guoxs
  6. */
  7. #ifndef _IME_IMECONTEXT_H_
  8. #define _IME_IMECONTEXT_H_
  9. #include <string>
  10. class IMEContext {
  11. public:
  12. IMEContext();
  13. virtual ~IMEContext();
  14. typedef enum {
  15. E_IME_TEXT_TYPE_ALL,
  16. E_IME_TEXT_TYPE_NUMBER
  17. } EIMETextType;
  18. typedef struct {
  19. bool isPassword;
  20. char passwordChar;
  21. EIMETextType imeTextType;
  22. std::string text;
  23. } SIMETextInfo;
  24. class IIMETextUpdateListener {
  25. public:
  26. virtual ~IIMETextUpdateListener() { }
  27. virtual void onIMETextUpdate(const std::string &text) = 0;
  28. };
  29. void setIMETextUpdateListener(IIMETextUpdateListener *pListener) {
  30. mIMETextUpdateListenerPtr = pListener;
  31. }
  32. void initIME(SIMETextInfo *pInfo, IIMETextUpdateListener *pListener);
  33. protected:
  34. virtual void onInitIME(SIMETextInfo *pInfo) { }
  35. void doneIMETextUpdate(const std::string &text);
  36. void cancelIMETextUpdate();
  37. protected:
  38. IIMETextUpdateListener *mIMETextUpdateListenerPtr;
  39. SIMETextInfo *mIMETextInfoPtr;
  40. };
  41. #endif /* _IME_IMECONTEXT_H_ */