Files
Upsilon/apps/regression/prediction_parameter_controller.cpp
Émilie Feral 5259b3ab94 [apps/regression] When predicting regression, select the line instead of
dots

Change-Id: Ia86c06fa64af8aec68ea9b53ba8534e58be1b64b
2017-05-19 15:00:24 +02:00

64 lines
2.0 KiB
C++

#include "prediction_parameter_controller.h"
#include <assert.h>
using namespace Shared;
namespace Regression {
PredictionParameterController::PredictionParameterController(Responder * parentResponder, Store * store, CurveViewCursor * cursor, GraphController * graphController) :
ViewController(parentResponder),
m_selectableTableView(this, this, 0, 1, Metric::CommonTopMargin, Metric::CommonRightMargin,
Metric::CommonBottomMargin, Metric::CommonLeftMargin, this),
m_goToParameterController(this, store, cursor, graphController)
{
}
const char * PredictionParameterController::title() {
return I18n::translate(I18n::Message::RegressionSlope);
}
View * PredictionParameterController::view() {
return &m_selectableTableView;
}
void PredictionParameterController::didBecomeFirstResponder() {
selectCellAtLocation(0, 0);
app()->setFirstResponder(&m_selectableTableView);
}
bool PredictionParameterController::handleEvent(Ion::Events::Event event) {
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
m_goToParameterController.setXPrediction(selectedRow() == 0);
StackViewController * stack = (StackViewController *)parentResponder();
stack->push(&m_goToParameterController);
return true;
}
return false;
}
int PredictionParameterController::numberOfRows() {
return k_totalNumberOfCells;
};
HighlightCell * 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 Metric::ParameterCellHeight;
}
void PredictionParameterController::willDisplayCellForIndex(HighlightCell * cell, int index) {
MessageTableCellWithChevron * myCell = (MessageTableCellWithChevron *)cell;
I18n::Message titles[2] = {I18n::Message::XPrediction, I18n::Message::YPrediction};
myCell->setMessage(titles[index]);
}
}