Blame view

epsilon-master/apps/regression/regression_controller.h 1.46 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
  #ifndef REGRESSION_REGRESSION_CONTROLLER_H
  #define REGRESSION_REGRESSION_CONTROLLER_H
  
  #include "store.h"
  #include <escher.h>
  #include "../i18n.h"
  
  namespace Regression {
  
  class RegressionController : public ViewController, public ListViewDataSource, public SelectableTableViewDataSource {
  public:
    constexpr static KDCoordinate k_logisticCellHeight = 47;
    RegressionController(Responder * parentResponder, Store * store);
    void setSeries(int series) { m_series = series; }
    // ViewController
    const char * title() override;
    View * view() override { return &m_selectableTableView; }
  
    // Responder
    bool handleEvent(Ion::Events::Event event) override;
    void didBecomeFirstResponder() override;
  
    // ListViewDataSource
    KDCoordinate rowHeight(int j) override;
    KDCoordinate cumulatedHeightFromIndex(int j) override;
    int indexFromCumulatedHeight(KDCoordinate offsetY) override;
    HighlightCell * reusableCell(int index, int type) override;
    int reusableCellCount(int type) override { return k_numberOfCells; }
    int typeAtLocation(int i, int j) override { return 0; }
    int numberOfRows() override { return k_numberOfRows; }
    void willDisplayCellAtLocation(HighlightCell * cell, int i, int j) override;
  private:
    constexpr static int k_numberOfRows = 9;
    constexpr static int k_numberOfCells = 6; // (240 - 70) / 35
    MessageTableCellWithExpression m_regressionCells[k_numberOfCells];
    SelectableTableView m_selectableTableView;
    Store * m_store;
    int m_series;
  };
  
  }
  
  #endif