Files
Upsilon/apps/graph/graph/goto_parameter_controller.cpp
Émilie Feral 8c284ba34f [escher][apps] CHange textField API
Change-Id: I766d153b7f7429473f297707a08358051123accc
2016-12-15 13:51:40 +01:00

59 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((char*)"x")),
m_graphView(graphView),
m_function(nullptr)
{
m_abscisseCell.setParentResponder(&m_selectableTableView);
m_abscisseCell.setDelegate(this);
}
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);
}
}