Files
Upsilon/apps/code/toolbox.h
Léa Saviot 13bf8c2d62 [code] Python toolbox.
Change-Id: I4028b05c662cae04a5ac3af5021f3438bb22dcd0
2017-11-17 11:59:50 +01:00

37 lines
1.1 KiB
C++

#ifndef CODE_TOOLBOX_H
#define CODE_TOOLBOX_H
#include <escher.h>
#include <apps/i18n.h>
#include <kandinsky/text.h>
namespace Code {
class Toolbox : public ::Toolbox {
public:
typedef void (*Action)(void * sender, const char * text);
Toolbox();
void setAction(Action action);
protected:
KDCoordinate rowHeight(int j) override;
bool selectLeaf(ToolboxMessageTree * selectedMessageTree) override;
const ToolboxMessageTree * rootModel() override;
MessageTableCellWithMessage * leafCellAtIndex(int index) override;
MessageTableCellWithChevron* nodeCellAtIndex(int index) override;
int maxNumberOfDisplayedRows() override;
constexpr static int k_maxNumberOfDisplayedRows = 13; // = 240/(13+2*3)
// 13 = minimal string height size
// 3 = vertical margins
private:
constexpr static KDCoordinate k_nodeRowHeight = 40;
constexpr static KDCoordinate k_leafRowHeight = 40;
constexpr static KDText::FontSize k_fontSize = KDText::FontSize::Small;
Action m_action;
MessageTableCellWithMessage m_leafCells[k_maxNumberOfDisplayedRows];
MessageTableCellWithChevron m_nodeCells[k_maxNumberOfDisplayedRows];
};
}
#endif