mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 16:57:31 +01:00
This makes the code in the various toolbox more generic. The arguments of the text to insert are each replaced by a Ion::Charset::Empty. These Empty chars are used to create layouts in ExpressionLayoutFields, and to compute the position of the cursor in other fields, before being removed. Change-Id: Ie81c1e394b06fef2ab801ccff919d6550f70ec30
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
#ifndef CODE_PYTHON_TOOLBOX_H
|
|
#define CODE_PYTHON_TOOLBOX_H
|
|
|
|
#include <apps/i18n.h>
|
|
#include <escher.h>
|
|
#include <ion/events.h>
|
|
#include <kandinsky/text.h>
|
|
|
|
namespace Code {
|
|
|
|
class PythonToolbox : public Toolbox {
|
|
public:
|
|
PythonToolbox();
|
|
bool handleEvent(Ion::Events::Event event) override;
|
|
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 KDText::FontSize k_fontSize = KDText::FontSize::Small;
|
|
void scrollToLetter(char letter);
|
|
void scrollToAndSelectChild(int i);
|
|
MessageTableCellWithMessage m_leafCells[k_maxNumberOfDisplayedRows];
|
|
MessageTableCellWithChevron m_nodeCells[k_maxNumberOfDisplayedRows];
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|