Files
Upsilon/apps/graph/list/list_controller.h
Émilie Feral a4a0a4b298 [apps/graph/list] improve the drawing of the list of function
Change-Id: I0e0ea607988fdb6debeb7c48a04945519859db19
2016-10-12 17:39:50 +02:00

55 lines
1.9 KiB
C++

#ifndef GRAPH_LIST_CONTROLLER_H
#define GRAPH_LIST_CONTROLLER_H
#include <escher.h>
#include "../function_store.h"
#include "function_name_view.h"
#include "function_expression_view.h"
#include "parameter_controller.h"
class ListController : public ViewController, public TableViewDataSource {
public:
ListController(Responder * parentResponder, Graph::FunctionStore * functionStore);
void setActiveCell(int i, int j);
View * view() override;
const char * title() const override;
bool handleEvent(Ion::Events::Event event) override;
bool handleEnter();
void didBecomeFirstResponder() override;
int numberOfRows() override;
int numberOfColumns() override;
void willDisplayCellAtLocation(View * cell, int i, int j) override;
KDCoordinate columnWidth(int i) override;
KDCoordinate rowHeight(int j) override;
KDCoordinate cumulatedWidthFromIndex(int i) override;
KDCoordinate cumulatedHeightFromIndex(int j) override;
int indexFromCumulatedWidth(KDCoordinate offsetX) override;
int indexFromCumulatedHeight(KDCoordinate offsetY) override;
View * reusableCell(int index, int type) override;
int reusableCellCount(int type) override;
int typeAtLocation(int i, int j) override;
void configureFunction(Graph::Function * function);
void editExpression(FunctionExpressionView * functionCell);
private:
static constexpr KDCoordinate k_verticalFunctionMargin = 50-12;
static constexpr KDCoordinate k_functionNameWidth = 65;
Responder * tabController() const;
constexpr static int k_maxNumberOfRows = 6;
// !!! CAUTION: The order here is important
// The cells should be initialized *before* the TableView!
FunctionNameView m_nameCells[k_maxNumberOfRows];
FunctionExpressionView m_expressionCells[k_maxNumberOfRows];
TableView m_tableView;
int m_activeCellx;
int m_activeCelly;
KDCoordinate m_manualScrolling;
Graph::FunctionStore * m_functionStore;
ParameterController m_parameterController;
};
#endif