3.1需求中,需要和ACE编辑框交互增加的新接口

Signed-off-by: zhouyongfei <zhouyongfei@huawei.com>
This commit is contained in:
zhouyongfei
2021-12-03 10:09:26 +08:00
parent 69ab2b5f61
commit a7e12b86f9
8 changed files with 83 additions and 3 deletions
@@ -26,13 +26,17 @@
#include "i_input_method_agent.h"
#include "message_handler.h"
#include "iremote_object.h"
#include "input_method_utils.h"
namespace OHOS {
namespace MiscServices {
class OnTextChangedListener : public virtual RefBase {
public:
virtual void InsertText(const std::u16string& text) = 0;
virtual void DeleteForward(int32_t length) = 0;
virtual void DeleteBackward(int32_t length) = 0;
virtual void sendKeyEventFromInputMethod(KeyEvent event) = 0;
virtual void sendKeyboardStatus(KeyboardStatus status) = 0;
virtual void SetKeyboardStatus(bool status) = 0;
};
@@ -52,6 +56,9 @@ namespace MiscServices {
void HideTextInput();
void Close();
void OnRemoteSaDied(const wptr<IRemoteObject> &object);
void onCursorUpdate(CursorInfo cursorInfo);
void OnSelectionChange(std::u16string text, int start, int end);
void onConfigurationChange(Configuration info);
private:
InputMethodController();
~InputMethodController();
@@ -72,6 +79,9 @@ namespace MiscServices {
sptr<InputMethodAgentProxy> mAgent;
OnTextChangedListener *textListener;
InputAttribute mAttribute;
std::u16string mTextString;
int mSelectStart;
int mSelectEnd;
static std::mutex instanceLock_;
static sptr<InputMethodController> instance_;
@@ -0,0 +1,36 @@
//
// Created by OpenHarmonyUser on 2021/11/30.
//
#ifndef FM_IMC_PROJECT_INPUT_METHOD_UTILS_H
#define FM_IMC_PROJECT_INPUT_METHOD_UTILS_H
#endif //FM_IMC_PROJECT_INPUT_METHOD_UTILS_H
namespace OHOS {
namespace MiscServices {
class Configuration{
public:
enum {
TEXT_FIELD_ACTION_UNSPECIFIED = 0,
TEXT_FIELD_ACTION_NONE,
TEXT_FIELD_ACTION_GO,
TEXT_FIELD_ACTION_SEARCH,
TEXT_FIELD_ACTION_SEND,
TEXT_FIELD_ACTION_NEXT,
TEXT_FIELD_ACTION_DONE,
TEXT_FIELD_ACTION_PREVIOUS
};
int mTextFieldAction;
};
class CursorInfo{};
class KeyEvent{};
class KeyboardStatus{
public:
enum{
KEYBOARD_STATUS_HIDE = 0,
KEYBOARD_STATUS_SHOW
};
int mKeyboardStatus;
};
}
}