diff --git a/jni/keyboard.h b/jni/keyboard.h index 0cc86b9..21386ea 100644 --- a/jni/keyboard.h +++ b/jni/keyboard.h @@ -5,9 +5,14 @@ */ #define LAYOUT_ENG 0 -#define LAYOUT_RUS 1 +#define LAYOUT_RUS 1 #define LAYOUT_NUM 2 +#define LAYOUT_ENG_C 10 +#define LAYOUT_RUS_C 11 +#define LAYOUT_NUM_C 10 +#define LAYOUT_ROWS_C 4 + #define LOWER_CASE 0 #define UPPER_CASE 1 @@ -17,6 +22,7 @@ #define KEY_SWITCH 3 #define KEY_SPACE 4 #define KEY_SEND 5 +#define KEY_REPEAT 6 #define MAX_INPUT_LEN 0xBF @@ -29,6 +35,7 @@ struct kbKey char name[2][4]; int type; int id; + int active; }; typedef void keyboard_callback(const char* result); @@ -41,6 +48,7 @@ class CKeyBoard ~CKeyBoard(); void Open(keyboard_callback* handler); + void InsertText(const std::string &string); void Close(); bool IsOpen() { return m_bEnable; } @@ -53,13 +61,15 @@ class CKeyBoard void InitENG(); void InitRU(); void InitNUM(); + void InitRepeatKey(); kbKey* GetKeyFromPos(int x, int y); void HandleInput(kbKey &key); void AddCharToInput(char sym); void DeleteCharFromInput(); void Send(); - + void Repeat(); + bool m_bEnable; bool m_bInited; ImVec2 m_Size; @@ -71,11 +81,18 @@ class CKeyBoard int m_iCase; int m_iPushedKey; - std::vector m_Rows[3][4]; // eng, rus, num + //std::vector m_Rows[3][4]; // eng, rus, num + + kbKey m_FixedRowsEng[LAYOUT_ROWS_C][LAYOUT_ENG_C]; + kbKey m_FixedRowsRus[LAYOUT_ROWS_C][LAYOUT_RUS_C]; + kbKey m_FixedRowsNum[LAYOUT_ROWS_C][LAYOUT_NUM_C]; + + kbKey m_RepeatKey; std::string m_sInput; + std::string m_sInputLast; char m_utf8Input[MAX_INPUT_LEN*3 + 0xF]; int m_iInputOffset; keyboard_callback *m_pHandler; -}; \ No newline at end of file +};