Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions jni/keyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -29,6 +35,7 @@ struct kbKey
char name[2][4];
int type;
int id;
int active;
};

typedef void keyboard_callback(const char* result);
Expand All @@ -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; }
Expand All @@ -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;
Expand All @@ -71,11 +81,18 @@ class CKeyBoard
int m_iCase;
int m_iPushedKey;

std::vector<kbKey> m_Rows[3][4]; // eng, rus, num
//std::vector<kbKey> 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;
};
};