[escher] Change dynamic view controller paradigm

Change-Id: I57fd41c9b9ad8a1e8b684b97fdf80ddffd71881d
This commit is contained in:
Émilie Feral
2017-05-03 10:26:44 +02:00
parent a1f3c21d9b
commit 70fc734f7b
61 changed files with 338 additions and 475 deletions

View File

@@ -25,6 +25,7 @@ void FloatParameterController::didBecomeFirstResponder() {
}
void FloatParameterController::viewWillAppear() {
DynamicViewController::viewWillAppear();
selectableTableView()->reloadData();
if (selectedRow() == -1) {
selectCellAtLocation(0, 0);
@@ -169,13 +170,6 @@ int FloatParameterController::activeCell() {
return selectedRow();
}
void FloatParameterController::unloadView() {
assert(m_okButton != nullptr);
delete m_okButton;
m_okButton = nullptr;
DynamicViewController::unloadView();
}
StackViewController * FloatParameterController::stackController() {
return (StackViewController *)parentResponder();
}
@@ -184,16 +178,6 @@ SelectableTableView * FloatParameterController::selectableTableView() {
return (SelectableTableView *)view();
}
View * FloatParameterController::createView() {
SelectableTableView * tableView = new SelectableTableView(this, this, 0, 1, Metric::CommonTopMargin, Metric::CommonRightMargin, Metric::CommonBottomMargin, Metric::CommonLeftMargin, this);
assert(m_okButton == nullptr);
m_okButton = new ButtonWithSeparator(tableView, okButtonText(), Invocation([](void * context, void * sender) {
FloatParameterController * parameterController = (FloatParameterController *) context;
parameterController->buttonAction();
}, this));
return tableView;
}
void FloatParameterController::buttonAction() {
StackViewController * stack = stackController();
stack->pop();
@@ -203,4 +187,19 @@ I18n::Message FloatParameterController::okButtonText() {
return I18n::Message::Ok;
}
View * FloatParameterController::loadView() {
SelectableTableView * tableView = new SelectableTableView(this, this, 0, 1, Metric::CommonTopMargin, Metric::CommonRightMargin, Metric::CommonBottomMargin, Metric::CommonLeftMargin, this);
m_okButton = new ButtonWithSeparator(tableView, okButtonText(), Invocation([](void * context, void * sender) {
FloatParameterController * parameterController = (FloatParameterController *) context;
parameterController->buttonAction();
}, this));
return tableView;
}
void FloatParameterController::unloadView(View * view) {
delete m_okButton;
m_okButton = nullptr;
delete view;
}
}