Files
Upsilon/apps/settings/main_controller.cpp
Émilie Feral e1a77ce8aa [apps/settings] Implement structure of settings app
Change-Id: If42dc3fcb363e3ceac0dda9f89394f2535ab09be
2017-01-30 15:30:58 +01:00

53 lines
1.3 KiB
C++

#include "main_controller.h"
#include <assert.h>
namespace Settings {
MainController::MainController(Responder * parentResponder) :
ViewController(parentResponder),
m_cells{ChevronMenuListCell((char*)"Angles"), ChevronMenuListCell((char*)"Resultats"), ChevronMenuListCell((char*)"Forme nombre"),
ChevronMenuListCell((char*)"Forme complexe"), ChevronMenuListCell((char*)"Langue")},
m_selectableTableView(SelectableTableView(this, this, Metric::TopMargin, Metric::RightMargin,
Metric::BottomMargin, Metric::LeftMargin))
{
}
const char * MainController::title() const {
return "Parametres";
}
View * MainController::view() {
return &m_selectableTableView;
}
void MainController::didBecomeFirstResponder() {
if (m_selectableTableView.selectedRow() < 0) {
m_selectableTableView.selectCellAtLocation(0, 0);
}
app()->setFirstResponder(&m_selectableTableView);
}
bool MainController::handleEvent(Ion::Events::Event event) {
return false;
}
int MainController::numberOfRows() {
return k_totalNumberOfCell;
};
TableViewCell * MainController::reusableCell(int index) {
assert(index >= 0);
assert(index < k_totalNumberOfCell);
return &m_cells[index];
}
int MainController::reusableCellCount() {
return k_totalNumberOfCell;
}
KDCoordinate MainController::cellHeight() {
return Metric::ParameterCellHeight;
}
}