1 | /* |
2 | SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org> |
3 | |
4 | SPDX-License-Identifier: MIT |
5 | */ |
6 | |
7 | #ifndef CODEEDITOR_H |
8 | #define CODEEDITOR_H |
9 | |
10 | #include <KSyntaxHighlighting/Repository> |
11 | |
12 | #include <QPlainTextEdit> |
13 | |
14 | namespace KSyntaxHighlighting |
15 | { |
16 | class SyntaxHighlighter; |
17 | } |
18 | |
19 | class ; |
20 | |
21 | class CodeEditor : public QPlainTextEdit |
22 | { |
23 | Q_OBJECT |
24 | public: |
25 | explicit CodeEditor(QWidget *parent = nullptr); |
26 | ~CodeEditor() override; |
27 | |
28 | void openFile(const QString &fileName); |
29 | |
30 | protected: |
31 | void (QContextMenuEvent *event) override; |
32 | void resizeEvent(QResizeEvent *event) override; |
33 | |
34 | private: |
35 | friend class CodeEditorSidebar; |
36 | void setTheme(const KSyntaxHighlighting::Theme &theme); |
37 | int () const; |
38 | void (QPaintEvent *event); |
39 | void (); |
40 | void (const QRect &rect, int dy); |
41 | void highlightCurrentLine(); |
42 | |
43 | QTextBlock blockAtPosition(int y) const; |
44 | bool isFoldable(const QTextBlock &block) const; |
45 | bool isFolded(const QTextBlock &block) const; |
46 | void toggleFold(const QTextBlock &block); |
47 | |
48 | KSyntaxHighlighting::Repository m_repository; |
49 | KSyntaxHighlighting::SyntaxHighlighter *m_highlighter; |
50 | CodeEditorSidebar *; |
51 | }; |
52 | |
53 | #endif // CODEEDITOR_H |
54 | |