1 #include <lib/gui/einputstring.h>
3 DEFINE_REF(eInputContentString);
5 eInputContentString::eInputContentString()
10 m_len = m_string.size();
13 void eInputContentString::getDisplay(std::string &res, int &cursor)
19 void eInputContentString::moveCursor(int dir)
21 int old_cursor = m_cursor;
44 if (m_cursor != old_cursor)
46 m_input->invalidate();
49 int eInputContentString::haveKey(int code, int overwrite)
54 have_char = code &~ 0x8000;
58 if (overwrite && m_cursor < m_len)
59 m_string[m_cursor] = have_char;
62 m_string.insert(m_cursor, 1, have_char);
68 ASSERT(m_cursor <= m_len);
71 m_input->invalidate();
77 void eInputContentString::deleteChar(int dir)
79 if (dir == deleteForward)
82 if (m_cursor != m_len)
87 /* backward delete at begin */
94 m_string.erase(m_cursor - 1, m_cursor);
100 m_input->invalidate();
103 int eInputContentString::isValid()
108 void eInputContentString::validate()
112 void eInputContentString::setText(const std::string &str)
115 m_len = m_string.size();
116 if (m_cursor > m_len)
120 m_input->invalidate();
123 std::string eInputContentString::getText()