mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/statistics] Add pop-up to confirm parameter discard
Change-Id: I0d0d7dca0e167cfcb40f4b26d8208e12056ebf40
This commit is contained in:
committed by
Émilie Feral
parent
a922e44558
commit
b2d7ee800a
@@ -10,7 +10,12 @@ namespace Statistics {
|
||||
HistogramParameterController::HistogramParameterController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, Store * store) :
|
||||
FloatParameterController<double>(parentResponder),
|
||||
m_cells{},
|
||||
m_store(store)
|
||||
m_store(store),
|
||||
m_confirmPopUpController(Invocation([](void * context, void * sender) {
|
||||
Container::activeApp()->dismissModalViewController();
|
||||
((HistogramParameterController *)context)->stackController()->pop();
|
||||
return true;
|
||||
}, this))
|
||||
{
|
||||
for (int i = 0; i < k_numberOfCells; i++) {
|
||||
m_cells[i].setParentResponder(&m_selectableTableView);
|
||||
@@ -39,6 +44,15 @@ void HistogramParameterController::willDisplayCellForIndex(HighlightCell * cell,
|
||||
FloatParameterController::willDisplayCellForIndex(cell, index);
|
||||
}
|
||||
|
||||
bool HistogramParameterController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::Back && (extractParameterAtIndex(0) != parameterAtIndex(0) || extractParameterAtIndex(1) != parameterAtIndex(1))) {
|
||||
// Temporary values are different, open pop-up to confirm discarding values
|
||||
Container::activeApp()->displayModalViewController(&m_confirmPopUpController, 0.f, 0.f, Metric::ExamPopUpTopMargin, Metric::PopUpRightMargin, Metric::ExamPopUpBottomMargin, Metric::PopUpLeftMargin);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
double HistogramParameterController::extractParameterAtIndex(int index) {
|
||||
assert(index >= 0 && index < k_numberOfCells);
|
||||
return index == 0 ? m_store->barWidth() : m_store->firstDrawnBarAbscissa();
|
||||
|
||||
Reference in New Issue
Block a user