Numworks Epsilon  1.4.1
Graphing Calculator Operating System
console_edit_cell.h
Go to the documentation of this file.
1 #ifndef CODE_EDIT_CELL_H
2 #define CODE_EDIT_CELL_H
3 
4 #include <escher/responder.h>
6 #include <escher/text_field.h>
9 
10 namespace Code {
11 
12 class ConsoleEditCell : public HighlightCell, public Responder {
13 public:
14  ConsoleEditCell(Responder * parentResponder = nullptr, TextFieldDelegate * delegate = nullptr);
15 
16  // View
17  int numberOfSubviews() const override;
18  View * subviewAtIndex(int index) override;
19  void layoutSubviews() override;
20 
21  // Responder
22  void didBecomeFirstResponder() override;
23 
24  /* HighlightCell */
25  Responder * responder() override {
26  return this;
27  }
28 
29  // Edit cell
30  void setEditing(bool isEditing, bool reinitDraftBuffer = false);
31  const char * text() const { return m_textField.text(); }
32  void setText(const char * text);
33  bool insertText(const char * text);
34  void setPrompt(const char * prompt);
35 private:
36  char m_textBuffer[TextField::maxBufferSize()];
37  PointerTextView m_promptView;
38  TextField m_textField;
39 };
40 
41 }
42 
43 #endif
void setText(const char *text)
int numberOfSubviews() const override
Responder * responder() override
void didBecomeFirstResponder() override
bool insertText(const char *text)
static constexpr int maxBufferSize()
Definition: text_field.h:23
void setPrompt(const char *prompt)
View * subviewAtIndex(int index) override
Responder * parentResponder() const
Definition: responder.cpp:12
void layoutSubviews() override
Definition: app.cpp:7
const char * text() const
Definition: text_input.h:14
Definition: view.h:23
void setEditing(bool isEditing, bool reinitDraftBuffer=false)
ConsoleEditCell(Responder *parentResponder=nullptr, TextFieldDelegate *delegate=nullptr)
const char * text() const