RedPanda-CPP/RedPandaIDE/qsynedit/TextPainter.h

53 lines
1.3 KiB
C++

#ifndef TEXTPAINTER_H
#define TEXTPAINTER_H
#include <QColor>
#include <QPainter>
#include <QString>
#include "Types.h"
class SynEdit;
class SynEditTextPainter
{
struct TokenAccu {
int Len;
int MaxLen;
int CharsBefore;
QString s;
QColor FG;
QColor BG;
SynFontStyles Style;
};
public:
SynEditTextPainter(SynEdit * edit);
QColor colEditorBG();
void ComputeSelectionInfo();
void setDrawingColors(bool Selected);
int ColumnToXValue(int Col);
void PaintToken(const QString& Token, int TokenLen, int CharsBefore,
int First, int Last, bool isSelection);
private:
SynEdit* edit;
QPainter* painter;
bool bDoRightEdge; // right edge
int nRightEdge;
// selection info
bool bAnySelection; // any selection visible?
DisplayCoord vSelStart; // start of selected area
DisplayCoord vSelEnd; // end of selected area
// info about normal and selected text and background colors
bool bSpecialLine, bLineSelected, bCurrentLine;
QColor colFG, colBG;
QColor colSelFG, colSelBG;
// info about selection of the current line
int nLineSelStart, nLineSelEnd;
bool bComplexLine;
// painting the background and the text
QRect rcLine, rcToken;
int vFirstLine, vLastLine;
};
#endif // TEXTPAINTER_H