Files
Upsilon/apps/code/menu_controller.h
Léa Saviot f3200fe2e9 [code] Program store that uses an accordeon buffer to store the
programs. The user can now add scripts.
A contextual menu displays various options when clicking on a script,
such as editing.

Change-Id: I124a17f7584b0beedb897e8499ca0a1bb6c13cbe
2017-11-17 11:59:50 +01:00

50 lines
1.7 KiB
C++

#ifndef CODE_MENU_CONTROLLER_H
#define CODE_MENU_CONTROLLER_H
#include <escher.h>
#include "console_controller.h"
#include "program_parameter_controller.h"
#include <apps/shared/new_function_cell.h>
#include "program_store.h"
namespace Code {
class MenuController : public ViewController, public SimpleListViewDataSource, public SelectableTableViewDataSource, public ButtonRowDelegate {
public:
MenuController(Responder * parentResponder, ProgramStore * programStore, ButtonRowController * footer);
ConsoleController * consoleController();
StackViewController * stackViewController();
void configureProgram();
void addProgram();
/* ViewController */
View * view() override;
bool handleEvent(Ion::Events::Event event) override;
void didBecomeFirstResponder() override;
/* SimpleListViewDataSource */
int numberOfRows() override;
KDCoordinate cellHeight() override;
HighlightCell * reusableCell(int index) override;
int reusableCellCount() override;
void willDisplayCellForIndex(HighlightCell * cell, int index) override;
/* ButtonRowDelegate */
int numberOfButtons(ButtonRowController::Position position) const override;
Button * buttonAtIndex(int index, ButtonRowController::Position position) const override;
private:
constexpr static int k_maxNumberOfCells = 5; //TODO
static constexpr KDCoordinate k_rowHeight = 50; //TODO create common parent class with Shared::ListController
ProgramStore * m_programStore;
MessageTableCell m_cells[k_maxNumberOfCells];
Shared::NewFunctionCell m_addNewProgramCell;
Button m_consoleButton;
SelectableTableView m_selectableTableView;
ConsoleController m_consoleController;
ProgramParameterController m_programParameterController;
};
}
#endif