[apps/graph] Add a parameter page to the graph/list to test the stack controller of list

Change-Id: Ibee4d038f4917567d4a237fe4b7a813b79cb1c81
This commit is contained in:
Émilie Feral
2016-09-15 10:30:30 +02:00
committed by Romain Goyet
parent 496a10aebd
commit c337b5088f
5 changed files with 50 additions and 2 deletions

View File

@@ -7,4 +7,5 @@ app_objs += $(addprefix apps/graph/,\
graph/graph_view.o\
list/function_cell.o\
list/list_controller.o\
list/parameter_controller.o\
)

View File

@@ -4,13 +4,15 @@
ListController::ListController(Responder * parentResponder, Graph::FunctionStore * functionStore) :
ViewController(parentResponder),
m_tableView(TableView(this)),
m_activeCell(0),
m_activeCell(-1),
m_manualScrolling(0),
m_functionStore(functionStore)
m_functionStore(functionStore),
m_parameterController(ParameterController(this))
{
}
View * ListController::view() {
setActiveCell(0);
return &m_tableView;
}
@@ -39,6 +41,9 @@ bool ListController::handleEvent(Ion::Events::Event event) {
setActiveCell(m_activeCell-1);
return true;
case Ion::Events::Event::ENTER:
((StackViewController *) parentResponder())->push(&m_parameterController);
return true;
case Ion::Events::Event::PLUS:
m_manualScrolling += 10;
m_tableView.setContentOffset({0, m_manualScrolling});
return true;

View File

@@ -4,6 +4,7 @@
#include <escher.h>
#include "../function_store.h"
#include "function_cell.h"
#include "parameter_controller.h"
class ListController : public ViewController, public TableViewDataSource {
public:
@@ -30,6 +31,9 @@ private:
int m_activeCell;
KDCoordinate m_manualScrolling;
Graph::FunctionStore * m_functionStore;
ParameterController m_parameterController;
};
#endif

View File

@@ -0,0 +1,19 @@
#include "parameter_controller.h"
ParameterController::ParameterController(Responder * parentResponder) :
ViewController(parentResponder),
m_solidColorView(SolidColorView(KDColorRed))
{
}
View * ParameterController::view() {
return &m_solidColorView;
}
const char * ParameterController::title() const {
return "List Function Parameter";
}
bool ParameterController::handleEvent(Ion::Events::Event event) {
return false;
}

View File

@@ -0,0 +1,19 @@
#ifndef GRAPH_LIST_PARAM_CONTROLLER_H
#define GRAPH_LIST_PARAM_CONTROLLER_H
#include <escher.h>
class ParameterController : public ViewController {
public:
ParameterController(Responder * parentResponder);
View * view() override;
const char * title() const override;
bool handleEvent(Ion::Events::Event event) override;
private:
SolidColorView m_solidColorView;
};
#endif