Blame view

build2/epsilon-master/apps/code/console_edit_cell.h 1.05 KB
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  #ifndef CODE_EDIT_CELL_H
  #define CODE_EDIT_CELL_H
  
  #include <escher/responder.h>
  #include <escher/highlight_cell.h>
  #include <escher/text_field.h>
  #include <escher/text_field_delegate.h>
  #include <escher/pointer_text_view.h>
  
  namespace Code {
  
  class ConsoleEditCell : public HighlightCell, public Responder {
  public:
    ConsoleEditCell(Responder * parentResponder = nullptr, TextFieldDelegate * delegate = nullptr);
  
    // View
    int numberOfSubviews() const override;
    View * subviewAtIndex(int index) override;
    void layoutSubviews() override;
  
    // Responder
    void didBecomeFirstResponder() override;
  
    /* HighlightCell */
    Responder * responder() override {
      return this;
    }
  
    // Edit cell
    void setEditing(bool isEditing, bool reinitDraftBuffer = false);
    const char * text() const override { return m_textField.text(); }
    void setText(const char * text);
    bool insertText(const char * text);
    void setPrompt(const char * prompt);
  private:
    char m_textBuffer[TextField::maxBufferSize()];
    PointerTextView m_promptView;
    TextField m_textField;
  };
  
  }
  
  #endif