Blame view

epsilon-master/apps/code/editor_controller.h 1.15 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
  #ifndef CODE_EDITOR_CONTROLLER_H
  #define CODE_EDITOR_CONTROLLER_H
  
  #include <escher.h>
  #include "script.h"
  #include "editor_view.h"
  
  namespace Code {
  
  class MenuController;
  class ScriptParameterController;
  
  class EditorController : public ViewController, public TextAreaDelegate {
  public:
    EditorController(MenuController * menuController);
    ~EditorController();
    void setScript(Script script);
  
    /* ViewController */
    View * view() override { return &m_editorView; }
    bool handleEvent(Ion::Events::Event event) override;
    void didBecomeFirstResponder() override;
    void viewWillAppear() override;
    void viewDidDisappear() override;
    ViewController::DisplayParameter displayParameter() override { return ViewController::DisplayParameter::WantsMaximumSpace; }
  
    /* TextAreaDelegate */
    bool textAreaDidReceiveEvent(TextArea * textArea, Ion::Events::Event event) override;
    Toolbox * toolboxForTextInput(TextInput * textInput) override;
  
  private:
    static constexpr int k_indentationSpacesNumber = 2;
    StackViewController * stackController();
    EditorView m_editorView;
    char * m_areaBuffer;
    Script m_script;
    MenuController * m_menuController;
  };
  
  }
  
  #endif