[apps/sequence] Create a class curve parameter controller

Change-Id: I3e940c1e3826ae7a72d757058f3f7095a7eea22e
This commit is contained in:
Émilie Feral
2017-02-23 09:37:01 +01:00
parent 5600e52014
commit 90a816ac62
3 changed files with 72 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
app_objs += $(addprefix apps/sequence/,\
app.o\
graph/banner_view.o\
graph/curve_parameter_controller.o\
graph/curve_view_range.o\
graph/graph_view.o\
list/list_controller.o\

View File

@@ -0,0 +1,47 @@
#include "curve_parameter_controller.h"
#include <assert.h>
using namespace Shared;
namespace Sequence {
CurveParameterController::CurveParameterController(InteractiveCurveViewRange * graphRange, CurveViewCursor * cursor) :
FunctionCurveParameterController(graphRange, cursor),
m_sumCell(PointerTableCell((char*)"Somme des termes"))
{
}
const char * CurveParameterController::title() const {
return "Options de la suite";
}
bool CurveParameterController::handleEvent(Ion::Events::Event event) {
if (event == Ion::Events::OK) {
switch (m_selectableTableView.selectedRow()) {
case 0:
return true;
case 1:
return handleGotoSelection();
default:
return false;
}
}
return false;
}
int CurveParameterController::numberOfRows() {
return k_totalNumberOfCells;
};
HighlightCell * CurveParameterController::reusableCell(int index) {
assert(index >= 0);
assert(index < k_totalNumberOfCells);
HighlightCell * cells[] = {&m_sumCell, &m_goToCell};
return cells[index];
}
int CurveParameterController::reusableCellCount() {
return k_totalNumberOfCells;
}
}

View File

@@ -0,0 +1,24 @@
#ifndef SEQUENCE_CURVE_PARAMETER_CONTROLLER_H
#define SEQUENCE_CURVE_PARAMETER_CONTROLLER_H
#include <escher.h>
#include "../../shared/function_curve_parameter_controller.h"
namespace Sequence {
class CurveParameterController : public Shared::FunctionCurveParameterController {
public:
CurveParameterController(Shared::InteractiveCurveViewRange * graphRange, Shared::CurveViewCursor * cursor);
const char * title() const override;
bool handleEvent(Ion::Events::Event event) override;
int numberOfRows() override;
HighlightCell * reusableCell(int index) override;
int reusableCellCount() override;
private:
constexpr static int k_totalNumberOfCells = 2;
PointerTableCell m_sumCell;
};
}
#endif