Files
Upsilon/apps/apps_container.cpp
Émilie Feral b101308922 [apps/calculation] Rename calcul->calculation
Change-Id: I57ca7353516cee2da33470a8a0f622a21c3fe7e9
2016-10-25 17:55:28 +02:00

38 lines
736 B
C++

#include "apps_container.h"
extern "C" {
#include <assert.h>
}
AppsContainer::AppsContainer() :
Container(),
m_homeApp(this),
m_graphApp(&m_context),
m_calculationApp(&m_context),
m_context(Context())
{
}
int AppsContainer::numberOfApps() {
return k_numberOfApps;
}
App * AppsContainer::appAtIndex(int index) {
static App * apps[] = {
&m_homeApp,
&m_graphApp,
&m_probabilityApp,
&m_calculationApp,
};
assert(sizeof(apps)/sizeof(apps[0]) == k_numberOfApps);
assert(index >= 0 && index < k_numberOfApps);
return apps[index];
}
bool AppsContainer::handleEvent(Ion::Events::Event event) {
if (event == Ion::Events::Event::F1) {
switchTo(appAtIndex(0));
return true;
}
return false;
}