forked from boricj/numworks-rpn
-
Notifications
You must be signed in to change notification settings - Fork 7
/
rpn_input_controller.h
46 lines (36 loc) · 1.49 KB
/
rpn_input_controller.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef RPN_INPUT_CONTROLLER_H
#define RPN_INPUT_CONTROLLER_H
#include <escher.h>
#include "../shared/text_field_delegate.h"
#include "../shared/input_event_handler_delegate.h"
//#include "rpn_input_field.h"
#include "rpn_stack_controller.h"
#include "rpn_stack.h"
namespace Rpn {
class ContentView;
class StackController;
class InputController : public ViewController, public Shared::TextFieldDelegate, public Shared::InputEventHandlerDelegate {
public:
InputController(Responder * parentResponder, Stack * stack, StackController * stackController, ContentView * view);
View * view() override;
bool handleEvent(Ion::Events::Event event) override;
void didBecomeFirstResponder() override;
/* TextFieldDelegate */
bool textFieldShouldFinishEditing(TextField * textField, Ion::Events::Event event) override;
bool textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) override;
bool textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) override;
bool textFieldDidAbortEditing(TextField * textField) override;
bool textFieldDidHandleEvent(TextField * textField, bool returnValue, bool textHasChanged) override;
bool pushInput();
void setText(const char *text);
public:
bool handleEventOperation(Ion::Events::Event event, TextField * view);
bool handleEventSpecial(Ion::Events::Event event, TextField * view);
TextField* inputView();
private:
Stack *m_stack;
StackController *m_stackController;
ContentView *m_view;
};
}
#endif