Files
Upsilon/apps/graph/graph/goto_parameter_controller.cpp
Émilie Feral bbe1b06eae [apps][escher] Use only one draftTextBuffer by controller (as you cannot
edit all cells at the same time)

Change-Id: Ifbc6e8c7b7f2dd17539666ed3b1253f1c28ef873
2016-12-15 13:51:40 +01:00

57 lines
1.5 KiB
C++

#include "goto_parameter_controller.h"
#include "../app.h"
#include <assert.h>
namespace Graph {
GoToParameterController::GoToParameterController(Responder * parentResponder, GraphView * graphView) :
FloatParameterController(parentResponder),
m_abscisseCell(EditableTextMenuListCell(&m_selectableTableView, this, m_draftTextBuffer, (char*)"x")),
m_graphView(graphView),
m_function(nullptr)
{
}
ExpressionTextFieldDelegate * GoToParameterController::textFieldDelegate() {
ExpressionTextFieldDelegate * myApp = (ExpressionTextFieldDelegate *)app();
return myApp;
}
const char * GoToParameterController::title() const {
return "Aller a";
}
float GoToParameterController::parameterAtIndex(int index) {
assert(index == 0);
return m_graphView->xCursorPosition();
}
void GoToParameterController::setParameterAtIndex(int parameterIndex, float f) {
assert(parameterIndex == 0);
m_graphView->goToAbscissaOnFunction(f, m_function);
}
int GoToParameterController::numberOfRows() {
return 1;
};
TableViewCell * GoToParameterController::reusableCell(int index) {
assert(index == 0);
return &m_abscisseCell;
}
int GoToParameterController::reusableCellCount() {
return 1;
}
void GoToParameterController::setFunction(Function * function) {
m_function = function;
}
bool GoToParameterController::textFieldDidReceiveEvent(TextField * textField, Ion::Events::Event event) {
App * myApp = (App *)app();
return myApp->textFieldDidReceiveEvent(textField, event);
}
}