Files
Upsilon/apps/tool_box_controller.h
Émilie Feral 9ad2ae56b9 [apps] Base the tool box controller on a tree model
Change-Id: I2124e66964cc3abcc2cbb538adcddd7b31e9f19a
2016-11-10 11:56:32 +01:00

38 lines
1.4 KiB
C++

#ifndef APPS_TOOL_BOX_CONTROLLER_H
#define APPS_TOOL_BOX_CONTROLLER_H
#include <escher.h>
#include "node.h"
/* m_toolBoxModel points at the node of the tree (describing the whole toolbox)
* where we are located. It enables to know which rows are leaves and which are
* subtrees. */
class ToolBoxController : public StackViewController, public ListViewDataSource {
public:
ToolBoxController();
const char * title() const override;
bool handleEvent(Ion::Events::Event event) override;
void didBecomeFirstResponder() override;
int numberOfRows() override;
TableViewCell * reusableCell(int index, int type) override;
int reusableCellCount(int type) override;
void willDisplayCellForIndex(TableViewCell * cell, int index) override;
KDCoordinate rowHeight(int j) override;
KDCoordinate cumulatedHeightFromIndex(int j) override;
int indexFromCumulatedHeight(KDCoordinate offsetY) override;
int typeAtLocation(int i, int j) override;
void setTextFieldCaller(TextField * textField);
private:
constexpr static int k_maxNumberOfDisplayedRows = 6; //240/40
constexpr static KDCoordinate k_commandRowHeight = 50;
constexpr static KDCoordinate k_menuRowHeight = 40;
MenuListCell m_commandCells[k_maxNumberOfDisplayedRows];
MenuListCell m_menuCells[k_maxNumberOfDisplayedRows];
SelectableTableView m_selectableTableView;
TextField * m_textFieldCaller;
Node * m_toolBoxModel;
};
#endif