Numworks Epsilon  1.4.1
Graphing Calculator Operating System
editable_text_cell.h
Go to the documentation of this file.
1 #ifndef ESCHER_EDITABLE_TEXT_CELL_H
2 #define ESCHER_EDITABLE_TEXT_CELL_H
3 
4 #include <escher/responder.h>
7 #include <escher/text_field.h>
8 
9 class EditableTextCell : public HighlightCell, public Responder {
10 public:
11  EditableTextCell(Responder * parentResponder = nullptr, TextFieldDelegate * delegate = nullptr, char * draftTextBuffer = nullptr, KDText::FontSize size = KDText::FontSize::Large,
12  float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = KDColorBlack, KDColor = KDColorWhite, KDCoordinate topMargin = 0, KDCoordinate rightMargin = 0, KDCoordinate bottomMargin = 0, KDCoordinate leftMargin = 0);
13  TextField * textField();
14  void setMargins(KDCoordinate topMargin = 0, KDCoordinate rightMargin = 0, KDCoordinate bottomMargin = 0, KDCoordinate leftMargin = 0);
15  void setHighlighted(bool highlight) override;
16  Responder * responder() override {
17  return this;
18  }
19  int numberOfSubviews() const override;
20  View * subviewAtIndex(int index) override;
21  void layoutSubviews() override;
22  void didBecomeFirstResponder() override;
23  KDSize minimalSizeForOptimalDisplay() const override;
24 private:
25  constexpr static KDCoordinate k_separatorThickness = 1;
26  TextField m_textField;
27  char m_textBody[TextField::maxBufferSize()];
28  KDCoordinate m_topMargin;
29  KDCoordinate m_rightMargin;
30  KDCoordinate m_bottomMargin;
31  KDCoordinate m_leftMargin;
32 };
33 
34 #endif
int numberOfSubviews() const override
static constexpr int maxBufferSize()
Definition: text_field.h:23
void setMargins(KDCoordinate topMargin=0, KDCoordinate rightMargin=0, KDCoordinate bottomMargin=0, KDCoordinate leftMargin=0)
Responder * responder() override
int16_t KDCoordinate
Definition: coordinate.h:6
Responder * parentResponder() const
Definition: responder.cpp:12
TextField * textField()
View * subviewAtIndex(int index) override
Definition: size.h:6
constexpr KDColor KDColorWhite
Definition: color.h:42
void didBecomeFirstResponder() override
constexpr KDColor KDColorBlack
Definition: color.h:41
EditableTextCell(Responder *parentResponder=nullptr, TextFieldDelegate *delegate=nullptr, char *draftTextBuffer=nullptr, KDText::FontSize size=KDText::FontSize::Large, float horizontalAlignment=0.0f, float verticalAlignment=0.5f, KDColor textColor=KDColorBlack, KDColor=KDColorWhite, KDCoordinate topMargin=0, KDCoordinate rightMargin=0, KDCoordinate bottomMargin=0, KDCoordinate leftMargin=0)
void layoutSubviews() override
Definition: color.h:6
Definition: view.h:23
void setHighlighted(bool highlight) override
KDSize minimalSizeForOptimalDisplay() const override
FontSize
Definition: text.h:10