Numworks Epsilon  1.4.1
Graphing Calculator Operating System
edit_expression_controller.h
Go to the documentation of this file.
1 #ifndef CALCULATION_EDIT_EXPRESSION_CONTROLLER_H
2 #define CALCULATION_EDIT_EXPRESSION_CONTROLLER_H
3 
4 #include <escher.h>
5 #include "../shared/text_field_delegate.h"
6 #include "history_controller.h"
7 #include "calculation_store.h"
8 #include "text_field.h"
9 
10 namespace Calculation {
11 class HistoryController;
12 
13 /* TODO: implement a split view */
15 public:
16  EditExpressionController(Responder * parentResponder, HistoryController * historyController, CalculationStore * calculationStore);
17  void didBecomeFirstResponder() override;
18  void viewDidDisappear() override;
19  bool handleEvent(Ion::Events::Event event) override;
20  const char * textBody();
21  void insertTextBody(const char * text);
22 bool textFieldDidReceiveEvent(::TextField * textField, Ion::Events::Event event) override;
23  bool textFieldDidFinishEditing(::TextField * textField, const char * text, Ion::Events::Event event) override;
24  bool textFieldDidAbortEditing(::TextField * textField, const char * text) override;
25 private:
26  class ContentView : public View {
27  public:
28  ContentView(Responder * parentResponder, TableView * subview, TextFieldDelegate * textFieldDelegate);
29  int numberOfSubviews() const override;
30  View * subviewAtIndex(int index) override;
31  void layoutSubviews() override;
32  TextField * textField();
33  TableView * mainView();
34  void drawRect(KDContext * ctx, KDRect rect) const override;
35  private:
36  static constexpr KDCoordinate k_textFieldHeight = 37;
37  static constexpr KDCoordinate k_textMargin= 5;
38  constexpr static int k_separatorThickness = 1;
39  TableView * m_mainView;
40  TextField m_textField;
41  char m_textBody[TextField::maxBufferSize()];
42  };
43  View * loadView() override;
44  void unloadView(View * view) override;
45  Shared::TextFieldDelegateApp * textFieldDelegateApp() override;
46  char m_cacheBuffer[TextField::maxBufferSize()];
47  HistoryController * m_historyController;
48  CalculationStore * m_calculationStore;
49 };
50 
51 }
52 
53 #endif
bool textFieldDidFinishEditing(::TextField *textField, const char *text, Ion::Events::Event event) override
static constexpr int maxBufferSize()
Definition: text_field.h:23
int16_t KDCoordinate
Definition: coordinate.h:6
Responder * parentResponder() const
Definition: responder.cpp:12
bool handleEvent(Ion::Events::Event event) override
Definition: rect.h:26
Definition: view.h:23
bool textFieldDidAbortEditing(::TextField *textField, const char *text) override
bool textFieldDidReceiveEvent(::TextField *textField, Ion::Events::Event event) override
EditExpressionController(Responder *parentResponder, HistoryController *historyController, CalculationStore *calculationStore)