Files
Upsilon/apps/shared/storage_function_curve_parameter_controller.cpp
Émilie Feral c70278941a [graph] Do not keep a function pointer as member variable but a record.
Indeed, function pointers can become invalid at any point...
2018-11-23 12:04:02 +01:00

44 lines
1.2 KiB
C++

#include "storage_function_curve_parameter_controller.h"
#include <assert.h>
namespace Shared {
StorageFunctionCurveParameterController::StorageFunctionCurveParameterController(InteractiveCurveViewRange * graphRange, CurveViewCursor * cursor) :
ViewController(nullptr),
m_goToCell(I18n::Message::Goto),
m_selectableTableView(this, this, this),
m_record()
{
}
View * StorageFunctionCurveParameterController::view() {
return &m_selectableTableView;
}
void StorageFunctionCurveParameterController::didBecomeFirstResponder() {
if (selectedRow() < 0) {
selectCellAtLocation(0, 0);
}
app()->setFirstResponder(&m_selectableTableView);
}
bool StorageFunctionCurveParameterController::handleGotoSelection() {
if (m_record.isNull()) {
return false;
}
goToParameterController()->setRecord(m_record);
StackViewController * stack = (StackViewController *)parentResponder();
stack->push(goToParameterController());
return true;
}
KDCoordinate StorageFunctionCurveParameterController::cellHeight() {
return Metric::ParameterCellHeight;
}
void StorageFunctionCurveParameterController::setRecord(Ion::Storage::Record record) {
m_record = record;
}
}