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)
Key pressed handler.
virtual ~UTF8TextField()
Destructor.
UTF8StringEditor * mStringEditor
UTF-8 string editor suppor.
UTF8TextField(const std::string &text="")
UTF8TextField constructor.
static int eraseChar(std::string &text, int byteOffset)
Erase character at specified byte offset.
static int prevChar(const std::string &text, int byteOffset)
Returns byte offset of the previous character.
static int nextChar(const std::string &text, int byteOffset)
Returns byte offset of the next character.
static int insertChar(std::string &text, int byteOffset, int ch)
Insert a character at specified byte offset.