Files
Upsilon/apps/calculation/text_field.cpp
Émilie Feral 41ed0bf8da [apps/calculation] delete useless dirty marker in the calculation text
field

Change-Id: I81507ded019eb9791776854b300b7f70a6d7f596
2016-12-09 11:01:43 +01:00

29 lines
858 B
C++

#include "text_field.h"
namespace Calculation {
TextField::TextField(Responder * parentResponder, char * textBuffer, size_t textBufferSize, TextFieldDelegate * delegate) :
::TextField(parentResponder, textBuffer, textBufferSize, delegate)
{
}
bool TextField::handleEvent(Ion::Events::Event event) {
if (event == Ion::Events::Ans) {
insertTextAtLocation("ans", cursorLocation());
setCursorLocation(cursorLocation() + strlen("ans"));
return true;
}
if (m_currentTextLength == 0 &&
(event == Ion::Events::Multiplication ||
event == Ion::Events::Plus ||
event == Ion::Events::Minus ||
event == Ion::Events::Dot ||
event == Ion::Events::Division)) {
insertTextAtLocation("ans", cursorLocation());
setCursorLocation(cursorLocation() + strlen("ans"));
}
return(::TextField::handleEvent(event));
}
}