31 #include "utf8textfield.h"
48 Key key = keyEvent.getKey();
50 if (key.getValue() == Key::LEFT && mCaretPosition > 0)
54 else if (key.getValue() == Key::RIGHT && mCaretPosition < mText.size())
58 else if (key.getValue() == Key::DELETE && mCaretPosition < mText.size())
62 else if (key.getValue() == Key::BACKSPACE && mCaretPosition > 0)
67 else if (key.getValue() == Key::ENTER)
69 distributeActionEvent();
71 else if (key.getValue() == Key::HOME)
76 else if (key.getValue() == Key::END)
78 mCaretPosition = mText.size();
84 else if ((key.isCharacter() || key.getValue() > 255)
85 && key.getValue() != Key::TAB)
90 if (key.getValue() != Key::TAB)
virtual void keyPressed(KeyEvent &keyEvent)
UTF8StringEditor * mStringEditor
UTF8TextField(const std::string &text="")
static int eraseChar(std::string &text, int byteOffset)
static int prevChar(const std::string &text, int byteOffset)
static int nextChar(const std::string &text, int byteOffset)
static int insertChar(std::string &text, int byteOffset, int ch)