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
|
#ifndef CODE_PYTHON_TEXT_AREA_H
#define CODE_PYTHON_TEXT_AREA_H
#include <escher/text_area.h>
namespace Code {
class PythonTextArea : public TextArea {
public:
PythonTextArea(Responder * parentResponder, KDText::FontSize fontSize) :
TextArea(parentResponder, &m_contentView, fontSize),
m_contentView(fontSize)
{
}
void loadSyntaxHighlighter() { m_contentView.loadSyntaxHighlighter(); }
void unloadSyntaxHighlighter() { m_contentView.unloadSyntaxHighlighter(); }
protected:
class ContentView : public TextArea::ContentView {
public:
ContentView(KDText::FontSize fontSize) :
TextArea::ContentView(fontSize),
m_pythonHeap(nullptr)
{
}
void loadSyntaxHighlighter();
void unloadSyntaxHighlighter();
void clearRect(KDContext * ctx, KDRect rect) const override;
void drawLine(KDContext * ctx, int line, const char * text, size_t length, int fromColumn, int toColumn) const override;
KDRect dirtyRectFromCursorPosition(size_t index, bool lineBreak) const override;
private:
static constexpr size_t k_pythonHeapSize = 4096;
char * m_pythonHeap;
};
private:
const ContentView * nonEditableContentView() const override { return &m_contentView; }
ContentView m_contentView;
};
}
#endif
|