prediction_parameter_controller.cpp
2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#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() {
if (selectedRow() < 0) {
selectCellAtLocation(0, 0);
}
app()->setFirstResponder(&m_selectableTableView);
}
bool PredictionParameterController::handleEvent(Ion::Events::Event event) {
if (event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Right) {
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]);
}
}