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
44
45
46
47
48
49
|
#ifndef CODE_EDITOR_VIEW_H
#define CODE_EDITOR_VIEW_H
#include <escher/view.h>
#include "python_text_area.h"
namespace Code {
class EditorView : public Responder, public View, public ScrollViewDelegate {
public:
EditorView(Responder * parentResponder);
void setTextAreaDelegate(TextAreaDelegate * delegate) {
m_textArea.setDelegate(delegate);
}
const char * text() const { return m_textArea.text(); }
void setText(char * textBuffer, size_t textBufferSize) {
m_textArea.setText(textBuffer, textBufferSize);
}
bool setCursorLocation(int location) {
return m_textArea.setCursorLocation(location);
}
void loadSyntaxHighlighter() { m_textArea.loadSyntaxHighlighter(); };
void unloadSyntaxHighlighter() { m_textArea.unloadSyntaxHighlighter(); };
void scrollViewDidChangeOffset(ScrollViewDataSource * scrollViewDataSource) override;
void didBecomeFirstResponder() override;
private:
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
void layoutSubviews() override;
class GutterView : public View {
public:
GutterView(KDText::FontSize fontSize);
void drawRect(KDContext * ctx, KDRect rect) const override;
void setOffset(KDCoordinate offset);
KDSize minimalSizeForOptimalDisplay() const override;
private:
static constexpr KDCoordinate k_margin = 2;
KDText::FontSize m_fontSize;
KDCoordinate m_offset;
};
PythonTextArea m_textArea;
GutterView m_gutterView;
};
}
#endif
|