Numworks Epsilon  1.4.1
Graphing Calculator Operating System
variable_box_controller.h
Go to the documentation of this file.
1 #ifndef APPS_VARIABLE_BOX_CONTROLLER_H
2 #define APPS_VARIABLE_BOX_CONTROLLER_H
3 
4 #define MATRIX_VARIABLES 1
5 
6 #include <escher.h>
7 #include <poincare.h>
9 #include "i18n.h"
10 
12 public:
14  void didBecomeFirstResponder() override;
15  void setTextFieldCaller(TextField * textField);
16  void viewWillAppear() override;
17  void viewDidDisappear() override;
18 private:
19  class ContentViewController : public ViewController, public ListViewDataSource, public SelectableTableViewDataSource {
20  public:
21  ContentViewController(Responder * parentResponder, Poincare::GlobalContext * context);
22  View * view() override;
23  const char * title() override;
24  void didBecomeFirstResponder() override;
25  bool handleEvent(Ion::Events::Event event) override;
26  int numberOfRows() override;
27  HighlightCell * reusableCell(int index, int type) override;
28  int reusableCellCount(int type) override;
29  void willDisplayCellForIndex(HighlightCell * cell, int index) override;
30  KDCoordinate rowHeight(int j) override;
31  KDCoordinate cumulatedHeightFromIndex(int j) override;
32  int indexFromCumulatedHeight(KDCoordinate offsetY) override;
33  int typeAtLocation(int i, int j) override;
34  void setTextFieldCaller(TextField * textField);
35  void reloadData();
36  void resetPage();
37  void viewDidDisappear() override;
38  private:
39  enum class Page {
40  RootMenu,
41  Scalar,
42 #if LIST_VARIABLES
43  List,
44 #endif
45  Matrix
46  };
47  constexpr static int k_maxNumberOfDisplayedRows = 6; //240/40
48 #if LIST_VARIABLES
49  constexpr static int k_numberOfMenuRows = 3;
50 #else
51  constexpr static int k_numberOfMenuRows = 2;
52 #endif
53  constexpr static KDCoordinate k_leafMargin = 10;
54  Page pageAtIndex(int index);
55  void putLabelAtIndexInBuffer(int index, char * buffer);
56  I18n::Message nodeLabelAtIndex(int index);
57  const Poincare::Expression * expressionForIndex(int index);
58  Poincare::ExpressionLayout * expressionLayoutForIndex(int index);
59 
60  Poincare::GlobalContext * m_context;
61  TextField * m_textFieldCaller;
62  int m_firstSelectedRow;
63  int m_previousSelectedRow;
64  Page m_currentPage;
65  VariableBoxLeafCell m_leafCells[k_maxNumberOfDisplayedRows];
66  MessageTableCellWithChevron m_nodeCells[k_numberOfMenuRows];
67  SelectableTableView m_selectableTableView;
68  };
69  ContentViewController m_contentViewController;
70 };
71 
72 #endif
void setTextFieldCaller(TextField *textField)
int16_t KDCoordinate
Definition: coordinate.h:6
Responder * parentResponder() const
Definition: responder.cpp:12
const char * title() override
bool handleEvent(Ion::Events::Event event) override
VariableBoxController(Poincare::GlobalContext *context)
Definition: view.h:23
constexpr uint8_t numberOfRows
Definition: keyboard.h:35