pgLab/pglab/codeeditor/GutterPainter.h

42 lines
722 B
C
Raw Normal View History

2022-04-10 10:29:40 +02:00
#include <QPainter>
#include <QTextBlock>
#include "util/Colors.h"
2022-04-10 10:29:40 +02:00
#pragma once
class CodeEditor;
class QPaintEvent;
class GutterPainter
{
public:
GutterPainter(CodeEditor *editor, QPaintEvent *event);
void Paint();
private:
2022-04-10 10:29:40 +02:00
CodeEditor *editor;
QPainter painter;
QPaintEvent *event;
QFontMetrics fontMetrics;
const ColorTheme &colorTheme;
2022-04-10 10:29:40 +02:00
struct LoopState {
CodeEditor *editor;
QTextBlock block;
int top;
int bottom;
LoopState(CodeEditor *editor);
int blockNumber() const;
void advanceToNextLine();
};
void drawLineNumber(const LoopState &loopState);
void drawGutterErrorMarker(const LoopState &loopState);
};