Numworks Epsilon  1.4.1
Graphing Calculator Operating System
store_controller.cpp
Go to the documentation of this file.
1 #include "store_controller.h"
2 #include "app.h"
3 #include "../apps_container.h"
4 #include "../constant.h"
5 #include "../../poincare/src/layout/baseline_relative_layout.h"
6 #include "../../poincare/src/layout/string_layout.h"
7 #include <assert.h>
8 
9 using namespace Poincare;
10 using namespace Shared;
11 
12 namespace Regression {
13 
14 StoreController::StoreController(Responder * parentResponder, Store * store, ButtonRowController * header) :
15  Shared::StoreController(parentResponder, store, header),
16  m_titleCells{}
17 {
18  m_titleLayout[0] = new BaselineRelativeLayout(new StringLayout("X", 1, KDText::FontSize::Small), new StringLayout("i", 1, KDText::FontSize::Small), BaselineRelativeLayout::Type::Subscript);
19  m_titleLayout[1] = new BaselineRelativeLayout(new StringLayout("Y", 1, KDText::FontSize::Small), new StringLayout("i", 1, KDText::FontSize::Small), BaselineRelativeLayout::Type::Subscript);
20 }
21 
23  for (int i = 0; i < 2; i++) {
24  if (m_titleLayout[i]) {
25  delete m_titleLayout[i];
26  m_titleLayout[i] = nullptr;
27  }
28  }
29 }
30 
32  ::StoreController::willDisplayCellAtLocation(cell, i, j);
33  if (cellAtLocationIsEditable(i, j)) {
34  return;
35  }
36  EvenOddExpressionCell * mytitleCell = (EvenOddExpressionCell *)cell;
37  mytitleCell->setExpression(m_titleLayout[i]);
38 }
39 
40 HighlightCell * StoreController::titleCells(int index) {
41  assert(index >= 0 && index < k_numberOfTitleCells);
42  return m_titleCells[index];
43 }
44 
45 View * StoreController::loadView() {
46  for (int i = 0; i < k_numberOfTitleCells; i++) {
47  m_titleCells[i] = new EvenOddExpressionCell(0.5f, 0.5f);
48  }
50 }
51 
52 void StoreController::unloadView(View * view) {
53  for (int i = 0; i < k_numberOfTitleCells; i++) {
54  delete m_titleCells[i];
55  m_titleCells[i] = nullptr;
56  }
58 }
59 
60 }
#define assert(e)
Definition: assert.h:9
void unloadView(View *view) override
View * loadView() override
Definition: view.h:23
static constexpr int k_numberOfTitleCells
void willDisplayCellAtLocation(HighlightCell *cell, int i, int j) override
void setExpression(Poincare::ExpressionLayout *expressionLayout)
bool cellAtLocationIsEditable(int columnIndex, int rowIndex) override