mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
#ifndef CODE_SCRIPT_NAME_CELL_H
|
|
#define CODE_SCRIPT_NAME_CELL_H
|
|
|
|
#include <escher/even_odd_cell.h>
|
|
#include <escher/metric.h>
|
|
#include <escher/responder.h>
|
|
#include <escher/text_field_delegate.h>
|
|
#include <apps/shared/text_field_with_extension.h>
|
|
#include "script_store.h"
|
|
|
|
namespace Code {
|
|
|
|
class ScriptNameCell : public EvenOddCell, public Responder {
|
|
public:
|
|
ScriptNameCell(Responder * parentResponder = nullptr, TextFieldDelegate * delegate = nullptr) :
|
|
EvenOddCell(),
|
|
Responder(parentResponder),
|
|
m_textField(k_extensionLength, this, m_textBody, m_textBody, TextField::maxBufferSize(), delegate, false)
|
|
{}
|
|
|
|
Shared::TextFieldWithExtension * textField() { return &m_textField; }
|
|
|
|
// EvenOddCell
|
|
void setEven(bool even) override;
|
|
// HighlightCell
|
|
void setHighlighted(bool highlight) override;
|
|
Responder * responder() override { return this; }
|
|
const char * text() const override;
|
|
// View
|
|
KDSize minimalSizeForOptimalDisplay() const override;
|
|
// Responder
|
|
void didBecomeFirstResponder() override;
|
|
|
|
private:
|
|
constexpr static size_t k_extensionLength = 1+ScriptStore::k_scriptExtensionLength; // '.' + "py"
|
|
constexpr static KDCoordinate k_leftMargin = Metric::HistoryHorizontalMargin;
|
|
|
|
// View
|
|
int numberOfSubviews() const override { return 1; }
|
|
View * subviewAtIndex(int index) override {
|
|
assert(index == 0);
|
|
return &m_textField;
|
|
}
|
|
void layoutSubviews() override;
|
|
|
|
Shared::TextFieldWithExtension m_textField;
|
|
char m_textBody[TextField::maxBufferSize()];
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|