Numworks Epsilon  1.4.1
Graphing Calculator Operating System
text_field.cpp
Go to the documentation of this file.
1 #include "text_field.h"
2 
3 namespace Calculation {
4 
5 TextField::TextField(Responder * parentResponder, char * textBuffer, size_t textBufferSize, TextFieldDelegate * delegate) :
6  ::TextField(parentResponder, textBuffer, textBuffer, textBufferSize, delegate, false)
7 {
8  setEditing(true);
9 }
10 
12  if (event == Ion::Events::Back) {
13  return false;
14  }
15  if (event == Ion::Events::Ans) {
16  return handleEventWithText("ans");
17  }
18  if (isEditing() && draftTextLength() == 0 &&
19  (event == Ion::Events::Multiplication ||
20  event == Ion::Events::Plus ||
21  event == Ion::Events::Power ||
22  event == Ion::Events::Square ||
23  event == Ion::Events::Division ||
24  event == Ion::Events::Sto)) {
25  handleEventWithText("ans");
26  }
27  return(::TextField::handleEvent(event));
28 }
29 
30 }
constexpr Event Plus
Definition: events.h:107
bool isEditing() const
Definition: text_field.cpp:175
constexpr Event Power
Definition: events.h:83
bool handleEvent(Ion::Events::Event event) override
Definition: text_field.cpp:11
constexpr Event Square
Definition: events.h:90
virtual void setEditing(bool isEditing, bool reinitDraftBuffer=true)
Definition: text_field.cpp:196
constexpr Event Back
Definition: events.h:66
constexpr Event Division
Definition: events.h:102
constexpr Event Ans
Definition: events.h:113
#define false
Definition: stdbool.h:9
TextField(Responder *parentResponder, char *textBuffer, size_t textBufferSize, TextFieldDelegate *delegate)
Definition: text_field.cpp:5
bool handleEventWithText(const char *text, bool indenting=false) override
Definition: text_field.cpp:303
constexpr Event Sto
Definition: events.h:132
size_t draftTextLength() const
Definition: text_field.cpp:179
constexpr Event Multiplication
Definition: events.h:101