Blame view

build4/epsilon-master/apps/solver/list_controller.h 3.17 KB
6663b6c9   adorian   projet complet av...
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
  #ifndef SOLVER_LIST_CONTROLLER_H
  #define SOLVER_LIST_CONTROLLER_H
  
  #include <escher.h>
  #include "../shared/expression_model_list_controller.h"
  #include "../shared/expression_layout_field_delegate.h"
  #include "../shared/text_field_delegate.h"
  #include "equation_store.h"
  #include "equation_list_view.h"
  #include "equation_models_parameter_controller.h"
  #include "../i18n.h"
  
  namespace Solver {
  
  class ListController : public Shared::ExpressionModelListController, public ButtonRowDelegate, public ListViewDataSource, public Shared::TextFieldDelegate, public Shared::ExpressionLayoutFieldDelegate {
  public:
    ListController(Responder * parentResponder, EquationStore * equationStore, ButtonRowController * footer);
    /* ButtonRowDelegate */
    int numberOfButtons(ButtonRowController::Position position) const override;
    Button * buttonAtIndex(int index, ButtonRowController::Position position) const override;
    /* ListViewDataSource */
    int numberOfRows() override {
      return numberOfExpressionRows();
    }
    KDCoordinate rowHeight(int j) override {
      return expressionRowHeight(j);
    }
    int typeAtLocation(int i, int j) override;
    HighlightCell * reusableCell(int index, int type) override;
    int reusableCellCount(int type) override;
    void willDisplayCellForIndex(HighlightCell * cell, int index) override;
    /* Responder */
    bool handleEvent(Ion::Events::Event event) override;
    void didBecomeFirstResponder() override;
    void didEnterResponderChain(Responder * previousFirstResponder) override;
    void editExpression(Shared::ExpressionModel * model, Ion::Events::Event event) override { return Shared::ExpressionModelListController::editExpression(model, event); }
    /* Text/ExpressionLayout Field Delegate */
    Shared::TextFieldDelegateApp * textFieldDelegateApp() override;
    Shared::ExpressionFieldDelegateApp * expressionFieldDelegateApp() override;
    bool textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) override;
    bool expressionLayoutFieldDidReceiveEvent(ExpressionLayoutField * expressionLayoutField, Ion::Events::Event event) override;
    bool textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) override;
    bool expressionLayoutFieldDidFinishEditing(ExpressionLayoutField * expressionLayoutField, Poincare::ExpressionLayout * layout, Ion::Events::Event event) override;
    /* Specific to Solver */
    void resolveEquations();
  private:
    constexpr static int k_maxNumberOfRows = 5; // Ion::Display::Height / Metric::StoreRowHeight = 4.8;
    SelectableTableView * selectableTableView() override;
    void reloadButtonMessage();
    void addEmptyModel() override;
    bool removeModelRow(Shared::ExpressionModel * function) override;
    void reloadBrace();
    View * loadView() override;
    void unloadView(View * view) override;
    Shared::ExpressionModelStore * modelStore() override { return m_equationStore; }
    StackViewController * stackController() const;
    InputViewController * inputController() override;
    EquationStore * m_equationStore;
    EvenOddExpressionCell * m_expressionCells[k_maxNumberOfRows];
    Button m_resolveButton;
    EquationModelsParameterController m_modelsParameterController;
    StackViewController m_modelsStackController;
  };
  
  }
  
  #endif