26 #include <boost/bind.hpp>
71 gcn::Key key = keyEvent.getKey();
72 int32_t keyType = key.getValue();
74 if (keyType ==
Key::LEFT && mCaretPosition > 0)
78 else if (keyType ==
Key::RIGHT && mCaretPosition < mText.size())
103 else if (keyType ==
Key::DELETE && mCaretPosition < mText.size())
128 mCaretPosition = mText.size();
130 else if (key.isCharacter())
142 graphics->setColor(getForegroundColor());
143 graphics->drawLine(x, getHeight() - 2, x, 1);
144 graphics->drawLine(x+1, getHeight() - 2, x+1, 1);
UTF-8 aware version of the TextField class.
void stopBlinking()
Stop blinking the caret for a few seconds.
void setCallback(const type_callback &cb)
Set callback on pressing the ENTER key.
virtual void keyPressed(KeyEvent &keyEvent)
Key pressed handler.
size_t m_history_position
void setInterval(int32_t msec)
Set the interval in milliseconds.
void start()
Start the timer.
boost::function1< void, std::string > type_callback
void toggleCaretVisible()
Toggle the caret visibility.
void startBlinking()
Start blinking the caret.
void stop()
Stop the timer.
void keyPressed(gcn::KeyEvent &keyEvent)
std::vector< std::string > m_history
~CommandLine()
Destructor.
CommandLine()
Constructor.
void setCallback(const type_callback &callback)
Set the callback that will be called.
virtual void drawCaret(gcn::Graphics *graphics, int32_t x)
Timer m_suppressBlinkTimer