[apps/graph/list] handle deleting functions from the parameter page

Change-Id: I34eff520f40ed5901011499c770c1b06d72b3cc7
This commit is contained in:
Émilie Feral
2016-09-22 15:08:07 +02:00
parent 82ea774621
commit ff70414108
3 changed files with 13 additions and 5 deletions

View File

@@ -7,7 +7,7 @@ ListController::ListController(Responder * parentResponder, Graph::FunctionStore
m_activeCell(-1),
m_manualScrolling(0),
m_functionStore(functionStore),
m_parameterController(ParameterController(this))
m_parameterController(ParameterController(this, functionStore))
{
}

View File

@@ -1,13 +1,14 @@
#include "parameter_controller.h"
#include <assert.h>
ParameterController::ParameterController(Responder * parentResponder) :
ParameterController::ParameterController(Responder * parentResponder, Graph::FunctionStore * functionStore) :
ViewController(parentResponder),
m_colorCell(TableViewCell((char*)"Couleur de la fonction")),
m_enableCell(SwitchTableViewCell((char*)"Activer/Desactiver")),
m_deleteCell(TableViewCell((char*)"Supprimer la fonction")),
m_tableView(TableView(this)),
m_activeCell(0)
m_activeCell(0),
m_functionStore(functionStore)
{
}
@@ -78,13 +79,19 @@ bool ParameterController::handleEnter() {
return true;
}
case 2:
{
m_functionStore->removeFunction(m_function);
StackViewController * stack = (StackViewController *)(parentResponder());
stack->pop();
return true;
}
default:
{
return false;
}
}
}
int ParameterController::numberOfCells() {
return k_totalNumberOfCell;
};

View File

@@ -7,7 +7,7 @@
class ParameterController : public ViewController, public TableViewDataSource {
public:
ParameterController(Responder * parentResponder);
ParameterController(Responder * parentResponder, Graph::FunctionStore * functionStore);
View * view() override;
const char * title() const override;
@@ -30,6 +30,7 @@ private:
TableView m_tableView;
int m_activeCell;
Graph::Function * m_function;
Graph::FunctionStore * m_functionStore;
};
#endif