Blame view

build3/apps/regression/calculation_controller.h 2.58 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
  #ifndef REGRESSION_CALCULATION_CONTROLLER_H
  #define REGRESSION_CALCULATION_CONTROLLER_H
  
  #include <escher.h>
  #include "store.h"
  #include "even_odd_double_buffer_text_cell.h"
  #include "../shared/tab_table_controller.h"
  #include "../shared/regular_table_view_data_source.h"
  
  namespace Regression {
  
  class CalculationController : public Shared::TabTableController, public Shared::RegularTableViewDataSource, public SelectableTableViewDelegate, public ButtonRowDelegate, public AlternateEmptyViewDelegate  {
  
  public:
    CalculationController(Responder * parentResponder, ButtonRowController * header, Store * store);
    ~CalculationController();
    CalculationController(const CalculationController& other) = delete;
    CalculationController(CalculationController&& other) = delete;
    CalculationController& operator=(const CalculationController& other) = delete;
    CalculationController& operator=(CalculationController&& other) = delete;
    const char * title() override;
    bool handleEvent(Ion::Events::Event event) override;
    void didBecomeFirstResponder() override;
    void tableViewDidChangeSelection(SelectableTableView * t, int previousSelectedCellX, int previousSelectedCellY) override;
  
    bool isEmpty() const override;
    I18n::Message emptyMessage() override;
    Responder * defaultController() override;
  
    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;
    HighlightCell * reusableCell(int index, int type) override;
    int reusableCellCount(int type) override;
    int typeAtLocation(int i, int j) override;
  private:
    Responder * tabController() const override;
    View * loadView() override;
    void unloadView(View * view) override;
    constexpr static int k_totalNumberOfRows = 14;
    constexpr static int k_totalNumberOfColumns = 2;
    constexpr static int k_maxNumberOfDisplayableRows = 11;
    constexpr static int k_totalNumberOfDoubleBufferRows = 5;
    static constexpr KDCoordinate k_cellHeight = 25;
    static constexpr KDCoordinate k_cellWidth = Ion::Display::Width/2 - Metric::CommonRightMargin/2 - Metric::CommonLeftMargin/2;
    EvenOddMessageTextCell * m_titleCells[k_maxNumberOfDisplayableRows];
    EvenOddExpressionCell * m_r2TitleCell;
    Poincare::ExpressionLayout * m_r2Layout;
    EvenOddDoubleBufferTextCell * m_columnTitleCell;
    EvenOddDoubleBufferTextCell * m_doubleCalculationCells[k_totalNumberOfDoubleBufferRows];
    EvenOddBufferTextCell * m_calculationCells[k_totalNumberOfRows-k_totalNumberOfDoubleBufferRows];
    Store * m_store;
  };
  
  }
  
  #endif