Numworks Epsilon
1.4.1
Graphing Calculator Operating System
input_view_controller.h
Go to the documentation of this file.
1
#ifndef ESCHER_INPUT_VIEW_CONTROLLER_H
2
#define ESCHER_INPUT_VIEW_CONTROLLER_H
3
4
#include <
escher/modal_view_controller.h
>
5
#include <
escher/invocation.h
>
6
#include <
escher/text_field.h
>
7
#include <
escher/text_field_delegate.h
>
8
9
class
InputViewController
:
public
ModalViewController
,
TextFieldDelegate
{
10
public
:
11
InputViewController
(
Responder
*
parentResponder
,
ViewController
* child,
TextFieldDelegate
* textFieldDelegate);
12
void
edit
(
Responder
* caller,
Ion::Events::Event
event,
void
* context,
const
char
* initialText,
Invocation::Action
successAction,
Invocation::Action
failureAction);
13
const
char
*
textBody
();
14
bool
textFieldDidReceiveEvent
(
TextField
* textField,
Ion::Events::Event
event)
override
;
15
void
abortTextFieldEditionAndDismiss
();
16
bool
textFieldShouldFinishEditing
(
TextField
* textField,
Ion::Events::Event
event)
override
;
17
bool
textFieldDidFinishEditing
(
TextField
* textField,
const
char
* text,
Ion::Events::Event
event)
override
;
18
bool
textFieldDidAbortEditing
(
TextField
* textField,
const
char
* text)
override
;
19
Toolbox
*
toolboxForTextInput
(
TextInput
* textInput)
override
;
20
private
:
21
class
TextFieldController :
public
ViewController
{
22
public
:
23
TextFieldController(
Responder
*
parentResponder
,
TextFieldDelegate
* textFieldDelegate);
24
void
didBecomeFirstResponder
()
override
;
25
View
*
view
()
override
;
26
TextField
* textField();
27
private
:
28
class
ContentView :
public
Responder
,
public
View
{
29
public
:
30
ContentView(
Responder
*
parentResponder
,
TextFieldDelegate
* textFieldDelegate);
31
void
didBecomeFirstResponder
()
override
;
32
TextField
* textField();
33
void
drawRect(
KDContext
* ctx,
KDRect
rect)
const override
;
34
KDSize
minimalSizeForOptimalDisplay()
const override
;
35
private
:
36
View
* subviewAtIndex(
int
index)
override
;
37
int
numberOfSubviews()
const override
;
38
void
layoutSubviews()
override
;
39
constexpr
static
KDCoordinate
k_inputHeight = 37;
40
constexpr
static
KDCoordinate
k_separatorThickness = 1;
41
constexpr
static
KDCoordinate
k_textMargin = 5;
42
TextField
m_textField;
43
char
m_textBody[
TextField::maxBufferSize
()];
44
};
45
ContentView m_view;
46
};
47
TextFieldController m_textFieldController;
48
Invocation
m_successAction;
49
Invocation
m_failureAction;
50
TextFieldDelegate
* m_textFieldDelegate;
51
};
52
53
#endif
ModalViewController
Definition:
modal_view_controller.h:7
TextField
Definition:
text_field.h:8
Invocation::Action
void(* Action)(void *context, void *sender)
Definition:
invocation.h:6
InputViewController::textFieldShouldFinishEditing
bool textFieldShouldFinishEditing(TextField *textField, Ion::Events::Event event) override
Definition:
input_view_controller.cpp:89
text_field_delegate.h
InputViewController::edit
void edit(Responder *caller, Ion::Events::Event event, void *context, const char *initialText, Invocation::Action successAction, Invocation::Action failureAction)
Definition:
input_view_controller.cpp:74
Toolbox
Definition:
toolbox.h:12
TextField::maxBufferSize
static constexpr int maxBufferSize()
Definition:
text_field.h:23
InputViewController::textFieldDidAbortEditing
bool textFieldDidAbortEditing(TextField *textField, const char *text) override
Definition:
input_view_controller.cpp:99
KDCoordinate
int16_t KDCoordinate
Definition:
coordinate.h:6
InputViewController
Definition:
input_view_controller.h:9
Responder::parentResponder
Responder * parentResponder() const
Definition:
responder.cpp:12
ModalViewController::view
View * view() override
Definition:
modal_view_controller.cpp:107
InputViewController::abortTextFieldEditionAndDismiss
void abortTextFieldEditionAndDismiss()
Definition:
input_view_controller.cpp:84
Invocation
Definition:
invocation.h:4
invocation.h
TextFieldDelegate
Definition:
text_field_delegate.h:8
Ion::Events::Event
Definition:
events.h:9
KDSize
Definition:
size.h:6
InputViewController::textBody
const char * textBody()
Definition:
input_view_controller.cpp:70
Responder
Definition:
responder.h:9
text_field.h
ModalViewController::didBecomeFirstResponder
void didBecomeFirstResponder() override
Definition:
modal_view_controller.cpp:132
modal_view_controller.h
KDContext
Definition:
context.h:8
InputViewController::toolboxForTextInput
Toolbox * toolboxForTextInput(TextInput *textInput) override
Definition:
input_view_controller.cpp:109
KDRect
Definition:
rect.h:26
View
Definition:
view.h:23
InputViewController::textFieldDidFinishEditing
bool textFieldDidFinishEditing(TextField *textField, const char *text, Ion::Events::Event event) override
Definition:
input_view_controller.cpp:93
InputViewController::InputViewController
InputViewController(Responder *parentResponder, ViewController *child, TextFieldDelegate *textFieldDelegate)
Definition:
input_view_controller.cpp:61
ViewController
Definition:
view_controller.h:30
InputViewController::textFieldDidReceiveEvent
bool textFieldDidReceiveEvent(TextField *textField, Ion::Events::Event event) override
Definition:
input_view_controller.cpp:105
TextInput
Definition:
text_input.h:10
epsilon
escher
include
escher
input_view_controller.h
Generated by
1.8.14