Files
Upsilon/apps/regression/prediction_parameter_controller.cpp
Émilie Feral 066878e4a7 [apps/regression] Display the goto parameter page from the prediction
parameter page

Change-Id: I942873a29e78af76edd349467c5d3e9155b27fb6
2017-01-09 15:08:56 +01:00

62 lines
1.8 KiB
C++

#include "prediction_parameter_controller.h"
#include <assert.h>
namespace Regression {
PredictionParameterController::PredictionParameterController(Responder * parentResponder, Data * data) :
ViewController(parentResponder),
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
Metric::BottomMargin, Metric::LeftMargin)),
m_goToParameterController(GoToParameterController(this, data))
{
}
const char * PredictionParameterController::title() const {
return "Droite de regression";
}
View * PredictionParameterController::view() {
return &m_selectableTableView;
}
void PredictionParameterController::didBecomeFirstResponder() {
m_selectableTableView.selectCellAtLocation(0, 0);
app()->setFirstResponder(&m_selectableTableView);
}
bool PredictionParameterController::handleEvent(Ion::Events::Event event) {
if (event == Ion::Events::OK) {
m_goToParameterController.setXPrediction(m_selectableTableView.selectedRow() == 0);
StackViewController * stack = (StackViewController *)parentResponder();
stack->push(&m_goToParameterController);
return true;
}
return false;
}
int PredictionParameterController::numberOfRows() {
return k_totalNumberOfCells;
};
TableViewCell * PredictionParameterController::reusableCell(int index) {
assert(index >= 0);
assert(index < k_totalNumberOfCells);
return &m_cells[index];
}
int PredictionParameterController::reusableCellCount() {
return k_totalNumberOfCells;
}
KDCoordinate PredictionParameterController::cellHeight() {
return 35;
}
void PredictionParameterController::willDisplayCellForIndex(TableViewCell * cell, int index) {
ChevronMenuListCell * myCell = (ChevronMenuListCell *)cell;
const char * titles[3] = {"Prediction sachant x", "Prediction sachant y"};
myCell->setText(titles[index]);
}
}