-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCodeBrowser.h
More file actions
63 lines (46 loc) · 1.29 KB
/
CodeBrowser.h
File metadata and controls
63 lines (46 loc) · 1.29 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once
#include "BreakpointModel.h"
#include <QPlainTextEdit>
QT_BEGIN_NAMESPACE
class QPaintEvent;
class QResizeEvent;
class QSize;
class QWidget;
QT_END_NAMESPACE
namespace visual_lldb {
class LineNumberArea;
class CodeBrowser : public QPlainTextEdit {
Q_OBJECT
public:
CodeBrowser(QWidget *parent = nullptr);
void lineNumberAreaPaintEvent(QPaintEvent *event);
int lineNumberAreaWidth();
void contextMenuEvent(QContextMenuEvent *event) override;
void updateHighlightedLines(const std::vector<Breakpoint> &bps,
size_t currentLine);
signals:
void breakpointToggled(size_t lineNumber);
protected:
void resizeEvent(QResizeEvent *event) override;
private slots:
void updateLineNumberAreaWidth(int newBlockCount);
void updateLineNumberArea(const QRect &rect, int dy);
void onBreakpointAction();
private:
QWidget *lineNumberArea;
};
class LineNumberArea : public QWidget {
public:
LineNumberArea(CodeBrowser *browser)
: QWidget(browser), codeBrowser(browser) {}
QSize sizeHint() const override {
return QSize(codeBrowser->lineNumberAreaWidth(), 0);
}
protected:
void paintEvent(QPaintEvent *event) override {
codeBrowser->lineNumberAreaPaintEvent(event);
}
private:
CodeBrowser *codeBrowser;
};
} // namespace visual_lldb