Numworks Epsilon  1.4.1
Graphing Calculator Operating System
function_parameter_controller.cpp
Go to the documentation of this file.
2 #include "values_controller.h"
3 #include <assert.h>
4 
5 using namespace Shared;
6 
7 namespace Graph {
8 
9 FunctionParameterController::FunctionParameterController(ValuesController * valuesController) :
11  m_displayDerivativeColumn(I18n::Message::DerivativeFunctionColumn),
12  m_cartesianFunction(nullptr),
13  m_valuesController(valuesController)
14 {
15 }
16 
18  m_cartesianFunction = (CartesianFunction *)function;
19  ValuesFunctionParameterController::setFunction(function);
20 }
21 
23  if (event == Ion::Events::OK || event == Ion::Events::EXE) {
24  switch (selectedRow()) {
25  case 0:
26  {
27  m_cartesianFunction->setDisplayDerivative(!m_cartesianFunction->displayDerivative());
29  return true;
30  }
31 #if COPY_COLUMN
32  case 1:
33  /* TODO: implement function copy column */
34  return true;
35 #endif
36  default:
37  assert(false);
38  return false;
39  }
40  }
41  return false;
42 }
43 
45  return k_totalNumberOfCell;
46 };
47 
49  assert(index >= 0);
50  assert(index < k_totalNumberOfCell);
51 #if COPY_COLUMN
52  HighlightCell * cells[] = {&m_displayDerivativeColumn, &m_copyColumn};
53 #else
54  HighlightCell * cells[] = {&m_displayDerivativeColumn};
55 #endif
56  return cells[index];
57 }
58 
60  return k_totalNumberOfCell;
61 }
62 
64  ValuesFunctionParameterController::viewWillAppear();
65  if (m_cartesianFunction->displayDerivative()) {
66  m_valuesController->selectCellAtLocation(m_valuesController->selectedColumn()+1, m_valuesController->selectedRow());
67  }
68 }
69 
71  if (cell == &m_displayDerivativeColumn) {
72  SwitchView * switchView = (SwitchView *)m_displayDerivativeColumn.accessoryView();
73  switchView->setState(m_cartesianFunction->displayDerivative());
74  }
75 }
76 
77 }
Definition: i18n.h:6
#define assert(e)
Definition: assert.h:9
constexpr Event EXE
Definition: events.h:114
void setDisplayDerivative(bool display)
void willDisplayCellForIndex(HighlightCell *cell, int index) override
bool handleEvent(Ion::Events::Event event) override
Definition: app.cpp:9
void reloadData(bool setFirstResponder=true)
HighlightCell * reusableCell(int index) override
constexpr Event OK
Definition: events.h:65
void setState(bool state)
Definition: switch_view.cpp:45
void setFunction(Shared::Function *function) override