mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-21 06:40:37 +01:00
54 lines
1.9 KiB
C++
54 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 HeaderViewController, public TableViewDataSource {
|
|
public:
|
|
ListController(Responder * parentResponder, Graph::FunctionStore * functionStore);
|
|
|
|
void setActiveCell(int i, int j);
|
|
|
|
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
|