Files
Upsilon/apps/statistics/store_controller.cpp
Émilie Feral 1964d61fdc [libaxx] add cmath and use cmath instead of math.h when required
Change-Id: Id839b17d33c69e2e002f370e553ff35246a1bc90
2017-08-16 09:55:29 +02:00

63 lines
1.7 KiB
C++

#include "store_controller.h"
#include "app.h"
#include "../apps_container.h"
#include "../constant.h"
#include <assert.h>
#include <cmath>
using namespace Shared;
namespace Statistics {
StoreController::StoreController(Responder * parentResponder, Store * store, ButtonRowController * header) :
Shared::StoreController(parentResponder, store, header),
m_titleCells{}
{
}
void StoreController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) {
::StoreController::willDisplayCellAtLocation(cell, i, j);
if (cellAtLocationIsEditable(i, j)) {
return;
}
EvenOddMessageTextCell * mytitleCell = (EvenOddMessageTextCell *)cell;
if (i == 0) {
mytitleCell->setMessage(I18n::Message::Values);
return;
}
mytitleCell->setMessage(I18n::Message::Sizes);
}
HighlightCell * StoreController::titleCells(int index) {
assert(index >= 0 && index < k_numberOfTitleCells);
return m_titleCells[index];
}
bool StoreController::setDataAtLocation(float floatBody, int columnIndex, int rowIndex) {
if (columnIndex == 1) {
if (floatBody < 0) {
return false;
}
m_store->set(std::round(floatBody), columnIndex, rowIndex-1);
return true;
}
return Shared::StoreController::setDataAtLocation(floatBody, columnIndex, rowIndex);
}
View * StoreController::loadView() {
for (int i = 0; i < k_numberOfTitleCells; i++) {
m_titleCells[i] = new EvenOddMessageTextCell(KDText::FontSize::Small);
}
return Shared::StoreController::loadView();
}
void StoreController::unloadView(View * view) {
for (int i = 0; i < k_numberOfTitleCells; i++) {
delete m_titleCells[i];
m_titleCells[i] = nullptr;
}
Shared::StoreController::unloadView(view);
}
}