Blame view

epsilon-master/apps/solver/solutions_controller.h 2.6 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
68
69
70
  #ifndef SOLVER_SOLUTIONS_CONTROLLER_H
  #define SOLVER_SOLUTIONS_CONTROLLER_H
  
  #include <escher.h>
  #include "equation_store.h"
  #include "../shared/scrollable_exact_approximate_expressions_cell.h"
  #include "../i18n.h"
  
  namespace Solver {
  
  class SolutionsController : public ViewController, public AlternateEmptyViewDelegate, public SelectableTableViewDataSource, public TableViewDataSource {
  public:
    SolutionsController(Responder * parentResponder, EquationStore * equationStore);
    ~SolutionsController();
    /* ViewController */
    const char * title() override;
    View * view() override;
    void viewWillAppear() override;
    /* AlternateEmptyViewDelegate */
    bool isEmpty() const override;
    virtual I18n::Message emptyMessage() override;
    virtual Responder * defaultController() override;
    /* TableViewDataSource */
    int numberOfRows() override;
    int numberOfColumns() override;
    void willDisplayCellAtLocation(HighlightCell * cell, int i, int j) override;
    KDCoordinate columnWidth(int i) override;
    KDCoordinate rowHeight(int j) override;
    KDCoordinate cumulatedWidthFromIndex(int i) override;
    int indexFromCumulatedWidth(KDCoordinate offsetX) override;
    HighlightCell * reusableCell(int index, int type) override;
    int reusableCellCount(int type) override;
    int typeAtLocation(int i, int j) override;
    /* Responder */
    void didBecomeFirstResponder() override;
  
  private:
    class ContentView : public View {
    public:
      ContentView(SolutionsController * controller);
      void drawRect(KDContext * ctx, KDRect rect) const override;
      void setWarningMoreSolutions(bool warning);
      SelectableTableView * selectableTableView() {
        return &m_selectableTableView;
      }
    private:
      constexpr static KDCoordinate k_topMargin = 50;
      int numberOfSubviews() const override;
      View * subviewAtIndex(int index) override;
      void layoutSubviews() override;
      MessageTextView m_warningMessageView0;
      MessageTextView m_warningMessageView1;
      SelectableTableView m_selectableTableView;
      bool m_displayWarningMoreSolutions;
    };
    constexpr static int k_symbolCellWidth = 90;
    constexpr static int k_valueCellWidth = 190;
    constexpr static KDCoordinate k_defaultCellHeight = 20;
    EquationStore * m_equationStore;
    EvenOddBufferTextCell m_symbolCells[EquationStore::k_maxNumberOfSolutions];
    EvenOddExpressionCell m_deltaCell;
    Poincare::ExpressionLayout * m_delta2Layout;
    Shared::ScrollableExactApproximateExpressionsCell m_exactValueCells[EquationStore::k_maxNumberOfExactSolutions];
    EvenOddBufferTextCell m_approximateValueCells[EquationStore::k_maxNumberOfApproximateSolutions];
    ContentView m_contentView;
  };
  
  }
  
  #endif