mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-26 17:20:53 +01:00
[ion] Update the Event model
Change-Id: I41a53caeb7dd8a15e7934f49675f6a53be8fe7be
This commit is contained in:
committed by
Émilie Feral
parent
b220ed5dd8
commit
b87f06e3a2
@@ -69,28 +69,26 @@ void EditExpressionController::setTextBody(const char * text) {
|
||||
}
|
||||
|
||||
bool EditExpressionController::handleEvent(Ion::Events::Event event) {
|
||||
switch (event) {
|
||||
case Ion::Events::Event::ENTER:
|
||||
{
|
||||
Calculation calculation = Calculation();
|
||||
App * calculationApp = (App *)app();
|
||||
calculation.setContent(textBody(), calculationApp->evaluateContext());
|
||||
m_calculationStore->push(&calculation);
|
||||
m_historyController->reload();
|
||||
m_contentView.mainView()->scrollToCell(0, m_historyController->numberOfRows()-1);
|
||||
m_contentView.textField()->setText("");
|
||||
return true;
|
||||
}
|
||||
case Ion::Events::Event::ESC:
|
||||
return true;
|
||||
case Ion::Events::Event::UP_ARROW:
|
||||
if (m_calculationStore->numberOfCalculations() > 0) {
|
||||
app()->setFirstResponder(m_historyController);
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
if (event == Ion::Events::OK) {
|
||||
Calculation calculation = Calculation();
|
||||
App * calculationApp = (App *)app();
|
||||
calculation.setContent(textBody(), calculationApp->evaluateContext());
|
||||
m_calculationStore->push(&calculation);
|
||||
m_historyController->reload();
|
||||
m_contentView.mainView()->scrollToCell(0, m_historyController->numberOfRows()-1);
|
||||
m_contentView.textField()->setText("");
|
||||
return true;
|
||||
}
|
||||
if (event == Ion::Events::Back) {
|
||||
return true;
|
||||
}
|
||||
if (event == Ion::Events::Up) {
|
||||
if (m_calculationStore->numberOfCalculations() > 0) {
|
||||
app()->setFirstResponder(m_historyController);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void EditExpressionController::didBecomeFirstResponder() {
|
||||
|
||||
Reference in New Issue
Block a user